mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-03-30 15:08:32 +00:00
Only add SHA3 preferences to v6 keys
To ensure compatibility with older mobile clients, which may not support verifying SHA3 message signatures
This commit is contained in:
parent
55f8ab2629
commit
7cf978092b
@ -219,8 +219,7 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPackets, options, conf
|
||||
signatureProperties.preferredHashAlgorithms = createPreferredAlgos([
|
||||
enums.hash.sha512,
|
||||
enums.hash.sha256,
|
||||
enums.hash.sha3_512,
|
||||
enums.hash.sha3_256
|
||||
...(secretKeyPacket.version === 6 ? [enums.hash.sha3_512, enums.hash.sha3_256] : [])
|
||||
], config.preferredHashAlgorithm);
|
||||
signatureProperties.preferredCompressionAlgorithms = createPreferredAlgos([
|
||||
enums.compression.uncompressed,
|
||||
|
@ -2261,7 +2261,11 @@ function versionSpecificTests() {
|
||||
]);
|
||||
}
|
||||
const hash = openpgp.enums.hash;
|
||||
expect(selfSignature.preferredHashAlgorithms).to.eql([hash.sha512, hash.sha256, hash.sha3_512, hash.sha3_256]);
|
||||
expect(selfSignature.preferredHashAlgorithms).to.eql(
|
||||
openpgp.config.v6Keys ?
|
||||
[hash.sha512, hash.sha256, hash.sha3_512, hash.sha3_256] :
|
||||
[hash.sha512, hash.sha256]
|
||||
);
|
||||
const compr = openpgp.enums.compression;
|
||||
expect(selfSignature.preferredCompressionAlgorithms).to.eql([compr.uncompressed, compr.zlib, compr.zip]);
|
||||
|
||||
@ -2313,7 +2317,11 @@ function versionSpecificTests() {
|
||||
]);
|
||||
}
|
||||
const hash = openpgp.enums.hash;
|
||||
expect(selfSignature.preferredHashAlgorithms).to.eql([hash.sha224, hash.sha512, hash.sha256, hash.sha3_512, hash.sha3_256]);
|
||||
expect(selfSignature.preferredHashAlgorithms).to.eql(
|
||||
openpgp.config.v6Keys ?
|
||||
[hash.sha224, hash.sha512, hash.sha256, hash.sha3_512, hash.sha3_256] :
|
||||
[hash.sha224, hash.sha512, hash.sha256]
|
||||
);
|
||||
const compr = openpgp.enums.compression;
|
||||
expect(selfSignature.preferredCompressionAlgorithms).to.eql([compr.zlib, compr.uncompressed, compr.zip]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user