mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-06-21 13:46:38 +00:00
When decrypting a v6 PKESK in constant-time, use the v2 SEIPD algorithm
Rather than using the config to determine which algorithms to try to decrypt session keys for, try the algorithm we know the message was encrypted with.
This commit is contained in:
parent
7e382e6e43
commit
0e08abb3e2
@ -243,7 +243,11 @@ export class Message {
|
||||
// NB: as a result, if the data is encrypted with a non-suported cipher, decryption will always fail.
|
||||
|
||||
const serialisedPKESK = pkeskPacket.write(); // make copies to be able to decrypt the PKESK packet multiple times
|
||||
await Promise.all(Array.from(config.constantTimePKCS1DecryptionSupportedSymmetricAlgorithms).map(async sessionKeyAlgorithm => {
|
||||
await Promise.all((
|
||||
expectedSymmetricAlgorithm ?
|
||||
[expectedSymmetricAlgorithm] :
|
||||
Array.from(config.constantTimePKCS1DecryptionSupportedSymmetricAlgorithms)
|
||||
).map(async sessionKeyAlgorithm => {
|
||||
const pkeskPacketCopy = new PublicKeyEncryptedSessionKeyPacket();
|
||||
pkeskPacketCopy.read(serialisedPKESK);
|
||||
const randomSessionKey = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user