This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). Available only in secure contexts.
class
SubtleCrypto
class SubtleCrypto
A message recipient uses their asymmetric private key to decrypt an "encapsulated key" (ciphertext), thereby recovering a temporary symmetric key (represented as
ArrayBuffer) which is then used to decrypt a message.The algorithms currently supported include:
'ML-KEM-512''ML-KEM-768''ML-KEM-1024'
@returnsFulfills with
ArrayBufferupon success.- sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,extractable: boolean,
A message recipient uses their asymmetric private key to decrypt an "encapsulated key" (ciphertext), thereby recovering a temporary symmetric key (represented as
CryptoKey) which is then used to decrypt a message.The algorithms currently supported include:
'ML-KEM-512''ML-KEM-768''ML-KEM-1024'
@param usagesSee Key usages.
@returnsFulfills with
CryptoKeyupon success. - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,data: BufferSource
- algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,length?: null | number
- algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams,extractable: boolean,keyUsages: KeyUsage[]algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,derivedKeyType: AlgorithmIdentifier | HkdfParams | Pbkdf2Params | AesDerivedKeyParams | HmacImportParams,extractable: boolean,keyUsages: Iterable<KeyUsage>
Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. This encrypted key is the "encapsulated key" represented as
EncapsulatedBits.The algorithms currently supported include:
'ML-KEM-512''ML-KEM-768''ML-KEM-1024'
@returnsFulfills with
EncapsulatedBitsupon success.- sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,extractable: boolean,
Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key. This encrypted key is the "encapsulated key" represented as
EncapsulatedKey.The algorithms currently supported include:
'ML-KEM-512''ML-KEM-768''ML-KEM-1024'
@param usagesSee Key usages.
@returnsFulfills with
EncapsulatedKeyupon success. - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,data: BufferSource
- algorithm: 'Ed25519' | { name: 'Ed25519' },extractable: boolean,keyUsages: readonly 'sign' | 'verify'[]algorithm: RsaHashedKeyGenParams | EcKeyGenParams,extractable: boolean,keyUsages: readonly KeyUsage[]algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams,extractable: boolean,keyUsages: readonly KeyUsage[]algorithm: AlgorithmIdentifier,extractable: boolean,keyUsages: KeyUsage[]algorithm: AlgorithmIdentifier,extractable: boolean,keyUsages: Iterable<KeyUsage>
Derives the public key from a given private key.
@param keyA private key from which to derive the corresponding public key.
@param keyUsagesSee Key usages.
@returnsFulfills with a
CryptoKeyupon success.- format: 'jwk',keyData: JsonWebKey,algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: readonly KeyUsage[]
- format: KeyFormat,wrappedKey: BufferSource,unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: KeyUsage[]format: KeyFormat,wrappedKey: BufferSource,unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm,extractable: boolean,keyUsages: Iterable<KeyUsage>
- algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams,signature: BufferSource,data: BufferSource): Promise<boolean>;
- format: KeyFormat,wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams