id: rsa title: RSA sidebar_label: RSA

Classes

RSA

Kind: global class
this: {RSA}

new RSA()

Creates an instance of RSA

RSA.bytestohex(b) ⇒

Convert byte array to hex string

Kind: static method of RSA
Returns: s hex string
this: {RSA}

ParamDescription
bbyte array

RSA.bytestostring(b) ⇒

Convert byte array to string

Kind: static method of RSA
Returns: s string
this: {RSA}

ParamDescription
bbyte array

RSA.stringtobytes(s) ⇒

Convert a string to byte array

Kind: static method of RSA
Returns: b byte array
this: {RSA}

ParamDescription
sstring

RSA.hashit(sha, A, n) ⇒

General purpose hash function

Kind: static method of RSA
Returns: R hash value
this: {RSA}

ParamDescription
shais the hash type
Abyte array
nInteger

RSA.KEY_PAIR(rng, e, PRIV, PUB)

RSA Key Pair Generator

Kind: static method of RSA
this: {RSA}

ParamDescription
rngis a pointer to a cryptographically secure random number generator
ethe encryption exponent
PRIVthe output RSA private key
PUBthe output RSA public key

RSA.PKCS15(rng, e, PRIV, PUB) ⇒

PKCS V1.5 padding of a message prior to RSA signature

Kind: static method of RSA
Returns: true or false
this: {RSA}

ParamDescription
rngis a pointer to a cryptographically secure random number generator
ethe encryption exponent
PRIVthe output RSA private key
PUBthe output RSA public key

RSA.OAEP_ENCODE(sha, m, rng, P) ⇒

OAEP padding of a message prior to RSA encryption

Kind: static method of RSA
Returns: f is the output encoding, ready for RSA encryption
this: {RSA}

ParamDescription
shais the hash type
mis the input message
rngis a pointer to a cryptographically secure random number generator
Pare input encoding parameter string (could be NULL)

RSA.OAEP_DECODE(sha, P, f) ⇒

OAEP unpadding of a message after RSA decryption

Kind: static method of RSA
Returns: r is the unpadded message
this: {RSA}

ParamDescription
shais the hash type
Pare input encoding parameter string (could be NULL)
fis the padded message

RSA.PRIVATE_KEY_KILL(PRIV)

Destroy an RSA private Key

Kind: static method of RSA
this: {RSA}

ParamDescription
PRIVthe input RSA private key. Destroyed on output.

RSA.ENCRYPT(PUB, F, G)

RSA encryption of suitably padded plaintext

Kind: static method of RSA
this: {RSA}

ParamDescription
PUBthe input RSA public key
Fis input padded message
Gis the output ciphertext

RSA.DECRYPT(PRIV, G, F)

RSA decryption of ciphertext

Kind: static method of RSA
this: {RSA}

ParamDescription
PRIVthe input RSA private key
Gis the input ciphertext
Fis output plaintext (requires unpadding)

rsa_private_key

Kind: global class
this: {rsa_private_key}

new rsa_private_key(n)

Creates an instance of rsa_private_key

ParamDescription
nFF length

rsa_public_key

Kind: global class
this: {rsa_private_key}

new rsa_public_key(m)

Creates an instance of rsa_public_key

ParamDescription
mFF length