summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs10
1 files changed, 9 insertions, 1 deletions
diff --git a/toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs b/toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs
index b1304bcdfc..9ef096df0f 100644
--- a/toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs
+++ b/toolkit/mozapps/extensions/internal/crypto-utils.sys.mjs
@@ -8,6 +8,14 @@ const CryptoHash = Components.Constructor(
"initWithString"
);
+const XPI_WEAK_SIGNATURES = [Ci.nsIAppSignatureInfo.PKCS7_WITH_SHA1];
+
+export function hasStrongSignature(addon) {
+ return !!addon.signedTypes?.filter(
+ algorithm => !XPI_WEAK_SIGNATURES.includes(algorithm)
+ ).length;
+}
+
export function computeHashAsString(hashType, input) {
const data = new Uint8Array(new TextEncoder().encode(input));
const crypto = CryptoHash(hashType);
@@ -42,7 +50,7 @@ export function computeSha1HashAsString(input) {
/**
* Returns the string representation (hex) of a given CryptoHashInstance.
*
- * @param {CryptoHash} aCrypto
+ * @param {nsICryptoHash} aCrypto
* @returns {string}
* The hex representation of a SHA256 hash.
*/