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

Cannot generate BcPGPKeyPair for X448 #1584

Open
hbs opened this issue Feb 18, 2024 · 2 comments
Open

Cannot generate BcPGPKeyPair for X448 #1584

hbs opened this issue Feb 18, 2024 · 2 comments
Assignees

Comments

@hbs
Copy link
Contributor

hbs commented Feb 18, 2024

Attempting to do the following fails with a ClassCastException when BcPGKeyConverter wrongly assumes its input parameter not being ECPrivateKeyParameters means they are X25519.

X448KeyPairGenerator xkpg = new X448KeyPairGenerator();
xkpg.init(new KeyGenerationParameters(new SecureRandom(), 0));
BcPGPKeyPair kp = new BcPGPKeyPair(PublicKeyAlgorithmTags.ECDH, xkpg.generateKeyPair(), new Date());
@ligefeiBouncycastle ligefeiBouncycastle self-assigned this Feb 18, 2024
@vanitasvitae
Copy link
Contributor

I might have a patch for this issue :)

@vanitasvitae
Copy link
Contributor

This is now fixed, though you should note that X448 + PublicKeyAlgorithmTags.ECDH is not a valid combination according to the OpenPGP specification. GnuPG might be able to deal with such keys, but other implementations following the official spec might not.

Consider using X448 + PublicKeyAlgorithmTags.X448 instead (though GnuPG migh not support this combination -.-).

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

No branches or pull requests

3 participants