Constructors
new Crypto()
new Crypto(): Crypto
Returns
CryptoMethods
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
InvalidArgumentErrorIf the algorithm name is invalid.
Returns
AsymmetricAlgorithmAsymmetricAlgorithm 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
InvalidArgumentErrorIf the algorithm name is invalid.
Returns
DigestAlgorithmDigestAlgorithm 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
InvalidArgumentErrorIf the curve name is invalid.
Returns
EccCurveEccCurve The requested ECC curve.
getMajorVersion()
Retrieve the major version of the KeplerCrypto Turbo Module.staticgetMajorVersion():number
Returns
number
number The major version number.
getMinorVersion()
Retrieve the minor version of the KeplerCrypto Turbo Module.staticgetMinorVersion():number
Returns
number
number The minor version number.
getPatchVersion()
Retrieve the patch version of the KeplerCrypto Turbo Module.staticgetPatchVersion():number
Returns
number
number The patch version number.
getRandom()
getRandom(length:Generate random data.number):Promise<number[]>
Parameters
length
number
The length in bytes of the random data to generate.
Throws
InvalidArgumentErrorIf the length is invalid.SecurityErrorIf the random data generation fails.
Returns
Promise<number[]>
Promise<number[]> 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
InvalidArgumentErrorIf the algorithm name is invalid.
Returns
SymmetricAlgorithmSymmetricAlgorithm 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
InvalidArgumentErrorIf the scheme name is invalid.
Returns
WrappingSchemeWrappingScheme The requested wrapping scheme.
makeAsymmetricCipherContextBuilder()
makeAsymmetricCipherContextBuilder(algorithm: AsymmetricAlgorithm): AsymmetricCipherContextBuilderCreate 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
InvalidArgumentErrorIf the given algorithm is not supported.
Returns
AsymmetricCipherContextBuilderAsymmetricCipherContextBuilder A new builder for asymmetric
cipher contexts.
makeAsymmetricKeyBuilder()
makeAsymmetricKeyBuilder(): AsymmetricKeyBuilderCreate a builder for asymmetric keys. This function creates an object that can be used to build asymmetric keys.
Returns
AsymmetricKeyBuilderAsymmetricKeyBuilder A new asymmetric key builder object.
makeCbcCipherContextBuilder()
makeCbcCipherContextBuilder(algorithm: SymmetricAlgorithm): CbcContextBuilderCreate 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
InvalidArgumentErrorIf the algorithm is invalid.
Returns
CbcContextBuilderCbcContextBuilder A new CBC cipher context builder.
makeCtrCipherContextBuilder()
makeCtrCipherContextBuilder(algorithm: SymmetricAlgorithm): CtrContextBuilderCreate 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
InvalidArgumentErrorIf the algorithm is invalid.
Returns
CtrContextBuilderCtrContextBuilder 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(): DigestContextBuilderCreate a builder for digest (hash) contexts. This function creates an object that can be used to build digest contexts
Returns
DigestContextBuilderDigestContextBuilder 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(): EcdhContextBuilderCreate 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
EcdhContextBuildermakeGcmCipherContextBuilder()
makeGcmCipherContextBuilder(algorithm: SymmetricAlgorithm): GcmContextBuilderCreate 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
InvalidArgumentErrorIf the algorithm is invalid.
Returns
GcmContextBuilderGcmContextBuilder A new GCM cipher context builder.
makeHkdfContextBuilder()
makeHkdfContextBuilder(): HkdfContextBuilderCreate 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
HkdfContextBuildermakeHmacContextBuilder()
makeHmacContextBuilder(): HmacContextBuilderCreate a builder for HMAC (Hash-based Message Authentication Code) contexts. This function creates an object that can be used to build HMAC contexts.
Returns
HmacContextBuilderHmacContextBuilder A new builder for HMAC contexts.
makePbkdf2ContextBuilder()
makePbkdf2ContextBuilder(): Pbkdf2ContextBuilderCreate 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
Pbkdf2ContextBuildermakeRsaKeyBuilder()
makeRsaKeyBuilder(): RsaKeyBuilderCreate a builder for RSA keys. This function creates an object that can be used to build RSA keys.
Returns
RsaKeyBuilderRsaKeyBuilder A new RSA key builder object.
makeRsaOaepCipherContextBuilder()
makeRsaOaepCipherContextBuilder(digestAlgorithm: DigestAlgorithm): RsaOaepContextBuilderCreate 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
InvalidArgumentErrorIf the digest algorithm is invalid.
Returns
RsaOaepContextBuilderRsaOaepContextBuilder A new builder for RSA-OAEP cipher
contexts.
makeRsaOaepKeyBuilder()
makeRsaOaepKeyBuilder(): RsaOaepKeyBuilderCreates a builder for RSA-OAEP keys. This function creates an object that can be used to build RSA-OAEP keys.
Returns
RsaOaepKeyBuilderRsaOaepKeyBuilder A new RSA-OAEP key builder object.
makeRsassaPkcs1ContextBuilder()
makeRsassaPkcs1ContextBuilder(): RsassaPkcs1ContextBuilderCreate 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
RsassaPkcs1ContextBuilderRsassaPkcs1ContextBuilder A new builder for RSASSA-PKCS1-v1_5
signature contexts.
makeRsassaPssContextBuilder()
makeRsassaPssContextBuilder(): RsassaPssContextBuilderCreate 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
RsassaPssContextBuilderRsassaPssContextBuilder A new builder for RSASSA-PSS signature
contexts.
makeSignatureContextBuilder()
makeSignatureContextBuilder(): SignatureContextBuilderCreate a builder for a signature context. This function creates an object that can be used to build a signature context.
Returns
SignatureContextBuilderSignatureContextBuilder A new signature context builder.
makeSymmetricKeyBuilder()
makeSymmetricKeyBuilder(): SymmetricKeyBuilderCreate a builder for symmetric keys. This function creates an object that can be used to build symmetric keys.
Returns
SymmetricKeyBuilderSymmetricKeyBuilder A new symmetric key builder object.
