-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposalProposal-AcceptedProposal-CryptoProposal related to crypto packages or other security issuesProposal related to crypto packages or other security issues
Milestone
Description
(updated 2025-09-15)
x509.Certificate currently uses these fields to convey a parsed certificate's Extended Key Usage (EKU) values:
ExtKeyUsage []ExtKeyUsage // Sequence of extended key usages
UnknownExtKeyUsage []asn1.ObjectIdentifier // Encountered extended key usages unknown to this package.
There is currently no way to write future-proof code that checks for an unsupported EKU in a certificate. Checking UnknownExtKeyUsage alone is not sufficient because if the EKU becomes supported in the future, it will no longer appear in UnknownExtKeyUsage. And there's no way to check ExtKeyUsage because it's an int, not an OID, and there's no way to know what value the EKU will be assigned in the future.
TesseraCT for example is resorting to parsing the EKU extension itself to avoid this gotcha.
To make it possible for code to check for an OID in both UnknownExtKeyUsage and ExtKeyUsage, we propose adding:
// OID returns the ASN.1 object identifier of the EKU.
func (eku ExtKeyUsage) OID() OID
Metadata
Metadata
Assignees
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposalProposal-AcceptedProposal-CryptoProposal related to crypto packages or other security issuesProposal related to crypto packages or other security issues
Type
Projects
Status
Accepted