Module: crypto/public_key/elliptic/curve

Wrapper of an instance of an Elliptic Curve

Source:

Methods

(inner) checkPublicPointEnconding()

Check whether the public point has a valid encoding. NB: this function does not check e.g. whether the point belongs to the curve.

Source:

(inner) getPreferredHashAlgo(oid) → {enums.hash}

Get preferred hash algo to use with the given curve

Parameters:
Name Type Description
oid module:type/oid

curve oid

Source:
Returns:

hash algorithm

Type
enums.hash

(inner) jwkToRawPublic(jwk) → {Uint8Array}

Parameters:
Name Type Description
jwk JsonWebKey

key for conversion

Source:
Returns:

Raw public key.

Type
Uint8Array

(inner) privateToJWK(payloadSize, name, publicKey, privateKey) → {JsonWebKey}

Parameters:
Name Type Description
payloadSize Integer

ec payload size

name String

curve name

publicKey Uint8Array

public key

privateKey Uint8Array

private key

Source:
Returns:

Private key in jwk format.

Type
JsonWebKey

(inner) rawPublicToJWK(payloadSize, name, publicKey) → {JsonWebKey}

Parameters:
Name Type Description
payloadSize Integer

ec payload size

name String

curve name

publicKey Uint8Array

public key

Source:
Returns:

Public key in jwk format.

Type
JsonWebKey

(async, inner) validateStandardParams(algo, oid, Q, d) → {Promise.<Boolean>}

Validate ECDH and ECDSA parameters Not suitable for EdDSA (different secret key format)

Parameters:
Name Type Description
algo module:enums.publicKey

EC algorithm, to filter supported curves

oid module:type/oid

EC object identifier

Q Uint8Array

EC public point

d Uint8Array

EC secret scalar

Source:
Returns:

Whether params are valid.

Type
Promise.<Boolean>