(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
(updated 2025-09-15)
x509.Certificatecurrently uses these fields to convey a parsed certificate's Extended Key Usage (EKU) values:There is currently no way to write future-proof code that checks for an unsupported EKU in a certificate. Checking
UnknownExtKeyUsagealone is not sufficient because if the EKU becomes supported in the future, it will no longer appear inUnknownExtKeyUsage. And there's no way to checkExtKeyUsagebecause 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
UnknownExtKeyUsageandExtKeyUsage, we propose adding: