From d5b33b4cacbe55e39796640fae92b77b5846af6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fa=CC=81bio=20Bernardo?= Date: Wed, 21 Apr 2021 12:56:23 +0100 Subject: [PATCH] Fixing an issue where a secret subkey wasn't being used to decrypt. --- ObjectivePGP/PGPPartialKey.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ObjectivePGP/PGPPartialKey.m b/ObjectivePGP/PGPPartialKey.m index 57c8ab34..9801fe96 100644 --- a/ObjectivePGP/PGPPartialKey.m +++ b/ObjectivePGP/PGPPartialKey.m @@ -312,8 +312,8 @@ - (nullable PGPSecretKeyPacket *)decryptionPacketForKeyID:(PGPKeyID *)keyID erro } for (PGPPartialSubKey *subKey in self.subKeys) { - let signaturePacket = subKey.bindingSignature; - if (signaturePacket.canBeUsedToEncrypt && PGPEqualObjects(PGPCast(subKey.primaryKeyPacket, PGPSecretKeyPacket).keyID, keyID)) { + //Assume the primary key packet is always capable if if its a secret key packet + if (PGPEqualObjects(PGPCast(subKey.primaryKeyPacket, PGPSecretKeyPacket).keyID, keyID)) { return PGPCast(subKey.primaryKeyPacket, PGPSecretKeyPacket); } }