Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework to support usage of encryption subkeys #247

Conversation

Liam-Rougoor
Copy link
Contributor

#238 (partly)

So, I've changed how public keys are managed in EncryptionKeys and how they are used in Encryption and some Verification in PGP.

Summary of the main changes in this PR:

  • Every public key ring is now stored as a collection of a new wrapper class - PgpPublicKeyRingWithPreferredKey (I'm still open for better name suggestions). This class stores the public key ring, the default key (using the already existing algorithm to find the 'best' key) and a preferred key, which can be set by the user using EncryptionKeys.UseEncryptionKey(_some_keyId_)
  • In the encryption methods, for every known public key ring (a.k.a. recipient), PGP uses the preferred key if it's set, otherwise the default key.
  • When verifying encrypted data, it will look for a matching key in any of the known keys in the key rings.

I think more improvements can be made regarding the handling of public keys, but I think this PR could give an indication of a possible direction.

@mattosaurus
Copy link
Owner

This is looking good. Do we also want to extend it to setting the preferred signing and verification keys?

@Liam-Rougoor
Copy link
Contributor Author

Liam-Rougoor commented Oct 17, 2023

This is looking good. Do we also want to extend it to setting the preferred signing and verification keys?

That sounds like a good idea. Perhaps something we could implement in a separate PR?

@Liam-Rougoor Liam-Rougoor changed the title Rework to support usage of subkeys Rework to support usage of encryption subkeys Oct 17, 2023
@mattosaurus
Copy link
Owner

Sure, happy for this to be done in a separate PR.

@mattosaurus mattosaurus merged commit 74f1bae into mattosaurus:master Oct 18, 2023
1 check passed
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