Closed SecSamDev closed 3 weeks ago
The following RootCA certificate cannot be processed with rcgen giving an error "InvalidNameType".
@SecSamDev Can you expand on what processing you're doing?
I believe the cause of the problem is the directoryName
type SAN general name in this cert. Rcgen's support for converting general names from a pre-existing cert to its internal representation doesn't support that type.
I was testing how rcgen worked by parsing the certificates in /etc/ssl/certs and discovered that IZENPE was failing to parse.
You're right, general names aren't being converted, but wouldn't it be better to just silently ignore the ones that can't be converted? Or maybe provide an alternative method for doing so?
wouldn't it be better to just silently ignore the ones that can't be converted?
I'm not sure. I'm personally fairly wary of the existing CertificateParams::from_ca_cert_pem|der()
API since it's lossy - not all attributes of the certificate are translated into fields on CertificateParams
. Could the general name parsing be relaxed to further increase that "lossyness"? Probably, but I'm not sure it's the right direction.
I was testing how rcgen worked by parsing the certificates in /etc/ssl/certs
Taking a step back here: if your goal is to accurately parse and represent the data from your system's CA certificates I would argue that using x509-parser
is a better route. That's what CertificateParams::from_ca_cert_*()
is using under the hood and it can already represent the SANs from your example certificate without error.
I think of rcgen's API surface here as primarily suited for cases where you control the private key associated with the pre-existing certificate and want to issue new certificates, signing requests, or associated signed objects. That's certainly not the case for the INZENPE root (I hope ;-)).
Thank you so much, I will try to use that library. Even so, for someone who has a CA certificate to sign with parameters not supported by rcgen, it would be interesting to have an alternative that does not involve having to translate parameters from one library to another.
The following RootCA certificate cannot be processed with rcgen giving an error "InvalidNameType". The certificate can be found installed in /etc/ssl/certs/Izenpe.com.pem