Skip to content

Fixing an issue where a secret subkey wasn't being used to decrypt#188

Open
fbernardo wants to merge 1 commit into
krzyzanowskim:mainfrom
fbernardo:bugfix/fbernardo/secret_sub_key
Open

Fixing an issue where a secret subkey wasn't being used to decrypt#188
fbernardo wants to merge 1 commit into
krzyzanowskim:mainfrom
fbernardo:bugfix/fbernardo/secret_sub_key

Conversation

@fbernardo

Copy link
Copy Markdown
Contributor

In the case where a secret key was used only to sign and a secret subkey was then used to encrypt only, this function wasn't finding any keys to encrypt.

Similarly to how it is assumed on line 322, I changed the code to assume a secret subkey is always capable.

Checklist:

  • I accept the CONTRIBUTING.md terms.
  • Correct file headers (see CONTRIBUTING.md).
  • Tests.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is correct.
This makes always use the first subkey. What if there's multiple subkeys, ale there's one that is valid, and it's not the first from the list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants