as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

PublicKey

Represents a public key used in asymmetric cryptography. Public keys are typically generated using the PrivateKey.getPublicKey or AsymmetricKeyBuilder.buildPublicFromDer methods. This class also provides methods to export and check the properties of public keys.

See

Extends

  • BaseCryptoClass

Accessors

exportable

Get Signature

get exportable(): boolean

Check whether the 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 public key.

Returns

KeyPurpose[]

An array with the purposes enabled for this key.

Methods

exportDer()

exportDer(): Promise<ArrayBuffer>

Export the public key as a DER-encoded blob.

Returns

Promise<ArrayBuffer>

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

Remarks

The public key is exported in SubjectPublicKeyInfo format as described in RFC 5280, Section 4.1.

Throws

AccessDeniedError If the key is not exportable.


hasPurpose()

hasPurpose(purpose): boolean

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

Parameters

purpose

KeyPurpose

The 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: Sep 30, 2025