EccKeyBuilder
A builder class for creating Elliptic Curve Cryptography (ECC) keys. This class extends AsymmetricKeyBuilder to provide ECC-specific functionality.
Extends
Accessors
algorithm
Set Signature
set algorithm(
algorithm
):void
Set the algorithm to be used for the asymmetric key.
Throws
InvalidArgumentError If the algorithm is not supported.
Parameters
algorithm
The asymmetric algorithm to use.
Returns
void
Inherited from
AsymmetricKeyBuilder
.algorithm
curve
Set Signature
set curve(
curve
):void
Set the elliptic curve to be used for the ECC key. Defaults to P-521.
Throws
InvalidArgumentError If the argument is not a valid curve.
Parameters
curve
The elliptic curve to use for key generation.
Returns
void
The ECC key builder.
exportable
Set Signature
set exportable(
exportable
):void
Set whether the key is exportable.
Remarks
A key is NOT exportable unless explicitly set so.
Parameters
exportable
boolean
A boolean value indicating whether the key is exportable.
Returns
void
Inherited from
AsymmetricKeyBuilder
.exportable
purposes
Set Signature
set purposes(
purposes
):void
Set the purposes for which the key can be used.
Throws
InvalidArgumentError If any argument is not a valid purpose.
Parameters
purposes
An array of key purposes.
Returns
void
Inherited from
Methods
buildGenerated()
buildGenerated():
Promise
<PrivateKey
>
Build a new private key based on the configured properties.
Returns
Promise
<PrivateKey
>
A promise that resolves to the generated private key.
Throws
InvalidArgumentError If the chosen key size or the key itself is invalid.
Inherited from
AsymmetricKeyBuilder
.buildGenerated
buildPrivateFromDer()
buildPrivateFromDer(
der
):Promise
<PrivateKey
>
Import a private key from a DER-encoded blob.
Parameters
der
ArrayBuffer
The DER-encoded private key in PKCS#8 format.
Returns
Promise
<PrivateKey
>
A promise that resolves to the imported private key.
Remarks
The imported key will inherit the properties (algorithm, purposes, exportability) set on this builder.
Throws
InvalidArgumentError If the provided key is invalid.
Inherited from
AsymmetricKeyBuilder
.buildPrivateFromDer
buildPublicFromDer()
buildPublicFromDer(
der
):Promise
<PublicKey
>
Import a public key from a DER-encoded blob.
Parameters
der
ArrayBuffer
The DER-encoded public key in SubjectPublicKeyInfo format.
Returns
Promise
<PublicKey
>
A promise that resolves to the imported public key.
Remarks
The imported key will inherit the properties (algorithm, purposes) set on this builder.
Throws
InvalidArgumentError If the provided key is invalid.
Inherited from
AsymmetricKeyBuilder
.buildPublicFromDer
Last updated: Sep 30, 2025