Implementation of ECDSA following RFC6637 for Openpgpjs
Methods
(async, static) sign(oid, hashAlgo, message, publicKey, privateKey, hashed) → {Promise.<{r: Uint8Array, s: Uint8Array}>}
Sign a message using the provided key
Parameters:
Name | Type | Description |
---|---|---|
oid |
module:type/oid | Elliptic curve object identifier |
hashAlgo |
module:enums.hash | Hash algorithm used to sign |
message |
Uint8Array | Message to sign |
publicKey |
Uint8Array | Public key |
privateKey |
Uint8Array | Private key used to sign the message |
hashed |
Uint8Array | The hashed message |
Returns:
Signature of the message
- Type
- Promise.<{r: Uint8Array, s: Uint8Array}>
(async, static) validateParams(oid, Q, d) → {Promise.<Boolean>}
Validate ECDSA parameters
Parameters:
Name | Type | Description |
---|---|---|
oid |
module:type/oid | Elliptic curve object identifier |
Q |
Uint8Array | ECDSA public point |
d |
Uint8Array | ECDSA secret scalar |
Returns:
Whether params are valid.
- Type
- Promise.<Boolean>
(async, static) verify(oid, hashAlgo, signature, message, publicKey, hashed) → {Boolean}
Verifies if a signature is valid for a message
Parameters:
Name | Type | Description |
---|---|---|
oid |
module:type/oid | Elliptic curve object identifier |
hashAlgo |
module:enums.hash | Hash algorithm used in the signature |
signature |
Object | Signature to verify |
message |
Uint8Array | Message to verify |
publicKey |
Uint8Array | Public key used to verify the message |
hashed |
Uint8Array | The hashed message |
Returns:
- Type
- Boolean
(async, inner) jsVerify()
Fallback javascript implementation of ECDSA verification. To be used if no native implementation is available for the given curve/operation.