RsaOaepKeyBuilder
A builder class for creating RSA keys with OAEP (Optimal Asymmetric Encryption Padding). This class extends AsymmetricKeyBuilder to provide 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
bits
Set Signature
set bits(
bits
):void
Set the size of the RSA OAEP key in bits.
Parameters
bits
number
The size of the key in bits.
Returns
void
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