as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート
アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

DiffieHellmanKeyBuilder

A builder class for creating and managing Diffie-Hellman keys. This class extends AsymmetricKeyBuilder to provide Diffie-Hellman 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

AsymmetricAlgorithm

The asymmetric algorithm to use.

Returns

void

Inherited from

AsymmetricKeyBuilder.algorithm


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


generator

Set Signature

set generator(generator): void

Specify the Diffie-Hellman base.

Parameters
generator

number

The base.

Returns

void


modulus

Set Signature

set modulus(modulus): void

Specify the Diffie-Hellman modulus as a big-endian byte array compatible with OpenSSL's BN_bin2bn.

Parameters
modulus

ArrayBuffer

The modulus as a big-endian byte array.

Returns

void


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

KeyPurpose[]

An array of key purposes.

Returns

void

Inherited from

AsymmetricKeyBuilder.purposes

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


buildPublicFromBigInteger()

buildPublicFromBigInteger(bytes): Promise<PublicKey>

Build a Diffie-Hellman public key from a byte array containing a two's complement representation of the key in big-endian byte-order. This representation is fully compatible with the byte array representation of a Java BigInteger as described in the MSL documentation.

Parameters

bytes

ArrayBuffer

The byte array representing the public key.

Returns

Promise<PublicKey>

A promise that resolves to the constructed public key.


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: Oct 02, 2025