extensions

package
v0.0.0-...-a59892a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 13 Imported by: 0

README

extensions

Package extensions provides types representing X509 certificate extensions.

Documentation

Overview

Package extensions provides types representing X509 certificate extensions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTrailingBytes indicates that trailing bytes were found after the
	// extension value.
	ErrTrailingBytes = errors.New("trailing ASN.1 bytes")
)

Functions

func MakePublicKeyIdentifier

func MakePublicKeyIdentifier(pub crypto.PublicKey) ([]byte, error)

MakePublicKeyIdentifier builds a public key identifier in accordance with the first method described in RFC5280 section 4.2.1.2.

Types

type AuthorityKeyIdentifier

type AuthorityKeyIdentifier struct {
	Critical     bool
	ID           []byte
	Issuer       asn1.RawValue
	SerialNumber *big.Int
}

AuthorityKeyIdentifier represents an X509 authority key identifier extension as defined in RFC 5280 section 4.2.1.1.

func (AuthorityKeyIdentifier) Marshal

func (e AuthorityKeyIdentifier) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*AuthorityKeyIdentifier) Unmarshal

func (e *AuthorityKeyIdentifier) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

type BasicConstraints

type BasicConstraints struct {
	Critical   bool
	IsCA       bool
	MaxPathLen int
}

BasicConstraints represents an X509 basic constraints extension as defined in RFC 5280 section 4.2.1.9.

func (BasicConstraints) Marshal

func (e BasicConstraints) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*BasicConstraints) Unmarshal

func (e *BasicConstraints) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

type ExtendedKeyUsage

type ExtendedKeyUsage struct {
	Critical bool
	OIDs     []asn1.ObjectIdentifier
}

ExtendedKeyUsage represents an X509 extended key usage extension as defined in RFC5280 section 4.2.1.12.

func (ExtendedKeyUsage) Marshal

func (e ExtendedKeyUsage) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*ExtendedKeyUsage) Unmarshal

func (e *ExtendedKeyUsage) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

type KeyUsage

type KeyUsage struct {
	Critical bool
	Value    x509.KeyUsage
}

KeyUsage represents an X509 key usage extension as defined in RFC5280 section 4.2.1.3.

func (KeyUsage) Marshal

func (e KeyUsage) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*KeyUsage) Unmarshal

func (e *KeyUsage) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

type SubjectAltName

type SubjectAltName struct {
	Critical       bool
	DNSNames       []string
	EmailAddresses []string
	IPAddresses    []net.IP
	URIs           []*url.URL
}

SubjectAltName represents a subject alternative name extension as defined in RFC5280 section 4.2.1.6.

func (SubjectAltName) Marshal

func (e SubjectAltName) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*SubjectAltName) Unmarshal

func (e *SubjectAltName) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

type SubjectKeyIdentifier

type SubjectKeyIdentifier struct {
	Critical bool
	ID       []byte
}

SubjectKeyIdentifier represents an X509 subject key identifier extension as defined in RFC 5280 section 4.2.1.2.

func (SubjectKeyIdentifier) Marshal

func (e SubjectKeyIdentifier) Marshal() (pkix.Extension, error)

Marshal returns a pkix.Extension.

func (*SubjectKeyIdentifier) Unmarshal

func (e *SubjectKeyIdentifier) Unmarshal(ext pkix.Extension) error

Unmarshal parses a pkix.Extension and stores the result in the object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL