Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support ECDSA explicit curve parameters for ICAO 9303 certificates #885

Open
JBeer0911 opened this issue Oct 8, 2024 · 9 comments
Open

Comments

@JBeer0911
Copy link

When i try to analyze a pem certificate with Zlint i get this error.

time="2024-10-08T08:18:42+02:00" level=fatal msg="unable to parse certificate: asn1: structure error: tags don't match (6 vs {class:0 tag:16 length:320 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue: tag: stringType:0 timeType:0 set:false omitEmpty:false} ObjectIdentifier @4"

Someone can help me??

thanks in advance.

@JBeer0911
Copy link
Author

Hi again:
We saw that erroneous certificate has explicit elliptic curve parameters:
wrongCertificate
vs successfull certificate, that has named elliptic curve parameters:
successfulCertificate

The erroneous certificates can`t be parser by java standard security provider. If we try it, we obtain:
java.security.cert.CertificateParsingException: java.io.IOException: Only named ECParameters supported
at sun.security.x509.X509CertInfo.(Unknown Source)

In the other hand OpenSSL and Bouncy Castle Security provider parse both certificates.

I wish this info helps.
Thanks again.

@mcpherrinm
Copy link

Explicit curve parameters aren’t supported by the Golang x509 parser. RFC 5280 also doesn’t allow them.

I think it is unlikely Zlint will add support for them.

Is there a reason you are using explicit curve parameters?

@JBeer0911
Copy link
Author

Hi, explicit curve parameters are a client requirement.

Thanks by your fast answer.
Best regards, JB.

@mcpherrinm
Copy link

Can you expand on that any further? This is an effectively obsolete and unsupported feature, so I think it would be a big change to support it. Is there some ecosystem that uses this, and if so, why?

@mduran65
Copy link

The use case is to validate the certificate profiles used for signature processes included in ICAO 9303 - PKI for eMRTDS.
9303_p12_cons_es.pdf

@mcpherrinm
Copy link

mcpherrinm commented Oct 10, 2024

thanks. For my own reference, that document is available in English at https://www.icao.int/publications/Documents/9303_p12_cons_en.pdf

Specifically:

Those issuing States or organizations implementing ECDSA for signature generation or verification SHALL use [X9.62] or [ISO/IEC 15946]. The elliptic curve domain parameters used to generate the ECDSA key pair MUST be described explicitly in the parameters of the public key, i.e. parameters MUST be of type ECParameters (no named curves, no implicit parameters) and MUST include the optional co-factor. ECPoints MUST be in uncompressed format.

@mcpherrinm
Copy link

I've renamed the ticket to more accurately describe the issue at hand.

@mcpherrinm mcpherrinm changed the title Zlint doesn't open certificate. Support ECDSA explicit curve parameters for ICAO 9303 certificates Oct 11, 2024
@JBeer0911
Copy link
Author

It's better so!

Thanks again

@zakird
Copy link
Member

zakird commented Oct 11, 2024

At some point, we're going to likely have our own more flexible ASN.1 parser (@dadrian is hacking on), but, for the time being, I think this is going to fall out of scope since the certificates violate 5280.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants