feat(ext/crypto): support AES-CTR encrypt/decrypt (#13177)

Fixes #13201.
This commit is contained in:
Sean Michael Wykes 2022-01-03 08:27:28 -03:00 committed by GitHub
parent a721c34c19
commit 9a42d65fc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 378 additions and 77 deletions

View file

@ -62,6 +62,11 @@ interface AesCbcParams extends Algorithm {
iv: BufferSource;
}
interface AesCtrParams extends Algorithm {
counter: BufferSource;
length: number;
}
interface HmacKeyGenParams extends Algorithm {
hash: HashAlgorithmIdentifier;
length?: number;
@ -239,12 +244,20 @@ interface SubtleCrypto {
data: BufferSource,
): Promise<ArrayBuffer>;
encrypt(
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCbcParams,
algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCbcParams
| AesCtrParams,
key: CryptoKey,
data: BufferSource,
): Promise<ArrayBuffer>;
decrypt(
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCbcParams,
algorithm:
| AlgorithmIdentifier
| RsaOaepParams
| AesCbcParams
| AesCtrParams,
key: CryptoKey,
data: BufferSource,
): Promise<ArrayBuffer>;