Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content
A builder class for creating and importing asymmetric keys. This class provides methods to configure key properties and generate or import both public and private keys.

Extends

  • BaseCryptoClass

Extended by

Constructors

new AsymmetricKeyBuilder()

new AsymmetricKeyBuilder(): AsymmetricKeyBuilder

Returns

AsymmetricKeyBuilder

Methods

buildGenerated()

buildGenerated(): Promise<PrivateKey>
Build a new private key based on the configured properties.

Throws

  • InvalidArgumentError If the chosen key size or the key itself is invalid.

Returns

Promise<PrivateKey> Promise<PrivateKey> A promise that resolves to the generated private key.

buildPrivateFromDer()

buildPrivateFromDer(der: ArrayBuffer): Promise<PrivateKey>
Import a private key from a DER-encoded blob. The imported key will inherit the properties (algorithm, purposes, exportability) set on this builder.

Parameters

der
ArrayBuffer The DER-encoded private key in PKCS#8 format.

Throws

  • InvalidArgumentError If the provided key is invalid.

Returns

Promise<PrivateKey> Promise<PrivateKey> A promise that resolves to the imported private key.

buildPublicFromDer()

buildPublicFromDer(der: ArrayBuffer): Promise<PublicKey>
Import a public key from a DER-encoded blob. The imported key will inherit the properties (algorithm, purposes) set on this builder.

Parameters

der
ArrayBuffer The DER-encoded public key in SubjectPublicKeyInfo format.

Throws

  • InvalidArgumentError If the provided key is invalid.

Returns

Promise<PublicKey> Promise<PublicKey> A promise that resolves to the imported public key.
Last modified on August 25, 2026