Skip to content

Commit 5e1882c

Browse files
authored
#6046 Update global OpenPGP.js config (#6047)
* refactor: update openpgp.js config * test: fix failing test * test: fix failing test * refactor: update rejectHashAlgorithms set
1 parent 85a7813 commit 5e1882c

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

extension/js/common/core/crypto/pgp/openpgp-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ export class OpenPGPKey {
529529
if (verifyErr instanceof Error && verifyErr.message === 'Can only verify message with one literal data packet.') {
530530
verifyRes.error = 'FlowCrypt is not equipped to verify this message';
531531
verifyRes.isErrFatal = true; // don't try to re-fetch the message from API
532-
} else if (verifyErr instanceof Error && verifyErr.message.startsWith('Insecure message hash algorithm:')) {
532+
} else if (verifyErr instanceof Error && verifyErr.message.startsWith('Insecure hash algorithm:')) {
533533
verifyRes.error = `${verifyErr.message}. Sender is using old, insecure OpenPGP software.`;
534534
verifyRes.isErrFatal = true; // don't try to re-fetch the message from API
535535
} else if (verifyErr instanceof Error && verifyErr.message === 'Signature is expired') {

extension/js/common/core/crypto/pgp/openpgpjs-custom.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ if (typeof opgp !== 'undefined') {
1313
opgp.config.showVersion = true;
1414
opgp.config.commentString = 'Seamlessly send and receive encrypted email';
1515
opgp.config.showComment = true;
16+
opgp.config.rejectHashAlgorithms = new Set([...opgp.config.rejectHashAlgorithms, opgp.enums.hash.sha1]);
1617
opgp.config.allowUnauthenticatedMessages = true; // we manually check for missing MDC and show loud warning to user (no auto-decrypt)
1718
opgp.config.allowInsecureDecryptionWithSigningKeys = false; // may get later over-written using ClientConfiguration for some clients
1819
// openpgp.config.require_uid_self_cert = false;

test/source/tests/decrypt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,7 @@ XZ8r4OC6sguP/yozWlkG+7dDxsgKQVBENeG6Lw==
21582158
{
21592159
content: ['test'],
21602160
encryption: 'not encrypted',
2161-
signature: 'error verifying signature: Insecure message hash algorithm: SHA1. Sender is using old, insecure OpenPGP software.',
2161+
signature: 'error verifying signature: Insecure hash algorithm: SHA1. Sender is using old, insecure OpenPGP software.',
21622162
},
21632163
authHdr
21642164
);

0 commit comments

Comments
 (0)