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:
authorDaniel Huigens <d.huigens@protonmail.com>2022-02-10 23:31:32 +0300
committerGitHub <noreply@github.com>2022-02-10 23:31:32 +0300
commitf54b13308549e6a2fec51dcbbe073b871c7c7e60 (patch)
tree2045ba4a975dbd56bae8546d2408a43714066c64
parent255926ab19ee8b53abda5a01269cf4b1349ece7b (diff)
Drop MS Edge Legacy support (#1474)
-rw-r--r--src/crypto/hash/index.js2
-rw-r--r--src/crypto/mode/eax.js3
-rw-r--r--src/crypto/mode/gcm.js16
-rw-r--r--src/crypto/public_key/rsa.js9
-rw-r--r--test/worker/application_worker.js3
5 files changed, 8 insertions, 25 deletions
diff --git a/src/crypto/hash/index.js b/src/crypto/hash/index.js
index 33cd4c08..27f42c6b 100644
--- a/src/crypto/hash/index.js
+++ b/src/crypto/hash/index.js
@@ -77,7 +77,7 @@ if (nodeCrypto) { // Use Node native crypto for all hash functions
} else { // Use JS fallbacks
hashFunctions = {
md5: md5,
- sha1: asmcryptoHash(Sha1, (!navigator.userAgent || navigator.userAgent.indexOf('Edge') === -1) && 'SHA-1'),
+ sha1: asmcryptoHash(Sha1, 'SHA-1'),
sha224: hashjsHash(sha224),
sha256: asmcryptoHash(Sha256, 'SHA-256'),
sha384: hashjsHash(sha384, 'SHA-384'),
diff --git a/src/crypto/mode/eax.js b/src/crypto/mode/eax.js
index 024ea6f7..2dfff46e 100644
--- a/src/crypto/mode/eax.js
+++ b/src/crypto/mode/eax.js
@@ -50,8 +50,7 @@ async function OMAC(key) {
async function CTR(key) {
if (
util.getWebCrypto() &&
- key.length !== 24 && // WebCrypto (no 192 bit support) see: https://www.chromium.org/blink/webcrypto#TOC-AES-support
- (!navigator.userAgent || navigator.userAgent.indexOf('Edge') === -1)
+ key.length !== 24 // WebCrypto (no 192 bit support) see: https://www.chromium.org/blink/webcrypto#TOC-AES-support
) {
key = await webCrypto.importKey('raw', key, { name: 'AES-CTR', length: key.length * 8 }, false, ['encrypt']);
return async function(pt, iv) {
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);
diff --git a/src/crypto/public_key/rsa.js b/src/crypto/public_key/rsa.js
index 4ad34d37..1c081316 100644
--- a/src/crypto/public_key/rsa.js
+++ b/src/crypto/public_key/rsa.js
@@ -317,7 +317,8 @@ async function webSign(hashName, data, n, e, d, p, q, u) {
* We swap them in privateToJWK, so it usually works out, but nevertheless,
* not all OpenPGP keys are compatible with this requirement.
* OpenPGP.js used to generate RSA keys the wrong way around (p > q), and still
- * does if the underlying Web Crypto does so (e.g. old MS Edge 50% of the time).
+ * does if the underlying Web Crypto does so (though the tested implementations
+ * don't do so).
*/
const jwk = await privateToJWK(n, e, d, p, q, u);
const algo = {
@@ -325,8 +326,7 @@ async function webSign(hashName, data, n, e, d, p, q, u) {
hash: { name: hashName }
};
const key = await webCrypto.importKey('jwk', jwk, algo, false, ['sign']);
- // add hash field for ms edge support
- return new Uint8Array(await webCrypto.sign({ 'name': 'RSASSA-PKCS1-v1_5', 'hash': hashName }, key, data));
+ return new Uint8Array(await webCrypto.sign('RSASSA-PKCS1-v1_5', key, data));
}
async function nodeSign(hashAlgo, data, n, e, d, p, q, u) {
@@ -381,8 +381,7 @@ async function webVerify(hashName, data, s, n, e) {
name: 'RSASSA-PKCS1-v1_5',
hash: { name: hashName }
}, false, ['verify']);
- // add hash field for ms edge support
- return webCrypto.verify({ 'name': 'RSASSA-PKCS1-v1_5', 'hash': hashName }, key, s, data);
+ return webCrypto.verify('RSASSA-PKCS1-v1_5', key, s, data);
}
async function nodeVerify(hashAlgo, data, s, n, e) {
diff --git a/test/worker/application_worker.js b/test/worker/application_worker.js
index e34188b2..b5d69678 100644
--- a/test/worker/application_worker.js
+++ b/test/worker/application_worker.js
@@ -12,9 +12,6 @@ module.exports = () => tryTests('Application Worker', tests, {
function tests() {
it('Should support loading OpenPGP.js from inside a Web Worker', async function() {
- if (navigator.userAgent && /Edge/.test(navigator.userAgent)) {
- this.skip(); // Old Edge doesn't support crypto.getRandomValues inside a Worker.
- }
try {
globalThis.eval('(async function() {})');
} catch (e) {