Interface StdSubtleCrypto
interface StdSubtleCrypto {
decrypt(algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
deriveBits(algorithm:
| AlgorithmIdentifier
| EcdhKeyDeriveParams
| HkdfParams
| Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
deriveKey(algorithm:
| AlgorithmIdentifier
| EcdhKeyDeriveParams
| HkdfParams
| Pbkdf2Params, baseKey: CryptoKey, derivedKeyType:
| AlgorithmIdentifier
| HkdfParams
| Pbkdf2Params
| AesDerivedKeyParams
| HmacImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
digest(algorithm: DigestAlgorithm, data: BufferSource | AsyncIterable<BufferSource, any, any> | Iterable<BufferSource, any, any>): Promise<ArrayBuffer>;
digestSync(algorithm: DigestAlgorithm, data: BufferSource | Iterable<BufferSource, any, any>): ArrayBuffer;
encrypt(algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: "pkcs8" | "raw" | "spki", key: CryptoKey): Promise<ArrayBuffer>;
exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: readonly ("sign" | "verify")[]): Promise<CryptoKeyPair>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair>;
generateKey(algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey | CryptoKeyPair>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
importKey(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, unwrappedKeyAlgorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams): Promise<ArrayBuffer>;
}
decrypt(algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
deriveBits(algorithm:
| AlgorithmIdentifier
| EcdhKeyDeriveParams
| HkdfParams
| Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
deriveKey(algorithm:
| AlgorithmIdentifier
| EcdhKeyDeriveParams
| HkdfParams
| Pbkdf2Params, baseKey: CryptoKey, derivedKeyType:
| AlgorithmIdentifier
| HkdfParams
| Pbkdf2Params
| AesDerivedKeyParams
| HmacImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
digest(algorithm: DigestAlgorithm, data: BufferSource | AsyncIterable<BufferSource, any, any> | Iterable<BufferSource, any, any>): Promise<ArrayBuffer>;
digestSync(algorithm: DigestAlgorithm, data: BufferSource | Iterable<BufferSource, any, any>): ArrayBuffer;
encrypt(algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: "pkcs8" | "raw" | "spki", key: CryptoKey): Promise<ArrayBuffer>;
exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: readonly ("sign" | "verify")[]): Promise<CryptoKeyPair>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair>;
generateKey(algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey | CryptoKeyPair>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey>;
importKey(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams, unwrappedKeyAlgorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams): Promise<ArrayBuffer>;
}
Hierarchy
- SubtleCrypto
- StdSubtleCrypto
Methods
decrypt
deriveBits
deriveKey
- derive
Key (algorithm, baseKey, derivedKeyType, extractable, keyUsages): Promise<CryptoKey> Parameters
- algorithm:
| AlgorithmIdentifier
| EcdhKeyDeriveParams
| HkdfParams
| Pbkdf2Params - baseKey: CryptoKey
- derivedKeyType:
| AlgorithmIdentifier
| HkdfParams
| Pbkdf2Params
| AesDerivedKeyParams
| HmacImportParams - extractable: boolean
- keyUsages: KeyUsage[]
Returns Promise<CryptoKey>
- algorithm:
digest
- digest(algorithm, data): Promise<ArrayBuffer>
Returns a new
Promiseobject that will digestdatausing the specifiedAlgorithmIdentifier.Parameters
- algorithm: DigestAlgorithm
- data: BufferSource | AsyncIterable<BufferSource, any, any> | Iterable<BufferSource, any, any>
Returns Promise<ArrayBuffer>
digestSync
- digest
Sync (algorithm, data): ArrayBuffer Returns a ArrayBuffer with the result of digesting
datausing the specifiedAlgorithmIdentifier.Parameters
- algorithm: DigestAlgorithm
- data: BufferSource | Iterable<BufferSource, any, any>
Returns ArrayBuffer
encrypt
exportKey
- export
Key (format, key): Promise<JsonWebKey> Parameters
- format: "jwk"
- key: CryptoKey
Returns Promise<JsonWebKey>
- export
Key (format, key): Promise<ArrayBuffer> Parameters
- format: "pkcs8" | "raw" | "spki"
- key: CryptoKey
Returns Promise<ArrayBuffer>
- export
Key (format, key): Promise<ArrayBuffer | JsonWebKey> Parameters
- format: KeyFormat
- key: CryptoKey
Returns Promise<ArrayBuffer | JsonWebKey>
generateKey
- generate
Key (algorithm, extractable, keyUsages): Promise<CryptoKeyPair> Parameters
- algorithm: "Ed25519"
- extractable: boolean
- keyUsages: readonly ("sign" | "verify")[]
Returns Promise<CryptoKeyPair>
- generate
Key (algorithm, extractable, keyUsages): Promise<CryptoKeyPair> Parameters
- algorithm: RsaHashedKeyGenParams | EcKeyGenParams
- extractable: boolean
- keyUsages: readonly KeyUsage[]
Returns Promise<CryptoKeyPair>
- generate
Key (algorithm, extractable, keyUsages): Promise<CryptoKey> Parameters
- algorithm: Pbkdf2Params | AesKeyGenParams | HmacKeyGenParams
- extractable: boolean
- keyUsages: readonly KeyUsage[]
Returns Promise<CryptoKey>
- generate
Key (algorithm, extractable, keyUsages): Promise<CryptoKey | CryptoKeyPair> Parameters
- algorithm: AlgorithmIdentifier
- extractable: boolean
- keyUsages: KeyUsage[]
Returns Promise<CryptoKey | CryptoKeyPair>
importKey
- import
Key (format, keyData, algorithm, extractable, keyUsages): Promise<CryptoKey> Parameters
- format: "jwk"
- keyData: JsonWebKey
- algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm - extractable: boolean
- keyUsages: readonly KeyUsage[]
Returns Promise<CryptoKey>
- import
Key (format, keyData, algorithm, extractable, keyUsages): Promise<CryptoKey> Parameters
- format: "pkcs8" | "raw" | "spki"
- keyData: BufferSource
- algorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm - extractable: boolean
- keyUsages: KeyUsage[]
Returns Promise<CryptoKey>
sign
unwrapKey
- unwrap
Key (format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages): Promise<CryptoKey> Parameters
- format: KeyFormat
- wrappedKey: BufferSource
- unwrappingKey: CryptoKey
- unwrapAlgorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCtrParams
| AesCbcParams
| AesGcmParams - unwrappedKeyAlgorithm:
| AlgorithmIdentifier
| HmacImportParams
| RsaHashedImportParams
| EcKeyImportParams
| AesKeyAlgorithm - extractable: boolean
- keyUsages: KeyUsage[]
Returns Promise<CryptoKey>
Extensions to the web standard
SubtleCryptointerface.