as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

PrivateKey

Represents a private key used in asymmetric cryptography. Private keys are typically generated using an AsymmetricKeyBuilder or any of the subclasses inheriting from it. This class also provides methods to export and check the properties of private keys.

See

Extends

  • BaseCryptoClass

Accessors

exportable

Get Signature

get exportable(): boolean

Check whether the private key is exportable.

Returns

boolean

True if the key is exportable, false otherwise.


purposes

Get Signature

get purposes(): KeyPurpose[]

Get the purposes enabled for this private key.

Returns

KeyPurpose[]

An array with the purposes enabled for this key.

Methods

exportDer()

exportDer(): Promise<ArrayBuffer>

Export the private key as a DER-encoded blob.

Returns

Promise<ArrayBuffer>

A promise that resolves to an ArrayBuffer containing the DER-encoded key.

Remarks

Private keys are exported in PKCS#8 format.


getPublicKey()

getPublicKey(): PublicKey

Derive the corresponding public key from this private key.

Returns

PublicKey

The derived public key.

Throws

InvalidArgumentError If the contents of the private key are invalid.


hasPurpose()

hasPurpose(purpose): boolean

Check if a specific purpose is enabled for this private key.

Parameters

purpose

KeyPurpose

The key purpose to check.

Returns

boolean

True if the specified purpose is enabled, false otherwise.

Throws

InvalidArgumentError If the argument is not a valid purpose.


Last updated: Oct 02, 2025