From f90c53ae6530fffe1aa8d2b5f87af24f2df351ec Mon Sep 17 00:00:00 2001 From: larabr <7375870+larabr@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:25:45 +0200 Subject: [PATCH] Minor: fix packet validity check for new curve25519 keys without key flags The code used to wrongly consider e.g. x25519 keys without key flags as valid signing keys. Keys without key flags are very rare nowadays, so this fix has low impact. --- src/key/helper.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/key/helper.js b/src/key/helper.js index 04afc156..bb89a537 100644 --- a/src/key/helper.js +++ b/src/key/helper.js @@ -367,6 +367,7 @@ export function isValidSigningKeyPacket(keyPacket, signature) { return keyAlgo !== enums.publicKey.rsaEncrypt && keyAlgo !== enums.publicKey.elgamal && keyAlgo !== enums.publicKey.ecdh && + keyAlgo !== enums.publicKey.x25519 && (!signature.keyFlags || (signature.keyFlags[0] & enums.keyFlags.signData) !== 0); } @@ -377,6 +378,7 @@ export function isValidEncryptionKeyPacket(keyPacket, signature) { keyAlgo !== enums.publicKey.rsaSign && keyAlgo !== enums.publicKey.ecdsa && keyAlgo !== enums.publicKey.eddsa && + keyAlgo !== enums.publicKey.ed25519 && (!signature.keyFlags || (signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 || (signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0);