pkix

优质
小牛编辑
132浏览
2023-12-01

import "crypto/x509/pkix"

pkix包提供了共享的、低层次的结构体,用于ASN.1解析和X.509证书、CRL、OCSP的序列化。


  • type Extension
  • type AlgorithmIdentifier
  • type RevokedCertificate
  • type TBSCertificateList
  • type AttributeTypeAndValue
  • type AttributeTypeAndValueSET
  • type CertificateList
  • type RelativeDistinguishedNameSET
  • type RDNSequence
  • type Name
  • type Extension

    type Extension struct {
        Id       asn1.ObjectIdentifier
        Critical bool `asn1:"optional"`
        Value    []byte
    }

    Extension代表一个同名的ASN.1结构体,参见RFC 5280, section 4.2。

    type AlgorithmIdentifier

    type AlgorithmIdentifier struct {
        Algorithm  asn1.ObjectIdentifier
        Parameters asn1.RawValue `asn1:"optional"`
    }

    AlgorithmIdentifier代表一个同名的ASN.1结构体,参见RFC 5280, section 4.1.1.2。

    type RevokedCertificate

    type RevokedCertificate struct {
        SerialNumber   *big.Int
        RevocationTime time.Time
        Extensions     []Extension `asn1:"optional"`
    }

    RevokedCertificate代表一个同名的ASN.1结构体,参见RFC 5280, section 5.1。

    type TBSCertificateList

    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, section 5.1。

    type AttributeTypeAndValue

    type AttributeTypeAndValue struct {
        Type  asn1.ObjectIdentifier
        Value interface{}
    }

    AttributeTypeAndValue代表一个同名的ASN.1结构体,参见http://tools.ietf.org/html/rfc5280#section-4.1.2.4

    type AttributeTypeAndValueSET

    type AttributeTypeAndValueSET struct {
        Type  asn1.ObjectIdentifier
        Value [][]AttributeTypeAndValue `asn1:"set"`
    }

    AttributeTypeAndValueSET代表AttributeTypeAndValue序列表示的ASN.1序列的集合,参见RFC 2986 (PKCS #10)。

    type CertificateList

    type CertificateList struct {
        TBSCertList        TBSCertificateList
        SignatureAlgorithm AlgorithmIdentifier
        SignatureValue     asn1.BitString
    }

    CertificateList代表一个同名的ASN.1结构体,参见RFC 5280, section 5.1。用于认证签名。

    func (*CertificateList) HasExpired

    func (certList *CertificateList) HasExpired(now time.Time) bool

    HasExpired报告证书列表是否已过期。

    type RelativeDistinguishedNameSET

    type RelativeDistinguishedNameSET []AttributeTypeAndValue

    type RDNSequence

    type RDNSequence []RelativeDistinguishedNameSET

    type Name

    type Name struct {
        Country, Organization, OrganizationalUnit []string
        Locality, Province                        []string
        StreetAddress, PostalCode                 []string
        SerialNumber, CommonName                  string
        Names []AttributeTypeAndValue
    }

    Name代表一个X.509识别名。只包含识别名的公共属性,额外的属性被忽略。

    func (*Name) FillFromRDNSequence

    func (n *Name) FillFromRDNSequence(rdns *RDNSequence)

    func (Name) ToRDNSequence

    func (n Name) ToRDNSequence() (ret RDNSequence)