Documentation
¶
Index ¶
- Variables
- func ToCertificatePolicies(in []byte) ([]string, error)
- func ToExtendedKeyUsage(in []byte) ([]string, error)
- func ToGeneralNames(in []byte) ([]string, error)
- func ToKeyUsage(in []byte) ([]string, error)
- func ToRelativeDistinguishedName(in []byte) ([]string, error)
- func ToSignedCertificateTimestampList(in []byte) ([]byte, error)
- type AccessDescription
- type AuthorityKeyIdentifier
- type BasicConstraints
- type CSR
- func (c CSR) DNSNames() []string
- func (c CSR) EmailAddresses() []string
- func (c CSR) Error() error
- func (c CSR) Extensions() []Extension
- func (c CSR) IPAddresses() []string
- func (c CSR) PublicKeyAlgorithm() string
- func (c CSR) Signature() string
- func (c CSR) SignatureAlgorithm() string
- func (c CSR) SubjectString() string
- func (c CSR) ToPEM() []byte
- func (c CSR) URIs() []string
- func (c CSR) Version() int
- type CSRLocation
- type CSRLocations
- type CSRs
- type Certificate
- func (c Certificate) AuthorityKeyId() string
- func (c Certificate) DNSNames() []string
- func (c Certificate) Error() error
- func (c Certificate) ExtKeyUsage() []string
- func (c Certificate) Extensions() []Extension
- func (c Certificate) IPAddresses() []string
- func (c Certificate) IsCA() bool
- func (c Certificate) IsExpired() bool
- func (c Certificate) Issuer() string
- func (c Certificate) KeyUsage() []string
- func (c Certificate) NotAfter() time.Time
- func (c Certificate) NotBefore() time.Time
- func (c Certificate) PublicKeyAlgorithm() string
- func (c Certificate) SerialNumber() string
- func (c Certificate) Signature() string
- func (c Certificate) SignatureAlgorithm() string
- func (c Certificate) SubjectKeyId() string
- func (c Certificate) SubjectString() string
- func (c Certificate) ToPEM() []byte
- func (c Certificate) Type() string
- func (c Certificate) Version() int
- type CertificateLocation
- func LoadCertificateFromClipboard(password string) CertificateLocation
- func LoadCertificateFromStdin(password string) CertificateLocation
- func LoadCertificatesFromFile(fileName string, password string) CertificateLocation
- func LoadCertificatesFromNetwork(addr string, serverName string, tlsSkipVerify bool) CertificateLocation
- func (c CertificateLocation) Chains() ([]Certificates, error)
- func (c CertificateLocation) IssuerLike(issuer string) CertificateLocation
- func (c CertificateLocation) Name() string
- func (c CertificateLocation) RemoveDuplicates() CertificateLocation
- func (c CertificateLocation) RemoveExpired() CertificateLocation
- func (c CertificateLocation) SortByExpiry() CertificateLocation
- func (c CertificateLocation) SubjectLike(subject string) CertificateLocation
- type CertificateLocations
- func (c CertificateLocations) IssuerLike(issuer string) CertificateLocations
- func (c CertificateLocations) RemoveDuplicates() CertificateLocations
- func (c CertificateLocations) RemoveExpired() CertificateLocations
- func (c CertificateLocations) SortByExpiry() CertificateLocations
- func (c CertificateLocations) SubjectLike(subject string) CertificateLocations
- type Certificates
- type ContentType
- type DistributionPoint
- type Extension
- type GeneralName
- type Location
- func (l Location) Chains() ([]Certificates, error)
- func (l Location) IsCSR() bool
- func (l Location) IsCertificate() bool
- func (l Location) IsMixed() bool
- func (l Location) IssuerLike(issuer string) Location
- func (l Location) Name() string
- func (l Location) RemoveDuplicates() Location
- func (l Location) RemoveExpired() Location
- func (l Location) SortByExpiry() Location
- func (l Location) SubjectLike(subject string) Location
- type Locations
- type PasswordRequiredError
- func (e *PasswordRequiredError) Data() []byte
- func (e *PasswordRequiredError) Error() string
- func (e *PasswordRequiredError) Provided() bool
- func (e *PasswordRequiredError) SetSource(source PasswordSource)
- func (e *PasswordRequiredError) Source() PasswordSource
- func (e *PasswordRequiredError) Unwrap() error
- type PasswordSource
Constants ¶
This section is empty.
Variables ¶
var (
ErrPFXPasswordRequired = errors.New("pkcs12: password required")
)
Functions ¶
func ToCertificatePolicies ¶
ToCertificatePolicies returns slice of "identifier: qualifier" values
func ToExtendedKeyUsage ¶
func ToGeneralNames ¶
ToGeneralNames returns slice of "type: value1, value2, valueX" strings
func ToKeyUsage ¶
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1), -- recent editions of X.509 have
-- renamed this bit to contentCommitment
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8) }
func ToRelativeDistinguishedName ¶
ToRelativeDistinguishedName returns slice of "type: value" strings
Types ¶
type AccessDescription ¶
func ToAuthorityInformationAccess ¶
func ToAuthorityInformationAccess(in []byte) ([]AccessDescription, error)
type AuthorityKeyIdentifier ¶
type AuthorityKeyIdentifier struct {
KeyIdentifier []byte
AuthorityCertIssuer []string
AuthorityCertSerialNumber int
}
AuthorityKeyIdentifier ::= SEQUENCE { keyIdentifier [0] KeyIdentifier OPTIONAL, authorityCertIssuer [1] GeneralNames OPTIONAL, authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } -- authorityCertIssuer and authorityCertSerialNumber MUST both -- be present or both be absent
func ToAuthorityKeyIdentifier ¶
func ToAuthorityKeyIdentifier(in []byte) (AuthorityKeyIdentifier, error)
type BasicConstraints ¶
BasicConstraints ::= SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL }
func ToBasicConstraints ¶
func ToBasicConstraints(in []byte) (BasicConstraints, error)
type CSR ¶ added in v0.0.3
type CSR struct {
// contains filtered or unexported fields
}
func (CSR) EmailAddresses ¶ added in v0.0.3
func (CSR) Extensions ¶ added in v0.0.3
func (CSR) IPAddresses ¶ added in v0.0.3
func (CSR) PublicKeyAlgorithm ¶ added in v0.0.3
func (CSR) SignatureAlgorithm ¶ added in v0.0.3
func (CSR) SubjectString ¶ added in v0.0.3
type CSRLocation ¶ added in v0.0.3
func LoadCSRFromClipboard ¶ added in v0.0.3
func LoadCSRFromClipboard() CSRLocation
func LoadCSRFromStdin ¶ added in v0.0.3
func LoadCSRFromStdin() CSRLocation
func LoadCSRsFromFile ¶ added in v0.0.3
func LoadCSRsFromFile(fileName string) CSRLocation
func (CSRLocation) Name ¶ added in v0.0.3
func (c CSRLocation) Name() string
type CSRLocations ¶ added in v0.0.3
type CSRLocations []CSRLocation
type CSRs ¶ added in v0.0.3
type CSRs []CSR
func FromCSRBytes ¶ added in v0.0.3
FromCSRBytes converts raw CSR bytes to CSR structures. Supports PEM and DER formats.
func FromX509CertificateRequests ¶ added in v0.0.3
func FromX509CertificateRequests(csrs []*x509.CertificateRequest) CSRs
FromX509CertificateRequests converts x509.CertificateRequest slice to CSRs
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
func (Certificate) AuthorityKeyId ¶
func (c Certificate) AuthorityKeyId() string
func (Certificate) DNSNames ¶
func (c Certificate) DNSNames() []string
func (Certificate) Error ¶
func (c Certificate) Error() error
func (Certificate) ExtKeyUsage ¶
func (c Certificate) ExtKeyUsage() []string
ExtKeyUsage extended key usage string representation
func (Certificate) Extensions ¶
func (c Certificate) Extensions() []Extension
func (Certificate) IPAddresses ¶
func (c Certificate) IPAddresses() []string
func (Certificate) IsCA ¶
func (c Certificate) IsCA() bool
func (Certificate) IsExpired ¶
func (c Certificate) IsExpired() bool
func (Certificate) Issuer ¶
func (c Certificate) Issuer() string
func (Certificate) KeyUsage ¶
func (c Certificate) KeyUsage() []string
func (Certificate) NotAfter ¶
func (c Certificate) NotAfter() time.Time
func (Certificate) NotBefore ¶
func (c Certificate) NotBefore() time.Time
func (Certificate) PublicKeyAlgorithm ¶
func (c Certificate) PublicKeyAlgorithm() string
func (Certificate) SerialNumber ¶
func (c Certificate) SerialNumber() string
func (Certificate) Signature ¶
func (c Certificate) Signature() string
func (Certificate) SignatureAlgorithm ¶
func (c Certificate) SignatureAlgorithm() string
func (Certificate) SubjectKeyId ¶
func (c Certificate) SubjectKeyId() string
func (Certificate) SubjectString ¶
func (c Certificate) SubjectString() string
func (Certificate) ToPEM ¶
func (c Certificate) ToPEM() []byte
func (Certificate) Type ¶
func (c Certificate) Type() string
func (Certificate) Version ¶
func (c Certificate) Version() int
type CertificateLocation ¶
type CertificateLocation struct {
TLSVersion uint16 // only applicable for network certificates
Path string
Error error
Certificates Certificates
}
func LoadCertificateFromClipboard ¶
func LoadCertificateFromClipboard(password string) CertificateLocation
func LoadCertificateFromStdin ¶
func LoadCertificateFromStdin(password string) CertificateLocation
func LoadCertificatesFromFile ¶
func LoadCertificatesFromFile(fileName string, password string) CertificateLocation
func LoadCertificatesFromNetwork ¶
func LoadCertificatesFromNetwork(addr string, serverName string, tlsSkipVerify bool) CertificateLocation
func (CertificateLocation) Chains ¶
func (c CertificateLocation) Chains() ([]Certificates, error)
func (CertificateLocation) IssuerLike ¶
func (c CertificateLocation) IssuerLike(issuer string) CertificateLocation
func (CertificateLocation) Name ¶
func (c CertificateLocation) Name() string
func (CertificateLocation) RemoveDuplicates ¶
func (c CertificateLocation) RemoveDuplicates() CertificateLocation
func (CertificateLocation) RemoveExpired ¶
func (c CertificateLocation) RemoveExpired() CertificateLocation
func (CertificateLocation) SortByExpiry ¶
func (c CertificateLocation) SortByExpiry() CertificateLocation
func (CertificateLocation) SubjectLike ¶
func (c CertificateLocation) SubjectLike(subject string) CertificateLocation
type CertificateLocations ¶
type CertificateLocations []CertificateLocation
func (CertificateLocations) IssuerLike ¶
func (c CertificateLocations) IssuerLike(issuer string) CertificateLocations
func (CertificateLocations) RemoveDuplicates ¶
func (c CertificateLocations) RemoveDuplicates() CertificateLocations
func (CertificateLocations) RemoveExpired ¶
func (c CertificateLocations) RemoveExpired() CertificateLocations
func (CertificateLocations) SortByExpiry ¶
func (c CertificateLocations) SortByExpiry() CertificateLocations
func (CertificateLocations) SubjectLike ¶
func (c CertificateLocations) SubjectLike(subject string) CertificateLocations
type Certificates ¶
type Certificates []Certificate
func FromBytes ¶
func FromBytes(data []byte, password string) (Certificates, error)
FromBytes converts raw certificate bytes to certificate, if the supplied data is cert bundle (or chain) all the certificates will be returned. Supports PEM, DER, and PKCS12 formats.
func FromX509Certificates ¶
func FromX509Certificates(cs []*x509.Certificate) Certificates
func (Certificates) IssuerLike ¶
func (c Certificates) IssuerLike(issuer string) Certificates
func (Certificates) RemoveDuplicates ¶
func (c Certificates) RemoveDuplicates() Certificates
func (Certificates) RemoveExpired ¶
func (c Certificates) RemoveExpired() Certificates
func (Certificates) SortByExpiry ¶
func (c Certificates) SortByExpiry() Certificates
func (Certificates) SubjectLike ¶
func (c Certificates) SubjectLike(subject string) Certificates
type ContentType ¶ added in v0.0.3
type ContentType int
ContentType indicates whether content is a certificate or CSR
const ( ContentTypeCertificate ContentType = iota ContentTypeCSR ContentTypeMixed )
type DistributionPoint ¶
func ToCRLDistributionPoints ¶
func ToCRLDistributionPoints(in []byte) ([]DistributionPoint, error)
type GeneralName ¶
type Location ¶ added in v0.0.3
type Location struct {
TLSVersion uint16 // only applicable for network certificates
Path string
Error error
ContentType ContentType
Certificates Certificates
CSRs CSRs
}
Location represents a source of certificates or CSRs
func LoadFromClipboard ¶ added in v0.0.3
LoadFromClipboard loads certificates or CSRs from clipboard with auto-detection
func LoadFromFile ¶ added in v0.0.3
LoadFromFile loads certificates or CSRs from a file with auto-detection
func LoadFromNetwork ¶ added in v0.0.3
LoadFromNetwork loads certificates from a network address
func LoadFromStdin ¶ added in v0.0.3
LoadFromStdin loads certificates or CSRs from stdin with auto-detection
func (Location) Chains ¶ added in v0.0.3
func (l Location) Chains() ([]Certificates, error)
func (Location) IsCertificate ¶ added in v0.0.3
func (Location) IssuerLike ¶ added in v0.0.3
func (Location) RemoveDuplicates ¶ added in v0.0.3
func (Location) RemoveExpired ¶ added in v0.0.3
func (Location) SortByExpiry ¶ added in v0.0.3
func (Location) SubjectLike ¶ added in v0.0.3
type Locations ¶ added in v0.0.3
type Locations []Location
func (Locations) IssuerLike ¶ added in v0.0.3
func (Locations) RemoveDuplicates ¶ added in v0.0.3
func (Locations) RemoveExpired ¶ added in v0.0.3
func (Locations) SortByExpiry ¶ added in v0.0.3
func (Locations) SubjectLike ¶ added in v0.0.3
type PasswordRequiredError ¶
type PasswordRequiredError struct {
// contains filtered or unexported fields
}
func (*PasswordRequiredError) Data ¶
func (e *PasswordRequiredError) Data() []byte
func (*PasswordRequiredError) Error ¶
func (e *PasswordRequiredError) Error() string
func (*PasswordRequiredError) Provided ¶
func (e *PasswordRequiredError) Provided() bool
func (*PasswordRequiredError) SetSource ¶
func (e *PasswordRequiredError) SetSource(source PasswordSource)
func (*PasswordRequiredError) Source ¶
func (e *PasswordRequiredError) Source() PasswordSource
func (*PasswordRequiredError) Unwrap ¶
func (e *PasswordRequiredError) Unwrap() error
type PasswordSource ¶
type PasswordSource int
const ( PasswordSourceUnknown PasswordSource = iota PasswordSourceFile PasswordSourceClipboard PasswordSourceStdin )