ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# package pkix `import "crypto/x509/pkix"` pkix包提供了共享的、低层次的结构体,用于ASN.1解析和X.509证书、CRL、OCSP的序列化。 ## Index * [type Extension](#Extension) * [type AlgorithmIdentifier](#AlgorithmIdentifier) * [type RevokedCertificate](#RevokedCertificate) * [type TBSCertificateList](#TBSCertificateList) * [type AttributeTypeAndValue](#AttributeTypeAndValue) * [type AttributeTypeAndValueSET](#AttributeTypeAndValueSET) * [type CertificateList](#CertificateList) * [func (certList \*CertificateList) HasExpired(now time.Time) bool](#CertificateList.HasExpired) * [type RelativeDistinguishedNameSET](#RelativeDistinguishedNameSET) * [type RDNSequence](#RDNSequence) * [type Name](#Name) * [func (n \*Name) FillFromRDNSequence(rdns \*RDNSequence)](#Name.FillFromRDNSequence) * [func (n Name) ToRDNSequence() (ret RDNSequence)](#Name.ToRDNSequence) ## type [Extension](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#42 "View Source") ``` type Extension struct { Id asn1.ObjectIdentifier Critical bool `asn1:"optional"` Value []byte } ``` Extension代表一个同名的ASN.1结构体,参见[RFC 5280](http://tools.ietf.org/html/rfc5280), section 4.2。 ## type [AlgorithmIdentifier](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#17 "View Source") ``` type AlgorithmIdentifier struct { Algorithm asn1.ObjectIdentifier Parameters asn1.RawValue `asn1:"optional"` } ``` AlgorithmIdentifier代表一个同名的ASN.1结构体,参见[RFC 5280](http://tools.ietf.org/html/rfc5280), section 4.1.1.2。 ## type [RevokedCertificate](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#174 "View Source") ``` type RevokedCertificate struct { SerialNumber *big.Int RevocationTime time.Time Extensions []Extension `asn1:"optional"` } ``` RevokedCertificate代表一个同名的ASN.1结构体,参见[RFC 5280](http://tools.ietf.org/html/rfc5280), section 5.1。 ## type [TBSCertificateList](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#161 "View Source") ``` type TBSCertificateList struct { Raw asn1.RawContent Version int `asn1:"optional,default:2"` Signature AlgorithmIdentifier Issuer RDNSequence ThisUpdate time.Time NextUpdate time.Time RevokedCertificates []RevokedCertificate `asn1:"optional"` Extensions []Extension `asn1:"tag:0,optional,explicit"` } ``` TBSCertificateList代表一个同名的ASN.1结构体,参见[RFC 5280](http://tools.ietf.org/html/rfc5280), section 5.1。 ## type [AttributeTypeAndValue](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#28 "View Source") ``` type AttributeTypeAndValue struct { Type asn1.ObjectIdentifier Value interface{} } ``` AttributeTypeAndValue代表一个同名的ASN.1结构体,参见[http://tools.ietf.org/html/rfc5280#section-4.1.2.4](http://tools.ietf.org/html/rfc5280#section-4.1.2.4)。 ## type [AttributeTypeAndValueSET](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#35 "View Source") ``` type AttributeTypeAndValueSET struct { Type asn1.ObjectIdentifier Value [][]AttributeTypeAndValue `asn1:"set"` } ``` AttributeTypeAndValueSET代表AttributeTypeAndValue序列表示的ASN.1序列的集合,参见[RFC 2986](http://tools.ietf.org/html/rfc2986) (PKCS #10)。 ## type [CertificateList](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#148 "View Source") ``` type CertificateList struct { TBSCertList TBSCertificateList SignatureAlgorithm AlgorithmIdentifier SignatureValue asn1.BitString } ``` CertificateList代表一个同名的ASN.1结构体,参见[RFC 5280](http://tools.ietf.org/html/rfc5280), section 5.1。用于认证签名。 ### func (\*CertificateList) [HasExpired](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#155 "View Source") ``` func (certList *CertificateList) HasExpired(now time.Time) bool ``` HasExpired报告证书列表是否已过期。 ## type [RelativeDistinguishedNameSET](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#24 "View Source") ``` type RelativeDistinguishedNameSET []AttributeTypeAndValue ``` ## type [RDNSequence](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#22 "View Source") ``` type RDNSequence []RelativeDistinguishedNameSET ``` ## type [Name](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#50 "View Source") ``` type Name struct { Country, Organization, OrganizationalUnit []string Locality, Province []string StreetAddress, PostalCode []string SerialNumber, CommonName string Names []AttributeTypeAndValue } ``` Name代表一个X.509识别名。只包含识别名的公共属性,额外的属性被忽略。 ### func (\*Name) [FillFromRDNSequence](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#59 "View Source") ``` func (n *Name) FillFromRDNSequence(rdns *RDNSequence) ``` ### func (Name) [ToRDNSequence](http://code.google.com/p/go/source/browse/src/pkg/crypto/x509/pkix/pkix.go?name=release#127 "View Source") ``` func (n Name) ToRDNSequence() (ret RDNSequence) ```