Skip to content

Commit

Permalink
Add support for EK certificate extended key usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreEXFO committed Jan 21, 2025
1 parent 3f4164f commit d09b63c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/crypto/x509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ var (
oidExtKeyUsageNetscapeServerGatedCrypto = asn1.ObjectIdentifier{2, 16, 840, 1, 113730, 4, 1}
oidExtKeyUsageMicrosoftCommercialCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 2, 1, 22}
oidExtKeyUsageMicrosoftKernelCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 61, 1, 1}
oidExtKeyUsageEkCertificate = asn1.ObjectIdentifier{2, 23, 133, 8, 1}
)

// ExtKeyUsage represents an extended set of actions that are valid for a given key.
Expand All @@ -642,6 +643,7 @@ const (
ExtKeyUsageNetscapeServerGatedCrypto
ExtKeyUsageMicrosoftCommercialCodeSigning
ExtKeyUsageMicrosoftKernelCodeSigning
ExtKeyUsageEkCertificate
)

// extKeyUsageOIDs contains the mapping between an ExtKeyUsage and its OID.
Expand All @@ -663,6 +665,7 @@ var extKeyUsageOIDs = []struct {
{ExtKeyUsageNetscapeServerGatedCrypto, oidExtKeyUsageNetscapeServerGatedCrypto},
{ExtKeyUsageMicrosoftCommercialCodeSigning, oidExtKeyUsageMicrosoftCommercialCodeSigning},
{ExtKeyUsageMicrosoftKernelCodeSigning, oidExtKeyUsageMicrosoftKernelCodeSigning},
{ExtKeyUsageEkCertificate, oidExtKeyUsageEkCertificate},
}

func extKeyUsageFromOID(oid asn1.ObjectIdentifier) (eku ExtKeyUsage, ok bool) {
Expand Down

0 comments on commit d09b63c

Please sign in to comment.