selfca

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CertificateExpiredError     = errors.New("expired")
	CertificateInvalidDateError = errors.New("invalid date")
	CertificateIsNotCAError     = errors.New("certificate is not for CA")
	CertificateInvalidError     = errors.New("invalid")
)

Functions

func ValidateCACertificate

func ValidateCACertificate(cert *x509.Certificate, key crypto.PublicKey) error

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

CA type representation for a self-signed certificate authority

func NewCA

func NewCA(key crypto.Signer, cert *x509.Certificate) (*CA, error)

NewCA creates a new CA object for given CA certificate and private key. If both of caCert and key are nil, generates a new private key and a self-signed certificate

func (*CA) Certificate

func (ca *CA) Certificate() *x509.Certificate

Certificate returns root ca certificate used

func (*CA) EncodedCertificate

func (ca *CA) EncodedCertificate() []byte

EncodedCertificate returns encoded root ca certificate used

func (*CA) EncodedKey

func (ca *CA) EncodedKey() []byte

EncodedKey returns encoded private key used

func (*CA) PrivateKey

func (ca *CA) PrivateKey() crypto.Signer

PrivateKey returns private key used

func (*CA) Sign

func (ca *CA) Sign(csrPEM []byte, keyUsage x509.KeyUsage, extKeyUsage []x509.ExtKeyUsage) (*x509.Certificate, error)

Jump to

Keyboard shortcuts

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