summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-03-02 10:56:10 +0530
committerGitHub <noreply@github.com>2022-03-02 10:56:10 +0530
commit8b2989c417db9090913f1cb6074ae961f4c14d5e (patch)
treedcd51d530a2e425f3146ed710d1afea8ebc0c10d /ext/crypto/00_crypto.js
parentb751e97a014f486375c9b8c99446de237c7dbede (diff)
feat(ext/crypto): AES-GCM support for 128bit IVs (#13805)
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 8203a5307..ed179a313 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -664,8 +664,13 @@
);
}
- // 3. We only support 96-bit nonce for now.
- if (normalizedAlgorithm.iv.byteLength !== 12) {
+ // 3. We only support 96-bit and 128-bit nonce.
+ if (
+ ArrayPrototypeIncludes(
+ [12, 16],
+ normalizedAlgorithm.iv.byteLength,
+ ) === undefined
+ ) {
throw new DOMException(
"Initialization vector length not supported",
"NotSupportedError",
@@ -3782,8 +3787,13 @@
}
// 2.
- // We only support 96-bit nonce for now.
- if (normalizedAlgorithm.iv.byteLength !== 12) {
+ // We only support 96-bit and 128-bit nonce.
+ if (
+ ArrayPrototypeIncludes(
+ [12, 16],
+ normalizedAlgorithm.iv.byteLength,
+ ) === undefined
+ ) {
throw new DOMException(
"Initialization vector length not supported",
"NotSupportedError",