mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-11-25 06:55:50 +00:00
Throw on unexpected cleartext symmetric algo in PKESK v6 for x25519/x448
This commit is contained in:
parent
36635704e4
commit
da88cc22e8
@ -128,9 +128,12 @@ class PublicKeyEncryptedSessionKeyPacket {
|
|||||||
}
|
}
|
||||||
this.publicKeyAlgorithm = bytes[offset++];
|
this.publicKeyAlgorithm = bytes[offset++];
|
||||||
this.encrypted = crypto.parseEncSessionKeyParams(this.publicKeyAlgorithm, bytes.subarray(offset));
|
this.encrypted = crypto.parseEncSessionKeyParams(this.publicKeyAlgorithm, bytes.subarray(offset));
|
||||||
if (this.version === 3 && (
|
if (this.publicKeyAlgorithm === enums.publicKey.x25519 || this.publicKeyAlgorithm === enums.publicKey.x448) {
|
||||||
this.publicKeyAlgorithm === enums.publicKey.x25519 || this.publicKeyAlgorithm === enums.publicKey.x448)) {
|
if (this.version === 3) {
|
||||||
this.sessionKeyAlgorithm = enums.write(enums.symmetric, this.encrypted.C.algorithm);
|
this.sessionKeyAlgorithm = enums.write(enums.symmetric, this.encrypted.C.algorithm);
|
||||||
|
} else if (this.encrypted.C.algorithm !== null) {
|
||||||
|
throw new Error('Unexpected cleartext symmetric algorithm');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user