Module: crypto/signature

Provides functions for asymmetric signing and signature verification

Source:

Requires

Methods

(async, static) sign(algo, hash_algo, key_params, data, hashed) → {Uint8Array}

Creates a signature on data using specified algorithms and private key parameters. See RFC 4880 9.1 and RFC 4880 9.4 for public key and hash algorithms.

Parameters:
Name Type Description
algo module:enums.publicKey

Public key algorithm

hash_algo module:enums.hash

Hash algorithm

key_params Array.<module:type/mpi>

Algorithm-specific public and private key parameters

data Uint8Array

Data to be signed

hashed Uint8Array

The hashed data

Source:
Returns:

Signature

Type
Uint8Array

(async, static) verify(algo, hash_algo, msg_MPIs, pub_MPIs, data, hashed) → {Boolean}

Verifies the signature provided for data using specified algorithms and public key parameters. See RFC 4880 9.1 and RFC 4880 9.4 for public key and hash algorithms.

Parameters:
Name Type Description
algo module:enums.publicKey

Public key algorithm

hash_algo module:enums.hash

Hash algorithm

msg_MPIs Array.<module:type/mpi>

Algorithm-specific signature parameters

pub_MPIs Array.<module:type/mpi>

Algorithm-specific public key parameters

data Uint8Array

Data for which the signature was created

hashed Uint8Array

The hashed data

Source:
Returns:

True if signature is valid

Type
Boolean