-
Notifications
You must be signed in to change notification settings - Fork 110
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
lib: support X509v3 Extended Key Usage in Certificate Signing Requests #157
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #157 +/- ##
==========================================
- Coverage 80.30% 72.54% -7.77%
==========================================
Files 9 7 -2
Lines 2407 1916 -491
==========================================
- Hits 1933 1390 -543
- Misses 474 526 +52 ☔ View full report in Codecov by Sentry. |
Hi there, thanks for the PR! This falls under a similar umbrella as #122 & #150 As you discovered right now Rcgen doesn't emit all possible extensions from the cert into the CSR and vice versa. My personal preference is to hold fixing this until after #156 and calling it out as a breaking change. I'm nervous there are existing users of Beyond fixing this as a breaking change I'd also prefer to see the general extension handling improved more holistically so we don't have to handle each extension specially. There are also some related improvements to consider like #155. I have a work in progress branch that I hope to open as a PR shortly that tackles some of that. I'm thinking that we could hold your PR until we're ready for breaking changes and then either land your quick fix, reworking it into my next set of changes afterwards, or if my changes are already ready we can roll with those. Does that make sense? |
@cpu Thanks for the explanation! Alternatively, we could introduce a Cargo feature flag requiring users to explicitly opt-in if they want EKU support. That way, existing users will not be affected by the changes here. |
I thought this extended key usage was working at one point in the past, because I remember having to take it out when I did an upgrade. If you can wait a day or two, I'll try to see if I'm imagining things, or if that is what happened - in case it changes how you treat semver for this. |
It was supported in version Here's the snippet:
With version 0.11, that last line has to be commented out. |
The commit that broke being able to set extended key usages on CSRs is 7cef31e |
I think feature flags are too heavy weight for this. I would still prefer to fix the lot of extension related issues as part of a breaking API change. |
The CLI tool im writing is currently dependent on this feature, is there any estimate when it will be merged? Is there any support I can provide to accelerate this process? |
Depending on whether @tindzk is still interested/available to push this forward, it could help to rebase this on the main branch and address any open issues identified in the feedback so far. Current main already has breaking changes, so it would be okay to add more to that. |
When attempting to serialise a signing request that specifies `extended_key_usages` on `CertificateParams`, currently an `UnsupportedInCsr` error is returned. However, RFC 2986 does not preclude the use of X509v3 Extended Key Usage in CSRs. As a reference, OpenSSL also supports this extension: ```shell openssl req \ -new \ -addext "extendedKeyUsage = serverAuth,clientAuth" \ -out test.csr ```
39157cf
to
edebf32
Compare
I have rebased the PR. Please let me know if any further changes are needed. |
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 think merging this would be reasonable, but I would like it to be split into smaller commits:
- One for the
assert
change - One for the typo
- One for the change to
write_subject_alt_names()
- One for the extraction of
write_extended_key_usages()
- One for the calling
write_extended_key_usages()
for the CSR case
This makes it much easier to review.
@tindzk Do you think you'll be up for addressing the feedback suggested by @djc? |
This ended up getting rolled into #264 Thanks for your contribution. |
Purpose
When attempting to serialise a signing request that specifies
extended_key_usages
onCertificateParams
, currently anUnsupportedInCsr
error is returned.However, RFC 2986 does not preclude the use of X509v3 Extended Key Usage in CSRs. As a reference, OpenSSL also supports this extension:
openssl req \ -new \ -addext "extendedKeyUsage = serverAuth,clientAuth" \ -out test.csr
Changes
extended_key_usages
in CSRsChecklist
Verified by executing
openssl req -inform der -in /tmp/test.der -noout -text