API Docs for: 1.3.12
Show:

EcRsaOaep Class

Helper methods for performing RSA Encryption methods. Uses Optimal Asymmetric Encryption Padding (OAEP) encryption and decryption. Uses RSA SSA PKCS#1 v1.5 (RSASSA-PKCS1-V1_5) signing and verifying with UTF8 encoding.

Item Index

Methods

Methods

decrypt

(
  • ppk
  • ciphertext
)
String static

Decrypts a block of ciphertext (no more than 256 bytes) with a private key using RSA OAEP encryption. Returns a unencoded plaintext.

Parameters:

  • ppk EcPpk

    Public private keypair.

  • ciphertext String

    Ciphertext.

Returns:

String:

Unencoded plaintext.

encrypt

(
  • pk
  • plaintext
)
static

Encrypts a block of plaintext (no more than 256 bytes) with a public key using RSA OAEP encryption. Returns a base64 encoded ciphertext.

Parameters:

  • pk EcPk

    Public Key.

  • plaintext String

    Plaintext. Does not perform encoding.

sign

(
  • ppk
  • text
)
static

Creates a signature for the provided text using the public private keypair. May be verified with the public key. Uses SHA1 hash with a UTF8 decoding of the text. Returns base64 encoded signature.

Parameters:

  • ppk EcPpk

    Public private keypair.

  • text String

    Text to sign.

Returns:

Base64 encoded signature.

signSha256

(
  • ppk
  • text
)
static

Creates a signature for the provided text using the public private keypair. May be verified with the public key. Uses SHA256 hash with a UTF8 decoding of the text. Returns base64 encoded signature.

Parameters:

  • ppk EcPpk

    Public private keypair.

  • text String

    Text to sign.

Returns:

Base64 encoded signature.

verify

(
  • pk
  • text
  • signature
)
static

Verifies the integrity of the provided text using a signature and a public key. Uses SHA1 hash with a UTF8 decoding of the text.

Parameters:

  • pk EcPk

    Public key.

  • text String

    Text to verify.

  • signature String

    Base64 encoded signature.

Returns:

True IFF the signature is valid.