-
Notifications
You must be signed in to change notification settings - Fork 100
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
TLS Handshake fails with Hubject PKI due to Extended Key Usage in root certificates #430
Comments
Apologies for the super late response. Maybe you have already fixed the issue. :) As a test, could you use the PKI and try running a session with the secc and evcc from this repo? That would help ensure the PKI has everything needed. The bits that are of interest on the SECC side are: On the EV side, we would need the v2g root ca cert. This stack has been tested against both the prod and dev environments from Hubject (US and EU). Is your chain derived from one of these? It maybe worth switching environment and retrying if you haven't one of the two yet.
Going by the error, the SSL client/server purposes of either party seem to be unavailable. |
The sslServer purpose is required to be able to use the cert for TLS handshake. Changing the verify mode isn't desired as that would undermine the security checks in place. If you were using the EU test environment for your tests, could you try switching to the US test environment and see if you get the same result? |
Thanks for having a look into this! In my original issue report, I provided a simple way to reproduce the problem without Hubject certificates. Did you try this? If you can't reproduce the issue this way, it might be due to the specific version of the SSL library on my system. (I am using Ubuntu 22.04.4 on WSL2.) I can reproduce the issue using code from this repository by following the README.md to run both SECC and EVCC on the same machine. I cannot switch to the US test environment, but I can still answer your question. The V2G roots in Hubject's US PKIs do not have any Extended Key Usage (EKU), so the issue would not occur... It seems only "V2G Root CA G2" and "V2G Root CA QA G1" use EKU. |
I use this implementation as part of the car simulator in EVerest (version 2024.6.0). When trying to use the Hubject PKI, TLS Handshake fails with error message:
I am slightly confused, because I thought the implementation had been tested against Hubject. Maybe I am just missing some configuration?
Explanation
Hubject uses X509v3 extension "Extended Key Usage" (EKU) in their root certificates (see link and certificate excerpt below). The only EKU their certificates provide is "OCSP Signing".
I do not understand the reason why Hubject adds this EKU. In principle, "Extended Key Usage" extension is not allowed for V2G root certificates by ISO15118-2. But Hubject is the de facto standard. So it would be good to be compliant.
It seems like OpenSSL does additional checks during TLS Handshake when the EKU extension is present. Especially, it does check whether the purpose (another word for EKU) "SSL Server" is present. This is not true for Hubject V2G root certificates. Therefore, the verification fails.
OpenSSL does not check the purposes when the extension is not available at all. That's why it does not complain when using self-generated PKI (based on create_certs.sh).
I found very little information on this. The best source I found is this question on StackExchange.
Reproducing the issue
If you do not have certificates from Hubject available, the issue can be reproduced by adapting v2gRootCACert.cnf as follows:
Generate a new PKI (with create_certs.sh) and verify that OpenSSL check for "SSL Server" purpose fails:
Whereas verification of the chain without checking for specific purpose is successful:
Using this adapted PKI will cause TLS handshake failing with the same error message as with Hubject certificates.
Simple Workaround
Certificate verification can be deactivated completely by enforcing
ssl_context.verify_mode = VerifyMode.CERT_NONE
in security.py.But I did not find a simple way to only deactivate checking of the EKU...
The text was updated successfully, but these errors were encountered: