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

Exporting public keys from PGPSecretKeyRing does denote sub keys as normal keys #381

Closed
vanitasvitae opened this Issue Jul 11, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@vanitasvitae
Contributor

vanitasvitae commented Jul 11, 2018

Hi!
My issue is the following: If I create a PGPSecretKeyRing containing a master key and a sub key, and then try to extract a PGPPublicKeyRing from it, the resulting key ring does only contain one key, as the sub keys are ignored. The cause for this is, that the sub keys are not carrying a PUBLIC_SUBKEY packet tag, but instead a PUBLIC_KEY tag. When creating the PGPPublicKeyRing, the sub keys are therefore ignored due to this line.

Inspecting the encoded PGPPublicKeyRing with gpg --list-packets also suggests, that only two normal public keys are exported.

I created this minimal example for you to recreate the issue.

@bcgit

This comment has been minimized.

Owner

bcgit commented Jul 13, 2018

Thanks for the report. Yes, it's a bit dodgy... oh dear... try the latest beta, I think that should now be making sure the keys are converted into subkeys immediately.

https://www.bouncycastle.org/betas

Let us know how you go.

hubot pushed a commit that referenced this issue Jul 13, 2018

@vanitasvitae

This comment has been minimized.

Contributor

vanitasvitae commented Jul 13, 2018

It seems to work now :)
Can you point me to which commit exactly fixed this issue, so I can try to create a workaround for my project until BC 1.61 is released?

Edit: Ah I see some related changes in 486c6d3

@bcgit

This comment has been minimized.

Owner

bcgit commented Jul 13, 2018

Yes, it's the change to PGPKeyRingGenerator

@vanitasvitae

This comment has been minimized.

Contributor

vanitasvitae commented Jul 16, 2018

For the record, I created this workaround for fixing this issue in retrospect on existing keys.
A quick test suggests, that it is working as intended, but I give no guarantees :D

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