-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
X.509 certificate parsing error in v41.0.0, not observed in v38.0.4, v40.0.2 #8996
Comments
It's complaining because of the way the signature algorithm is encoded. Specifically this is encoded with a parameters of
Can you share more about how this certificate was issued? |
Hello @alex, Thanks for the info. The certificate was issued using keytool, a tool for generating Java keystores. I can go over the steps to generate it. The main keytool command to generate a keystore containing a SHA256-ECDSA private key is:
There are 2 ways to get the certificate out: With JavaOur code loads the keystore and uses a Java method to pull out the certificate/public key associated with the private key in said keystore. The method is Keystore.getCertificate. This is how our code does it. Using
|
This seems highly likely to be a keytool bug. Sadly for us (though I'm sure you'll be glad :-)) this likely means we'll have to add a workaround, as it means it'll be widely impacting many people. However, before we do this, I'm dispatching @reaperhulk to go interface with the Java people and find out what the deal is, and get them to fix the issue. |
@ThorodanBrom I just tested this using JDK17 and it appears to generate the proper ASN.1 for the certificate -- what version of the JDK are you using? |
Hello @reaperhulk, unfortunately we're still using JDK 11 (the OpenJDK variant). If it helps, the version is |
Thanks @ThorodanBrom I've confirmed it on the latest OpenJDK 11 (11.0.19 as you noted). I've reached out to some Java folks to talk about what a fix might look like. Assuming we get a commitment for a fix then we'll look at putting in a workaround on our end to tolerate this non-compliant certificate structure. |
Thanks @reaperhulk and @alex |
This issue was fixed in JDK 16, so if you use |
Thanks @seanjmullan. We'll figure out our plans in terms of a temporary workaround. |
Hello,
Using cryptography version 41.0.0, I get a parsing error when trying to decode a particular certificate. The error message is pretty cryptic to me, so I'm not sure why exactly.
I did not get the any error when using versions 38.0.4 or 40.0.2
Reproducer
Running with cryptography version 41.0.0
cryptography-41.0.0-cp37-abi3-manylinux_2_28_x86_64
The error I get is:
Running with cryptography version 38.0.4, 40.0.2
It works with these versions, I get a
Certificate
objectCertificate
The certificate (the same one in the reproducer):
The decoded certificate:
(I'm not sure if 41.0.0 is complaining because the Issuer and Subject information is blank)
The text was updated successfully, but these errors were encountered: