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

ECUtil.getCurveName() does not recognize Ed25519 curves #1087

Closed
vanitasvitae opened this issue Jan 10, 2022 · 3 comments
Closed

ECUtil.getCurveName() does not recognize Ed25519 curves #1087

vanitasvitae opened this issue Jan 10, 2022 · 3 comments

Comments

@vanitasvitae
Copy link
Contributor

When calling

ECPublicBCPGKey key = ... // generate/load PGP key based on Ed25519
ASN1ObjectIdentifier identifier = key.getCurveOID(); // "1.3.6.1.4.1.11591.15.1"
String curveName = ECUtil.getCurveName(identifier); // expect "ed25519", got null

I get null as curveName while I expect "ed25519".
See http://oid-info.com/get/1.3.6.1.4.1.11591.15.1

The curve is likely not properly entered into BCs curve tables.

vanitasvitae added a commit to pgpainless/pgpainless that referenced this issue Jan 10, 2022
@dghgit
Copy link
Contributor

dghgit commented Jan 13, 2022

It's a little more complicated than that... while they're both EC algorithms the mathematical presentation for them is different, so while there's an overlap as one curve X25519 is specified in both forms, the regular EC curves and the Ed curves are not quite the same thing. I've added a method on PGPUtil for looking up the curve name - it will return a name in the same way as the OID is described in the draft RFC.

@dghgit
Copy link
Contributor

dghgit commented Jan 14, 2022

Okay, this should now be in place. The new method is at:

public static String getCurveName(

I think it should do the trick. Now also up in https://www.bouncycastle.org/betas 171 b04 or later.

@vanitasvitae
Copy link
Contributor Author

Apparently the patch does use some wrong curve OIDs. See #1142 for details.

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

2 participants