Module: crypto/crypto

Requires

Methods

(static) generateSessionKey(algo) → {Uint8Array}

Generating a session key for the specified symmetric algorithm
Parameters:
Name Type Description
algo module:enums.symmetric Algorithm to use (see RFC 4880 9.2)
Source:
Returns:
Random bytes as a string to be used as a key
Type
Uint8Array

(static) getPrefixRandom(algo) → {Uint8Array}

generate random byte prefix as string for the specified algorithm
Parameters:
Name Type Description
algo module:enums.symmetric Algorithm to use (see RFC 4880 9.2)
Source:
Returns:
Random bytes with length equal to the block size of the cipher
Type
Uint8Array

(static) getPrivateMpiCount(algo) → {Integer}

Returns the number of integers comprising the private key of an algorithm
Parameters:
Name Type Description
algo String The public key algorithm
Source:
Returns:
The number of integers.
Type
Integer

(static) publicKeyDecrypt(algo, publicMPIs, secretMPIs, data) → {module:type/mpi}

Decrypts data using the specified public key multiprecision integers of the private key, the specified secretMPIs of the private key and the specified algorithm.
Parameters:
Name Type Description
algo module:enums.publicKey Algorithm to be used (See RFC 4880 9.1)
publicMPIs Array.<module:type/mpi> Algorithm dependent multiprecision integers of the public key part of the private key
secretMPIs Array.<module:type/mpi> Algorithm dependent multiprecision integers of the private key used
data module:type/mpi Data to be encrypted as MPI
Source:
Returns:
returns a big integer containing the decrypted data; otherwise null
Type
module:type/mpi

(static) publicKeyEncrypt(algo, publicMPIs, data) → {Array.<module:type/mpi>}

Encrypts data using the specified public key multiprecision integers and the specified algorithm.
Parameters:
Name Type Description
algo module:enums.publicKey Algorithm to be used (See RFC 4880 9.1)
publicMPIs Array.<module:type/mpi> Algorithm dependent multiprecision integers
data module:type/mpi Data to be encrypted as MPI
Source:
Returns:
if RSA an module:type/mpi; if elgamal encryption an array of two module:type/mpi is returned; otherwise null
Type
Array.<module:type/mpi>