cert

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blocks2Certs

func Blocks2Certs(blocks []*pem.Block) ([]*x509.Certificate, error)

func ParseCsrPem

func ParseCsrPem(csrPem []byte) (*x509.CertificateRequest, error)

func PemChain2Blocks

func PemChain2Blocks(pemBuff string) ([]*pem.Block, error)

func RawToPem

func RawToPem(raw []byte) ([]byte, error)

Types

type CertPem

type CertPem struct {
	Cert *x509.Certificate
	Pem  []byte
}

type ClientSigner

type ClientSigner struct {
	SerialGenerator SerialGenerator
	// contains filtered or unexported fields
}

func NewClientSigner

func NewClientSigner(caCert *x509.Certificate, caKey crypto.PrivateKey) *ClientSigner

func (*ClientSigner) Cert

func (s *ClientSigner) Cert() *x509.Certificate

func (*ClientSigner) SignCsr

func (s *ClientSigner) SignCsr(csr *x509.CertificateRequest, opts *SigningOpts) ([]byte, error)

func (*ClientSigner) Signer

func (s *ClientSigner) Signer() crypto.Signer

func (*ClientSigner) SigningCert

func (s *ClientSigner) SigningCert() *x509.Certificate

type DefaultSerialGenerator

type DefaultSerialGenerator struct{}

func (DefaultSerialGenerator) Generate

func (DefaultSerialGenerator) Generate() *big.Int

type FingerprintGenerator

type FingerprintGenerator interface {
	FromCert(cert *x509.Certificate) string
	FromCerts(certs []*x509.Certificate) Fingerprints
	FromRaw(raw []byte) string
	FromPem(pem []byte) string
}

func NewFingerprintGenerator

func NewFingerprintGenerator() FingerprintGenerator

type Fingerprints

type Fingerprints map[string]*x509.Certificate

func (Fingerprints) Contains

func (fingerprints Fingerprints) Contains(fp string) bool

func (Fingerprints) HasAny

func (fingerprints Fingerprints) HasAny(fps []string) (string, bool)

func (Fingerprints) Prints

func (fingerprints Fingerprints) Prints() []string

type SerialGenerator

type SerialGenerator interface {
	Generate() *big.Int
}

type ServerSigner

type ServerSigner struct {
	SerialGenerator SerialGenerator
	// contains filtered or unexported fields
}

func NewServerSigner

func NewServerSigner(caCert *x509.Certificate, caKey crypto.PrivateKey) *ServerSigner

func (*ServerSigner) Cert

func (s *ServerSigner) Cert() *x509.Certificate

func (*ServerSigner) SignCsr

func (s *ServerSigner) SignCsr(csr *x509.CertificateRequest, opts *SigningOpts) ([]byte, error)

func (*ServerSigner) Signer

func (s *ServerSigner) Signer() crypto.Signer

func (*ServerSigner) SigningCert

func (s *ServerSigner) SigningCert() *x509.Certificate

type SignFunc

type SignFunc func([]byte, *SigningOpts) ([]byte, error)

type Signer

type Signer interface {
	SignCsr(*x509.CertificateRequest, *SigningOpts) ([]byte, error)
	SigningCert() *x509.Certificate

	Cert() *x509.Certificate
	Signer() crypto.Signer
}

type SigningOpts

type SigningOpts struct {
	// Subject Alternate Name values.
	DNSNames       []string
	EmailAddresses []string
	IPAddresses    []net.IP
	URIs           []*url.URL

	NotBefore *time.Time
	NotAfter  *time.Time
}

func (*SigningOpts) Apply

func (so *SigningOpts) Apply(c *x509.Certificate)

Jump to

Keyboard shortcuts

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