Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openpgpjs/openpgpjs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/mode/gcm.js')
-rw-r--r--src/crypto/mode/gcm.js16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/crypto/mode/gcm.js b/src/crypto/mode/gcm.js
index 1155cfe1..5751ad67 100644
--- a/src/crypto/mode/gcm.js
+++ b/src/crypto/mode/gcm.js
@@ -52,13 +52,7 @@ async function GCM(cipher, key) {
return {
encrypt: async function(pt, iv, adata = new Uint8Array()) {
- if (
- !pt.length ||
- // iOS does not support GCM-en/decrypting empty messages
- // Also, synchronous en/decryption might be faster in this case.
- (!adata.length && navigator.userAgent && navigator.userAgent.indexOf('Edge') !== -1)
- // Edge does not support GCM-en/decrypting without ADATA
- ) {
+ if (!pt.length) { // iOS does not support GCM-en/decrypting empty messages
return AES_GCM.encrypt(pt, key, iv, adata);
}
const ct = await webCrypto.encrypt({ name: ALGO, iv, additionalData: adata, tagLength: tagLength * 8 }, _key, pt);
@@ -66,13 +60,7 @@ async function GCM(cipher, key) {
},
decrypt: async function(ct, iv, adata = new Uint8Array()) {
- if (
- ct.length === tagLength ||
- // iOS does not support GCM-en/decrypting empty messages
- // Also, synchronous en/decryption might be faster in this case.
- (!adata.length && navigator.userAgent && navigator.userAgent.indexOf('Edge') !== -1)
- // Edge does not support GCM-en/decrypting without ADATA
- ) {
+ if (ct.length === tagLength) { // iOS does not support GCM-en/decrypting empty messages
return AES_GCM.decrypt(ct, key, iv, adata);
}
const pt = await webCrypto.decrypt({ name: ALGO, iv, additionalData: adata, tagLength: tagLength * 8 }, _key, ct);