Help us shape the future of Go! Take the 2026 Go Developer Survey

oid

package
v1.0.316 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package oid maps well-known X.509 object identifiers, key usages and extended key usages to human-readable names and back. The exported maps are process-global and must not be mutated after init.

Index

Constants

This section is empty.

Variables

View Source
var (
	ExtensionSubjectKeyID          = asn1.ObjectIdentifier{2, 5, 29, 14}
	ExtensionKeyUsage              = asn1.ObjectIdentifier{2, 5, 29, 15}
	ExtensionSubjectAltName        = asn1.ObjectIdentifier{2, 5, 29, 17}
	ExtensionBasicConstraints      = asn1.ObjectIdentifier{2, 5, 29, 19}
	ExtensionCRLNumber             = asn1.ObjectIdentifier{2, 5, 29, 20}
	ExtensionNameConstraints       = asn1.ObjectIdentifier{2, 5, 29, 30}
	ExtensionCRLDistributionPoints = asn1.ObjectIdentifier{2, 5, 29, 31}
	ExtensionCertificatePolicies   = asn1.ObjectIdentifier{2, 5, 29, 32}
	ExtensionAuthorityKeyID        = asn1.ObjectIdentifier{2, 5, 29, 35}
	ExtensionExtendedKeyUsage      = asn1.ObjectIdentifier{2, 5, 29, 37}
	ExtensionAuthorityInfoAccess   = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1, 1}
	AuthorityInfoAccessOcsp        = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 1}
	OCSPNoCheck                    = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 1, 5}
	AuthorityInfoAccessIssuers     = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 2}

	NameEmailAddress = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}
	NameCN           = asn1.ObjectIdentifier{2, 5, 4, 3}
	NameSerial       = asn1.ObjectIdentifier{2, 5, 4, 5}
	NameC            = asn1.ObjectIdentifier{2, 5, 4, 6}
	NameL            = asn1.ObjectIdentifier{2, 5, 4, 7}
	NameST           = asn1.ObjectIdentifier{2, 5, 4, 8}
	NameStreet       = asn1.ObjectIdentifier{2, 5, 4, 9}
	NameO            = asn1.ObjectIdentifier{2, 5, 4, 10}
	NameOU           = asn1.ObjectIdentifier{2, 5, 4, 11}
	NamePostal       = asn1.ObjectIdentifier{2, 5, 4, 17}
)

well-known OIDs

View Source
var DisplayName = map[string]string{
	"2.5.29.14":            "Subject KeyID",
	"2.5.29.15":            "Key Usage",
	"2.5.29.17":            "Subject Alt Name",
	"2.5.29.19":            "Basic Constraints",
	"2.5.29.20":            "CRL Number",
	"2.5.29.30":            "Name Constraints",
	"2.5.29.31":            "CRL Distribution Point",
	"2.5.29.32":            "Certificate Policies",
	"2.5.29.35":            "Authority KeyID",
	"2.5.29.37":            "Extended KeyUsage",
	"1.3.6.1.5.5.7.1.1":    "Authority Info Access",
	"1.3.6.1.5.5.7.48.1":   "OCSP",
	"1.3.6.1.5.5.7.48.1.5": "OCSP No Check",
	"1.3.6.1.5.5.7.48.2":   "Issuers",
}

DisplayName provides OID name

View Source
var ExtKeyUsage = map[string]x509.ExtKeyUsage{
	"any":              x509.ExtKeyUsageAny,
	"server auth":      x509.ExtKeyUsageServerAuth,
	"client auth":      x509.ExtKeyUsageClientAuth,
	"code signing":     x509.ExtKeyUsageCodeSigning,
	"email protection": x509.ExtKeyUsageEmailProtection,
	"s/mime":           x509.ExtKeyUsageEmailProtection,
	"ipsec end system": x509.ExtKeyUsageIPSECEndSystem,
	"ipsec tunnel":     x509.ExtKeyUsageIPSECTunnel,
	"ipsec user":       x509.ExtKeyUsageIPSECUser,
	"timestamping":     x509.ExtKeyUsageTimeStamping,
	"ocsp signing":     x509.ExtKeyUsageOCSPSigning,
	"microsoft sgc":    x509.ExtKeyUsageMicrosoftServerGatedCrypto,
	"netscape sgc":     x509.ExtKeyUsageNetscapeServerGatedCrypto,
}

ExtKeyUsage contains a mapping of string names to extended key usages.

View Source
var ExtKeyUsageName = map[x509.ExtKeyUsage]string{
	x509.ExtKeyUsageAny:                        "any",
	x509.ExtKeyUsageServerAuth:                 "server auth",
	x509.ExtKeyUsageClientAuth:                 "client auth",
	x509.ExtKeyUsageCodeSigning:                "code signing",
	x509.ExtKeyUsageEmailProtection:            "email protection",
	x509.ExtKeyUsageIPSECEndSystem:             "ipsec end system",
	x509.ExtKeyUsageIPSECTunnel:                "ipsec tunnel",
	x509.ExtKeyUsageIPSECUser:                  "ipsec user",
	x509.ExtKeyUsageTimeStamping:               "timestamping",
	x509.ExtKeyUsageOCSPSigning:                "ocsp signing",
	x509.ExtKeyUsageMicrosoftServerGatedCrypto: "microsoft sgc",
	x509.ExtKeyUsageNetscapeServerGatedCrypto:  "netscape sgc",
}

ExtKeyUsageName provides map of names

View Source
var KeyUsage = map[string]x509.KeyUsage{
	"signing":            x509.KeyUsageDigitalSignature,
	"digital signature":  x509.KeyUsageDigitalSignature,
	"content commitment": x509.KeyUsageContentCommitment,
	"key encipherment":   x509.KeyUsageKeyEncipherment,
	"key agreement":      x509.KeyUsageKeyAgreement,
	"data encipherment":  x509.KeyUsageDataEncipherment,
	"cert sign":          x509.KeyUsageCertSign,
	"crl sign":           x509.KeyUsageCRLSign,
	"encipher only":      x509.KeyUsageEncipherOnly,
	"decipher only":      x509.KeyUsageDecipherOnly,
}

KeyUsage contains a mapping of string names to key usages.

View Source
var KeyUsageName = map[x509.KeyUsage]string{
	x509.KeyUsageDigitalSignature:  "signing",
	x509.KeyUsageContentCommitment: "content commitment",
	x509.KeyUsageKeyEncipherment:   "key encipherment",
	x509.KeyUsageKeyAgreement:      "key agreement",
	x509.KeyUsageDataEncipherment:  "data encipherment",
	x509.KeyUsageCertSign:          "cert sign",
	x509.KeyUsageCRLSign:           "crl sign",
	x509.KeyUsageEncipherOnly:      "encipher only",
	x509.KeyUsageDecipherOnly:      "decipher only",
}

KeyUsageName provides map of names

Functions

func ExtKeyUsages

func ExtKeyUsages(eku ...x509.ExtKeyUsage) []string

ExtKeyUsages returns list of names

func KeyUsages

func KeyUsages(ku x509.KeyUsage) []string

KeyUsages returns the canonical names (from KeyUsageName) of the usage bits set in ku, in RFC 5280 bit order. Each bit is reported once; the "digital signature" alias accepted by KeyUsage is reported as "signing".

func Strings

func Strings(ids ...asn1.ObjectIdentifier) []string

Strings returns list of OID string values

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL