package pkix
import "github.com/zmap/zcrypto/x509/pkix"
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP.
Index ¶
- Variables
- type AlgorithmIdentifier
- type AttributeTypeAndValue
- func (a *AttributeTypeAndValue) MarshalJSON() ([]byte, error)
- func (a *AttributeTypeAndValue) UnmarshalJSON(b []byte) error
- type AttributeTypeAndValueSET
- type AuxOID
- func (aux *AuxOID) AsSlice() []int
- func (aux *AuxOID) CopyAsSlice() []int
- func (aux *AuxOID) Equal(other *AuxOID) bool
- func (aux *AuxOID) MarshalJSON() ([]byte, error)
- func (aux *AuxOID) UnmarshalJSON(b []byte) error
- type CertificateList
- type EDIPartyName
- type Extension
- func (ext *Extension) MarshalJSON() ([]byte, error)
- func (ext *Extension) UnmarshalJSON(b []byte) (err error)
- type Name
- func (n *Name) FillFromRDNSequence(rdns *RDNSequence)
- func (n *Name) MarshalJSON() ([]byte, error)
- func (n Name) String() string
- func (n Name) ToRDNSequence() (ret RDNSequence)
- func (n *Name) UnmarshalJSON(b []byte) error
- type OIDName
- type OtherName
- func (o *OtherName) MarshalJSON() ([]byte, error)
- func (o *OtherName) UnmarshalJSON(b []byte) (err error)
- type RDNSequence
- type RelativeDistinguishedNameSET
- type RevokedCertificate
- type TBSCertificateList
Variables ¶
var LegacyNameString = false
LegacyNameString allows to specify legacy ZCrypto behaviour for X509Name.String() in reverse order
Types ¶
type AlgorithmIdentifier ¶
type AlgorithmIdentifier struct { Algorithm asn1.ObjectIdentifier Parameters asn1.RawValue `asn1:"optional"` }
AlgorithmIdentifier represents the ASN.1 structure of the same name. See RFC 5280, section 4.1.1.2.
type AttributeTypeAndValue ¶
type AttributeTypeAndValue struct { Type asn1.ObjectIdentifier `json:"type"` Value interface{} `json:"value"` }
AttributeTypeAndValue mirrors the ASN.1 structure of the same name in RFC 5280, Section 4.1.2.4.
func (*AttributeTypeAndValue) MarshalJSON ¶
func (a *AttributeTypeAndValue) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*AttributeTypeAndValue) UnmarshalJSON ¶
func (a *AttributeTypeAndValue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type AttributeTypeAndValueSET ¶
type AttributeTypeAndValueSET struct { Type asn1.ObjectIdentifier Value [][]AttributeTypeAndValue `asn1:"set"` }
AttributeTypeAndValueSET represents a set of ASN.1 sequences of AttributeTypeAndValue sequences from RFC 2986 (PKCS #10).
type AuxOID ¶
type AuxOID []int
AuxOID behaves similar to asn1.ObjectIdentifier, except encodes to JSON as a string in dot notation. It is a type synonym for []int, and can be converted to an asn1.ObjectIdentifier by going through []int and back.
func (*AuxOID) AsSlice ¶
AsSlice returns a slice over the inner-representation
func (*AuxOID) CopyAsSlice ¶
CopyAsSlice returns a copy of the inter-representation as a slice
func (*AuxOID) Equal ¶
Equal tests (deep) equality of two AuxOIDs
func (*AuxOID) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*AuxOID) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type CertificateList ¶
type CertificateList struct { TBSCertList TBSCertificateList SignatureAlgorithm AlgorithmIdentifier SignatureValue asn1.BitString }
CertificateList represents the ASN.1 structure of the same name. See RFC 5280, section 5.1. Use Certificate.CheckCRLSignature to verify the signature.
func (*CertificateList) HasExpired ¶
func (certList *CertificateList) HasExpired(now time.Time) bool
HasExpired reports whether certList should have been updated by now.
type EDIPartyName ¶
type EDIPartyName struct { NameAssigner string `asn1:"tag:0,optional,explicit" json:"name_assigner,omitempty"` PartyName string `asn1:"tag:1,explicit" json:"party_name"` }
EDIPartyName represents the ASN.1 structure of the same name. See RFC 5280, section 4.2.1.6.
type Extension ¶
type Extension struct { Id asn1.ObjectIdentifier Critical bool `asn1:"optional"` Value []byte }
Extension represents the ASN.1 structure of the same name. See RFC 5280, section 4.2.
func (*Extension) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Extension) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type Name ¶
type Name struct { Country, Organization, OrganizationalUnit []string Locality, Province []string StreetAddress, PostalCode, DomainComponent []string EmailAddress []string SerialNumber, CommonName string SerialNumbers, CommonNames []string GivenName, Surname []string OrganizationIDs []string // EV Components JurisdictionLocality, JurisdictionProvince, JurisdictionCountry []string // Names contains all parsed attributes. When parsing distinguished names, // this can be used to extract non-standard attributes that are not parsed // by this package. When marshaling to RDNSequences, the Names field is // ignored, see ExtraNames. Names []AttributeTypeAndValue // ExtraNames contains attributes to be copied, raw, into any marshaled // distinguished names. Values override any attributes with the same OID. // The ExtraNames field is not populated when parsing, see Names. ExtraNames []AttributeTypeAndValue // OriginalRDNS is saved if the name is populated using FillFromRDNSequence. // Additionally, if OriginalRDNS is non-nil, the String and ToRDNSequence // methods will simply use this. OriginalRDNS RDNSequence }
Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an RDNSequence.
func (*Name) FillFromRDNSequence ¶
func (n *Name) FillFromRDNSequence(rdns *RDNSequence)
FillFromRDNSequence populates n from the provided RDNSequence. Multi-entry RDNs are flattened, all entries are added to the relevant n fields, and the grouping is not preserved.
func (*Name) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Name) String ¶
String returns the string form of n, roughly following the RFC 2253 Distinguished Names syntax.
func (Name) ToRDNSequence ¶
func (n Name) ToRDNSequence() (ret RDNSequence)
ToRDNSequence converts n into a single RDNSequence. The following attributes are encoded as multi-value RDNs:
- Country
- Organization
- OrganizationalUnit
- Locality
- Province
- StreetAddress
- PostalCode
Each ExtraNames entry is encoded as an individual RDN.
func (*Name) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type OIDName ¶
OIDName stores the short and long version of the name of an IANA-assigned OID
type OtherName ¶
type OtherName struct { TypeID asn1.ObjectIdentifier Value asn1.RawValue `asn1:"explicit"` }
OtherName represents the ASN.1 structure of the same name. See RFC 5280, section 4.2.1.6.
func (*OtherName) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*OtherName) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type RDNSequence ¶
type RDNSequence []RelativeDistinguishedNameSET
func (RDNSequence) String ¶
func (r RDNSequence) String() string
String returns a string representation of the sequence r, roughly following the RFC 2253 Distinguished Names syntax.
type RelativeDistinguishedNameSET ¶
type RelativeDistinguishedNameSET []AttributeTypeAndValue
type RevokedCertificate ¶
type RevokedCertificate struct { SerialNumber *big.Int RevocationTime time.Time Extensions []Extension `asn1:"optional"` }
RevokedCertificate represents the ASN.1 structure of the same name. See RFC 5280, section 5.1.
type TBSCertificateList ¶
type TBSCertificateList struct { Raw asn1.RawContent Version int `asn1:"optional,default:0"` Signature AlgorithmIdentifier Issuer RDNSequence ThisUpdate time.Time NextUpdate time.Time `asn1:"optional"` RevokedCertificates []RevokedCertificate `asn1:"optional"` Extensions []Extension `asn1:"tag:0,optional,explicit"` }
TBSCertificateList represents the ASN.1 structure of the same name. See RFC 5280, section 5.1.
Source Files ¶
json.go oid.go oid_names.go pkix.go
- Version
- v0.0.0-20250324021606-4f0ea0eaccac (latest)
- Published
- Mar 24, 2025
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 2 months ago –
Tools for package owners.