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
Skip to main content
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 Create a new instance of the Crypto class. Initializes a new Crypto object. This constructor doesn’t take any parameters as it sets up the internal state needed to perform cryptographic operations. Each instance provides access to the full range of cryptographic functionalities.

Returns

Crypto

Methods

getAsymmetricAlgorithmByName()

getAsymmetricAlgorithmByName(name): 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.

Returns

AsymmetricAlgorithm The requested asymmetric algorithm.

Throws

InvalidArgumentError If the algorithm name is invalid.

getDigestAlgorithmByName()

getDigestAlgorithmByName(name): 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.

Returns

DigestAlgorithm The requested digest algorithm.

Throws

InvalidArgumentError If the algorithm name is invalid.

getEccCurveByName()

getEccCurveByName(name): 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.

Returns

EccCurve The requested ECC curve.

Throws

InvalidArgumentError If the curve name is invalid.

getRandom()

getRandom(length): Promise<number[]> Generate random data.

Parameters

length
number The length in bytes of the random data to generate.

Returns

Promise<number[]> A promise resolving to an array of random bytes.

Throws

InvalidArgumentError If the length is invalid.

Throws

SecurityError If the random data generation fails.

getSupportedAsymmetricCipherAlgorithms()

getSupportedAsymmetricCipherAlgorithms(): AsymmetricAlgorithm[] Get supported asymmetric cipher algorithms. This function retrieves a list of all the supported asymmetric cipher algorithms.

Returns

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[] 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[] 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[] 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[] An array of the supported symmetric algorithms.

getSymmetricAlgorithmByName()

getSymmetricAlgorithmByName(name): 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.

Returns

SymmetricAlgorithm The requested symmetric algorithm.

Throws

InvalidArgumentError If the algorithm name is invalid.

getWrappingSchemeByName()

getWrappingSchemeByName(name): 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.

Returns

WrappingScheme The requested wrapping scheme.

Throws

InvalidArgumentError If the scheme name is invalid.

makeAsymmetricCipherContextBuilder()

makeAsymmetricCipherContextBuilder(algorithm): 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.

Returns

AsymmetricCipherContextBuilder A new builder for asymmetric cipher contexts.

Throws

InvalidArgumentError If the given algorithm is not supported.

makeAsymmetricKeyBuilder()

makeAsymmetricKeyBuilder(): AsymmetricKeyBuilder Create a builder for asymmetric keys. This function creates an object that can be used to build asymmetric keys.

Returns

AsymmetricKeyBuilder A new asymmetric key builder object.

makeCbcCipherContextBuilder()

makeCbcCipherContextBuilder(algorithm): 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.

Returns

CbcContextBuilder A new CBC cipher context builder.

Throws

InvalidArgumentError If the algorithm is invalid.

makeCtrCipherContextBuilder()

makeCtrCipherContextBuilder(algorithm): 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.

Returns

CtrContextBuilder A new CTR cipher context builder.

Throws

InvalidArgumentError If the algorithm is invalid.

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 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 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 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.

Returns

EcdhContextBuilder A new builder for ECDH key exchange contexts.

makeGcmCipherContextBuilder()

makeGcmCipherContextBuilder(algorithm): 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.

Returns

GcmContextBuilder A new GCM cipher context builder.

Throws

InvalidArgumentError If the algorithm is invalid.

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.

Returns

HkdfContextBuilder A new builder for HKDF key derivation contexts.

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 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.

Returns

Pbkdf2ContextBuilder A new builder for PBKDF2 key derivation contexts.

makeRsaKeyBuilder()

makeRsaKeyBuilder(): RsaKeyBuilder Create a builder for RSA keys. This function creates an object that can be used to build RSA keys.

Returns

RsaKeyBuilder A new RSA key builder object.

makeRsaOaepCipherContextBuilder()

makeRsaOaepCipherContextBuilder(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.

Returns

RsaOaepContextBuilder A new builder for RSA-OAEP cipher contexts.

Throws

InvalidArgumentError If the digest algorithm is invalid.

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 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 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 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 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 A new symmetric key builder object.

getMajorVersion()

static getMajorVersion(): number Retrieve the major version of the KeplerCrypto Turbo Module.

Returns

number The major version number.

getMinorVersion()

static getMinorVersion(): number Retrieve the minor version of the KeplerCrypto Turbo Module.

Returns

number The minor version number.

getPatchVersion()

static getPatchVersion(): number Retrieve the patch version of the KeplerCrypto Turbo Module.

Returns

number The patch version number.
Last modified on October 2, 2025