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

Crypto

Provides a comprehensive interface for cryptographic operations. This class serves as a central point for accessing various cryptographic functionalities including algorithm retrieval, key generation, and cipher operations.

Constructors

new Crypto()

new Crypto(): Crypto

Returns

Crypto

Methods

getAsymmetricAlgorithmByName()

getAsymmetricAlgorithmByName(name: string): AsymmetricAlgorithm

Get an asymmetric algorithm by name.

This function retrieves an asymmetric algorithm by its name.

Parameters

name

string

The name of the asymmetric algorithm.

Throws

  • If the algorithm name is invalid.

Returns

AsymmetricAlgorithm

AsymmetricAlgorithm The requested asymmetric algorithm.


getDigestAlgorithmByName()

getDigestAlgorithmByName(name: string): DigestAlgorithm

Get a digest algorithm by name.

This function retrieves a digest algorithm based on its name. If the algorithm with the given name is supported, it returns the requested algorithm.

Parameters

name

string

The name of the algorithm.

Throws

  • If the algorithm name is invalid.

Returns

DigestAlgorithm

DigestAlgorithm The requested digest algorithm.


getEccCurveByName()

getEccCurveByName(name: string): EccCurve

Get an elliptic-curve cryptography (ECC) curve by name.

This function retrieves an elliptic-curve cryptography curve by its name.

Parameters

name

string

The name of the ECC curve.

Throws

  • If the curve name is invalid.

Returns

EccCurve

EccCurve The requested ECC curve.


getMajorVersion()

static getMajorVersion(): number

Retrieve the major version of the KeplerCrypto Turbo Module.

Returns

number

number The major version number.


getMinorVersion()

static getMinorVersion(): number

Retrieve the minor version of the KeplerCrypto Turbo Module.

Returns

number

number The minor version number.


getPatchVersion()

static getPatchVersion(): number

Retrieve the patch version of the KeplerCrypto Turbo Module.

Returns

number

number The patch version number.


getRandom()

getRandom(length: number): Promise<number[]>

Generate random data.

Parameters

length

number

The length in bytes of the random data to generate.

Throws

  • If the length is invalid.
  • If the random data generation fails.

Returns

Promise<number[]>

Promisenumber[] A promise resolving to an array of random bytes.


getSupportedAsymmetricCipherAlgorithms()

getSupportedAsymmetricCipherAlgorithms(): AsymmetricAlgorithm[]

Get supported asymmetric cipher algorithms.

This function retrieves a list of all the supported asymmetric cipher algorithms.

Returns

AsymmetricAlgorithm[]

AsymmetricAlgorithm[] An array of the supported asymmetric cipher algorithms.


getSupportedDigestAlgorithms()

getSupportedDigestAlgorithms(): DigestAlgorithm[]

List all the supported digest algorithms.

This function returns an array of the supported digest algorithms. Users can iterate over this array to obtain information about each supported digest algorithm.

Returns

DigestAlgorithm[]

DigestAlgorithm[] An array of the supported digest algorithms.


getSupportedEccCurves()

getSupportedEccCurves(): EccCurve[]

List the supported elliptic-curve cryptography (ECC) curves.

This function returns an array of all the supported elliptic-curve cryptography curves.

Returns

EccCurve[]

EccCurve[] An array of the supported ECC curves.


getSupportedSignatureAlgorithms()

getSupportedSignatureAlgorithms(): AsymmetricAlgorithm[]

List the supported signature algorithms.

This function returns an array of all the supported signature algorithms.

Returns

AsymmetricAlgorithm[]

AsymmetricAlgorithm[] An array of the supported signature algorithms.


getSupportedSymmetricAlgorithms()

getSupportedSymmetricAlgorithms(): SymmetricAlgorithm[]

List all the supported symmetric algorithms.

This function provides a list of all the symmetric algorithms that are available in the system. The caller can use this list to determine which symmetric algorithms are supported.

Returns

SymmetricAlgorithm[]

SymmetricAlgorithm[] An array of the supported symmetric algorithms.


getSymmetricAlgorithmByName()

getSymmetricAlgorithmByName(name: string): SymmetricAlgorithm

Get a symmetric algorithm by name.

This function retrieves a symmetric algorithm based on its name. The name parameter specifies the name of the algorithm to retrieve.

Parameters

name

string

The name of the symmetric algorithm to retrieve.

Throws

  • If the algorithm name is invalid.

Returns

SymmetricAlgorithm

SymmetricAlgorithm The requested symmetric algorithm.


getWrappingSchemeByName()

getWrappingSchemeByName(name: string): WrappingScheme

Get a wrapping scheme by name.

This function retrieves a wrapping scheme by its name.

Parameters

name

string

The name of the wrapping scheme.

Throws

  • If the scheme name is invalid.

Returns

WrappingScheme

WrappingScheme The requested wrapping scheme.


makeAsymmetricCipherContextBuilder()

makeAsymmetricCipherContextBuilder(algorithm: AsymmetricAlgorithm): AsymmetricCipherContextBuilder

Create a builder for asymmetric cipher contexts.

This function creates an object that can be used to build cipher contexts using asymmetric cryptography.

Parameters

algorithm

AsymmetricAlgorithm

The asymmetric algorithm to be used.

Throws

  • If the given algorithm is not supported.

Returns

AsymmetricCipherContextBuilder

AsymmetricCipherContextBuilder A new builder for asymmetric cipher contexts.


makeAsymmetricKeyBuilder()

makeAsymmetricKeyBuilder(): AsymmetricKeyBuilder

Create a builder for asymmetric keys.

This function creates an object that can be used to build asymmetric keys.

Returns

AsymmetricKeyBuilder

AsymmetricKeyBuilder A new asymmetric key builder object.


makeCbcCipherContextBuilder()

makeCbcCipherContextBuilder(algorithm: SymmetricAlgorithm): CbcContextBuilder

Create a builder for cipher contexts in CBC mode.

This function creates an object that can be used to build a cipher context in CBC mode.

Parameters

algorithm

SymmetricAlgorithm

The symmetric algorithm to use.

Throws

  • If the algorithm is invalid.

Returns

CbcContextBuilder

CbcContextBuilder A new CBC cipher context builder.


makeCtrCipherContextBuilder()

makeCtrCipherContextBuilder(algorithm: SymmetricAlgorithm): CtrContextBuilder

Create a builder for a cipher context in CTR (Counter) mode.

This function creates an object that can be used to build a cipher context in CTR mode.

Parameters

algorithm

SymmetricAlgorithm

The symmetric algorithm to use.

Throws

  • If the algorithm is invalid.

Returns

CtrContextBuilder

CtrContextBuilder A new CTR cipher context builder.


makeDiffieHellmanKeyBuilder()

makeDiffieHellmanKeyBuilder(): DiffieHellmanKeyBuilder

Create a builder for Diffie-Hellman keys.

This function creates an object that can be used to build Diffie-Hellman keys.

Returns

DiffieHellmanKeyBuilder

DiffieHellmanKeyBuilder A new Diffie-Hellman key builder object.


makeDigestContextBuilder()

makeDigestContextBuilder(): DigestContextBuilder

Create a builder for digest (hash) contexts.

This function creates an object that can be used to build digest contexts

Returns

DigestContextBuilder

DigestContextBuilder A new builder for digest contexts.


makeEccKeyBuilder()

makeEccKeyBuilder(): EccKeyBuilder

Create a builder for elliptic-curve cryptography (ECC) keys.

This function creates an object that can be used to build ECC keys.

Returns

EccKeyBuilder

EccKeyBuilder A new ECC key builder object.


makeEcdhContextBuilder()

makeEcdhContextBuilder(): EcdhContextBuilder

Create a builder for ECDH key exchange contexts.

This function creates an object that can be used to build ECDH key exchange contexts.

EcdhContextBuilder A new builder for ECDH key exchange contexts.

Returns

EcdhContextBuilder


makeGcmCipherContextBuilder()

makeGcmCipherContextBuilder(algorithm: SymmetricAlgorithm): GcmContextBuilder

Create a builder for cipher contexts in GCM mode.

This function creates an object that can be used to build a cipher context in GCM mode.

Parameters

algorithm

SymmetricAlgorithm

The symmetric algorithm to use.

Throws

  • If the algorithm is invalid.

Returns

GcmContextBuilder

GcmContextBuilder A new GCM cipher context builder.


makeHkdfContextBuilder()

makeHkdfContextBuilder(): HkdfContextBuilder

Create a builder for HKDF key derivation contexts.

This function creates an object that can be used to build HKDF key derivation contexts.

HkdfContextBuilder A new builder for HKDF key derivation contexts.

Returns

HkdfContextBuilder


makeHmacContextBuilder()

makeHmacContextBuilder(): HmacContextBuilder

Create a builder for HMAC (Hash-based Message Authentication Code) contexts.

This function creates an object that can be used to build HMAC contexts.

Returns

HmacContextBuilder

HmacContextBuilder A new builder for HMAC contexts.


makePbkdf2ContextBuilder()

makePbkdf2ContextBuilder(): Pbkdf2ContextBuilder

Create a builder for PBKDF2 key derivation contexts.

This function creates an object that can be used to build PBKDF2 key derivation contexts.

Pbkdf2ContextBuilder A new builder for PBKDF2 key derivation contexts.

Returns

Pbkdf2ContextBuilder


makeRsaKeyBuilder()

makeRsaKeyBuilder(): RsaKeyBuilder

Create a builder for RSA keys.

This function creates an object that can be used to build RSA keys.

Returns

RsaKeyBuilder

RsaKeyBuilder A new RSA key builder object.


makeRsaOaepCipherContextBuilder()

makeRsaOaepCipherContextBuilder(digestAlgorithm: DigestAlgorithm): RsaOaepContextBuilder

Create a builder for RSA-OAEP cipher contexts.

This function creates an object that can be used to build RSA-OAEP cipher contexts for asymmetric cryptography.

Parameters

digestAlgorithm

DigestAlgorithm

The digest algorithm to be used.

Throws

  • If the digest algorithm is invalid.

Returns

RsaOaepContextBuilder

RsaOaepContextBuilder A new builder for RSA-OAEP cipher contexts.


makeRsaOaepKeyBuilder()

makeRsaOaepKeyBuilder(): RsaOaepKeyBuilder

Creates a builder for RSA-OAEP keys.

This function creates an object that can be used to build RSA-OAEP keys.

Returns

RsaOaepKeyBuilder

RsaOaepKeyBuilder A new RSA-OAEP key builder object.


makeRsassaPkcs1ContextBuilder()

makeRsassaPkcs1ContextBuilder(): RsassaPkcs1ContextBuilder

Create a builder for an RSASSA-PKCS1-v1_5 signature context.

This function creates an object that can be used to build an RSASSA-PKCS1-v1_5 signature context.

Returns

RsassaPkcs1ContextBuilder

RsassaPkcs1ContextBuilder A new builder for RSASSA-PKCS1-v1_5 signature contexts.


makeRsassaPssContextBuilder()

makeRsassaPssContextBuilder(): RsassaPssContextBuilder

Create a builder for an RSASSA-PSS signature context.

This function creates an object that can be used to build an RSASSA-PSS signature context.

Returns

RsassaPssContextBuilder

RsassaPssContextBuilder A new builder for RSASSA-PSS signature contexts.


makeSignatureContextBuilder()

makeSignatureContextBuilder(): SignatureContextBuilder

Create a builder for a signature context.

This function creates an object that can be used to build a signature context.

Returns

SignatureContextBuilder

SignatureContextBuilder A new signature context builder.


makeSymmetricKeyBuilder()

makeSymmetricKeyBuilder(): SymmetricKeyBuilder

Create a builder for symmetric keys.

This function creates an object that can be used to build symmetric keys.

Returns

SymmetricKeyBuilder

SymmetricKeyBuilder A new symmetric key builder object.


Last updated: Jul 22, 2026