-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
crypto/x509: provide method for generating conformant serial numbers #52444
Comments
Change https://go.dev/cl/401657 mentions this issue: |
This reverts CL400377, which restricted serials passed to x509.CreateCertificate to <= 20 octets. Unfortunately this turns out to be something _a lot_ of people get wrong. Since it's not particularly obvious how to properly generate conformant serials, until we provide an easier way for people to get this right, reverting this restriction makes sense (possible solution discussed in #52444.) Change-Id: Ia85a0ffe61e2e547abdaf1389c3e1ad29e28a2be Reviewed-on: https://go-review.googlesource.com/c/go/+/401657 Reviewed-by: Roland Shoemaker <roland@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> Auto-Submit: Roland Shoemaker <roland@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
This proposal has been added to the active column of the proposals project |
This seems fine. Does anyone object to this? |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
It is not clear if the proposal is to add |
Change https://go.dev/cl/479120 mentions this issue: |
Closing this in favor of the proposal in #67675. |
Currently, generating valid, RFC 5280 conformant, serial numbers is an exercise left up to the user. As of https://go.dev/cl/400377 we enforce the 20 octet length requirement, but it looks like a lot of users don't entirely know how they should go about generating a valid serial number (in particular if people do know about the 20 octet maximum, they are not aware that serials that are 20 octets long cannot have the MSB set.)
Since there are such ambiguities about how to best do this, it would seem prudent to just provide a function which generates serials (or a method on
*Certificate
) that are conformant with the 5280 rules, i.e.func GenerateSerial(rand io.Reader) (*big.Int, error)
func (*Certificate) GenerateSerial(rand io.Reader) error
The text was updated successfully, but these errors were encountered: