certs

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrivateKeyBlockType is a possible value for pem.Block.Type.
	PrivateKeyBlockType = "PRIVATE KEY"
	// PublicKeyBlockType is a possible value for pem.Block.Type.
	PublicKeyBlockType = "PUBLIC KEY"
	// CertificateBlockType is a possible value for pem.Block.Type.
	CertificateBlockType = "CERTIFICATE"
	// RSAPrivateKeyBlockType is a possible value for pem.Block.Type.
	RSAPrivateKeyBlockType = "RSA PRIVATE KEY"
)

Variables

This section is empty.

Functions

func CertOrKeyExist

func CertOrKeyExist(pkiPath, name string) bool

func EncodeCertPEM

func EncodeCertPEM(cert *x509.Certificate) []byte

func EncodePrivateKeyPEM

func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte

func EncodePublicKeyPEM

func EncodePublicKeyPEM(key crypto.PublicKey) []byte

func GetAltNames

func GetAltNames(SANs []string, certName string) *certutil.AltNames

func HasServerAuth

func HasServerAuth(cert *x509.Certificate) bool

HasServerAuth returns true if the given certificate is a ServerAuth

func NewCertAndKey

func NewCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, config *Config) (*x509.Certificate, *rsa.PrivateKey)

creates new certificate and key by passing the certificate authority certificate and key

func NewCertificate

func NewCertificate(key *rsa.PrivateKey, config *Config) *x509.Certificate

func NewCertificateAuthority

func NewCertificateAuthority(config *Config) (cert *x509.Certificate, key *rsa.PrivateKey)

creates new certificate and private key for the certificate authority

func NewPrivateKey

func NewPrivateKey() *rsa.PrivateKey

func NewSignedCert

func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) *x509.Certificate

NewSignedCert creates a signed certificate using the given CA certificate and key

func PathsForCertAndKey

func PathsForCertAndKey(pkiPath, name string) (string, string)

func TryLoadCertAndKeyFromDisk

func TryLoadCertAndKeyFromDisk(pkiPath, name string) (*x509.Certificate, *rsa.PrivateKey)

func TryLoadCertFromDisk

func TryLoadCertFromDisk(pkiPath, name string) *x509.Certificate

TryLoadCertFromDisk tries to load the cert from the disk and validates that it is valid

func TryLoadPrivateKeyFromDisk

func TryLoadPrivateKeyFromDisk(pkiPath, name string) *rsa.PrivateKey

tries to load the key from the disk and validates that it is valid

func TryLoadPrivatePublicKeyFromDisk

func TryLoadPrivatePublicKeyFromDisk(pkiPath, name string) (*rsa.PrivateKey, *rsa.PublicKey)

func TryLoadPublicKeyFromDisk

func TryLoadPublicKeyFromDisk(pkiPath, name string) *rsa.PublicKey

func WriteCert

func WriteCert(pkiPath, name string, cert *x509.Certificate)

WriteCert stores the given certificate at the given location

func WriteCertAndKey

func WriteCertAndKey(pkiPath string, name string, cert *x509.Certificate, key *rsa.PrivateKey)

func WriteKey

func WriteKey(pkiPath, name string, key *rsa.PrivateKey)

func WritePublicKey

func WritePublicKey(pkiPath, name string, key crypto.PublicKey)

Types

type Config

type Config struct {
	*certutil.Config
	CertificateValidity time.Duration
}

func NewConfig

func NewConfig(commonName string) *Config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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