mirrored from https://www.bouncycastle.org/repositories/bc-java
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
PGPPublicKey.getBitStrenght() returns -1 for keys over curve25519 #972
Comments
vanitasvitae
added a commit
to pgpainless/pgpainless
that referenced
this issue
Jun 11, 2021
BCs PGPPublicKey.getBitStrenght() appears to fail to recognize some elliptic curves. In such cases, bitStrength is reported as -1. I added BCUtil.getBitStrength(publicKey) to manually determine the bit strenght by OID. See bcgit/bc-java#972 for an upstream bug report.
vanitasvitae
added a commit
to pgpainless/pgpainless
that referenced
this issue
Jun 15, 2021
BCs PGPPublicKey.getBitStrenght() appears to fail to recognize some elliptic curves. In such cases, bitStrength is reported as -1. I added BCUtil.getBitStrength(publicKey) to manually determine the bit strenght by OID. See bcgit/bc-java#972 for an upstream bug report.
I've added recognition for the GNU oid for Ed25519 and Cryptlib Curve-25519. The fix will show up in 170b09. |
Nice! 👍 |
vanitasvitae
added a commit
to pgpainless/pgpainless
that referenced
this issue
Jan 10, 2022
vanitasvitae
added a commit
to pgpainless/pgpainless
that referenced
this issue
Jan 15, 2022
vanitasvitae
added a commit
to pgpainless/pgpainless
that referenced
this issue
Jan 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
it appears that in the constructor of PGPPublicKey, the bitstrenght field is set by calling
This method does not recognize EdDSA keys, as well as some ECDSA keys, so bitStrength is falsely reported as -1.
In particular, the method fails to identify keys with OIDs
1.3.6.1.4.1.11591.15.1
1.3.6.1.4.1.3029.1.5.1
Could you patch the ECNamedCurveTable to recognize these curves?
The text was updated successfully, but these errors were encountered: