Documentation ¶
Overview ¶
Package asn1 provides types, values and functions for commonly-used PKI functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( OIDSubjectKeyIdentifier = goasn1.ObjectIdentifier{2, 5, 29, 14} OIDKeyUsage = goasn1.ObjectIdentifier{2, 5, 29, 15} OIDSubjectAltName = goasn1.ObjectIdentifier{2, 5, 29, 17} OIDBasicConstraints = goasn1.ObjectIdentifier{2, 5, 29, 19} OIDAuthorityKeyIdentifier = goasn1.ObjectIdentifier{2, 5, 29, 35} OIDExtendedKeyUsage = goasn1.ObjectIdentifier{2, 5, 29, 37} )
Extension OID values.
var ( OIDSignatureMD2WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 2} OIDSignatureMD5WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 4} OIDSignatureSHA1WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5} OIDSignatureSHA256WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11} OIDSignatureSHA384WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 12} OIDSignatureSHA512WithRSA = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 13} OIDSignatureRSAPSS = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 10} OIDSignatureDSAWithSHA1 = goasn1.ObjectIdentifier{1, 2, 840, 10040, 4, 3} OIDSignatureDSAWithSHA256 = goasn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 3, 2} OIDSignatureECDSAWithSHA1 = goasn1.ObjectIdentifier{1, 2, 840, 10045, 4, 1} OIDSignatureECDSAWithSHA256 = goasn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2} OIDSignatureECDSAWithSHA384 = goasn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 3} OIDSignatureECDSAWithSHA512 = goasn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 4} OIDSignatureEd25519 = goasn1.ObjectIdentifier{1, 3, 101, 112} OIDSHA256 = goasn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1} OIDSHA384 = goasn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 2} OIDSHA512 = goasn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 3} OIDMGF1 = goasn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 8} OIDISOSignatureSHA1WithRSA = goasn1.ObjectIdentifier{1, 3, 14, 3, 2, 29} )
Signature and hash OID values.
Functions ¶
Types ¶
type AuthorityKeyIdentifier ¶
type AuthorityKeyIdentifier struct { ID []byte `asn1:"optional,tag:0"` Issuer asn1.RawValue `asn1:"optional,tag:1"` SerialNumber *big.Int `asn1:"optional,tag:2"` }
AuthorityKeyIdentifier represents an X509 authority key identifier extension as defined in RFC 5280 section 4.2.1.1.
id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
AuthorityKeyIdentifier ::= SEQUENCE { keyIdentifier [0] KeyIdentifier OPTIONAL, authorityCertIssuer [1] GeneralNames OPTIONAL, authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } KeyIdentifier ::= OCTET STRING
func (AuthorityKeyIdentifier) Marshal ¶
func (e AuthorityKeyIdentifier) Marshal() ([]byte, error)
Marshal returns the ASN.1 DER-encoding of a value.
func (*AuthorityKeyIdentifier) Unmarshal ¶
func (e *AuthorityKeyIdentifier) Unmarshal(b []byte) error
Unmarshal parses an DER-encoded ASN.1 data structure and stores the result in the object.
type BasicConstraints ¶
type BasicConstraints struct { IsCA bool `asn1:"optional"` MaxPathLen int `asn1:"optional,default:-1"` }
BasicConstraints represents an X509 basic constraints extension as defined in RFC 5280 section 4.2.1.9.
id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }
BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL }
func (BasicConstraints) Marshal ¶
func (e BasicConstraints) Marshal() ([]byte, error)
Marshal returns the ASN.1 DER-encoding of a value.
func (*BasicConstraints) Unmarshal ¶
func (e *BasicConstraints) Unmarshal(b []byte) error
Unmarshal parses an DER-encoded ASN.1 data structure and stores the result in the object.
type GeneralNames ¶
type GeneralNames struct { DNSNames []string DirectoryNames []string EmailAddresses []string IPAddresses []net.IP URIs []*url.URL }
GeneralNames represents a General Names sequence as defined in RFC 5820 section 4.2.1.6.
GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
GeneralName ::= CHOICE { otherName [0] OtherName, rfc822Name [1] IA5String, dNSName [2] IA5String, x400Address [3] ORAddress, directoryName [4] Name, ediPartyName [5] EDIPartyName, uniformResourceIdentifier [6] IA5String, iPAddress [7] OCTET STRING, registeredID [8] OBJECT IDENTIFIER }
OtherName ::= SEQUENCE { type-id OBJECT IDENTIFIER, value [0] EXPLICIT ANY DEFINED BY type-id }
EDIPartyName ::= SEQUENCE { nameAssigner [0] DirectoryString OPTIONAL, partyName [1] DirectoryString }
func (GeneralNames) Marshal ¶
func (e GeneralNames) Marshal() ([]byte, error)
Marshal returns the ASN.1 DER-encoding of a value.
func (*GeneralNames) Unmarshal ¶
func (e *GeneralNames) Unmarshal(b []byte) error
Unmarshal parses an DER-encoded ASN.1 data structure and stores the result in the object.