Provides functions for asymmetric signing and signature verification
- Source:
Methods
(async, static) parseSignatureParams(algo, signature) → {Promise.<Object>}
Parse signature in binary form to get the parameters. The returned values are only padded for EdDSA, since in the other cases their expected length depends on the key params, hence we delegate the padding to the signature verification function. See RFC 4880 9.1 See RFC 4880 5.2.2.
Parameters:
Name | Type | Description |
---|---|---|
algo |
module:enums.publicKey | Public key algorithm |
signature |
Uint8Array | Data for which the signature was created |
- Source:
Returns:
True if signature is valid.
- Type
- Promise.<Object>
(async, static) sign(algo, hashAlgo, publicKeyParams, privateKeyParams, data, hashed) → {Promise.<Object>}
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 |
hashAlgo |
module:enums.hash | Hash algorithm |
publicKeyParams |
Object | Algorithm-specific public and private key parameters |
privateKeyParams |
Object | Algorithm-specific public and private key parameters |
data |
Uint8Array | Data to be signed |
hashed |
Uint8Array | The hashed data |
- Source:
Returns:
Signature Object containing named signature parameters.
- Type
- Promise.<Object>
(async, static) verify(algo, hashAlgo, signature, publicParams, data, hashed) → {Promise.<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 |
hashAlgo |
module:enums.hash | Hash algorithm |
signature |
Object | Named algorithm-specific signature parameters |
publicParams |
Object | 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
- Promise.<Boolean>