-
Notifications
You must be signed in to change notification settings - Fork 122
Add support custom CSR extensions when parsing #337
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
base: main
Are you sure you want to change the base?
Conversation
158d183
to
8f721af
Compare
What are you trying to achieve? Which extension do you want to support? |
Proprietary extension, such as storing a user ID directly in the certificate. The idea is that since the certificate is signed, this metadata is guaranteed to have been validated by a CA, and I control the CA so I indeed validate those extensions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to give some thought to the general problem before comitting to this as the right solution, but it'd be nice to see the existing commits squashed in the meantime.
Also, this looks like a true positive: we don't want |
Not at all, we can just implement a simple wrapper type that is then converted internally into the specific x509-parser type. However its important to note that the upstream is currently working on some major rework of its API, and there's discussion about introducing a whole new visitor API for CSRs. So I would say this PR is definitely gonna change, which is why its a draft. I though it would still be valuable to write this PR in case it is a controversial change etc. |
17e72e7
to
b4e43fd
Compare
* Allow user to parse otherwise unsupported extensions. * Retain the custom extensions when parsing. * Update to latest branch commit * Ran rustfmt * Fix clippy * Add UnsupportedExtension wrapper type
b4e43fd
to
7240eac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo some nits, I think this looks pretty reasonable.
This PR adds
CertificateSigningRequestParams::from_pem_validated
&from_der_validated
methods, which allow the user to provide a custom validation closure to handle otherwise unsupported extensions found in theOID_PKCS_9_AT_EXTENSION_REQUEST
CRL attribute. In other words, this allow CSR to correctly handleCustomExtension
found into the custom_extensions field when parsing from DER or PEM.This depends on this PR being merged.
This closes #150.