cert

package
v0.0.0-...-cab4146 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KeyUsageChoices is a set of string choices that map to the
	// X509 key usage representation
	KeyUsageChoices map[string]x509.KeyUsage

	// ExtKeyUsageChoices is a set of string choices that map to the
	// X509 extended key usage representation
	ExtKeyUsageChoices map[string]x509.ExtKeyUsage
)

Functions

func GenerateX509Certificate

func GenerateX509Certificate(c *X509Simplified, parent *x509.Certificate, publicKey *rsa.PrivateKey, signingKey *rsa.PrivateKey) ([]byte, error)

GenerateX509Certificate using the passed parameters

func GenerateX509SelfSignedCertificate

func GenerateX509SelfSignedCertificate(c *X509Simplified, key *rsa.PrivateKey) ([]byte, error)

GenerateX509SelfSignedCertificate takes a simplified x509 definition and an RSA key, and generates a certificate

func ReadPEM

func ReadPEM(cert []byte) (*x509.Certificate, error)

ReadPEM reads a certificate from PEM format

func StringToDNSAddressList

func StringToDNSAddressList(dnsList string) []string

StringToDNSAddressList transforms a comma separated list of strings into an array

func StringToExtKeyUsage

func StringToExtKeyUsage(extKeyUsage string) ([]x509.ExtKeyUsage, error)

StringToExtKeyUsage converts a string array into an extended key usage type

func StringToIPAddressList

func StringToIPAddressList(ipList string) ([]net.IP, error)

StringToIPAddressList transforms a comma separated list of strings into an IP array

func StringToKeyUsage

func StringToKeyUsage(keyUsage string) (x509.KeyUsage, error)

StringToKeyUsage converts a string array into a key usage type

func WritePEM

func WritePEM(cert []byte) (string, error)

WritePEM serializes the certificate into a PEM string

Types

type Subject

type Subject struct {
	CommonName         string
	Organization       string
	OrganizationalUnit string
}

Subject for x509 certificate

type X509Simplified

type X509Simplified struct {
	Subject     *Subject
	Serial      *big.Int
	NotBefore   time.Time
	NotAfter    time.Time
	DNSNames    []string
	IPAddresses []net.IP
	IsCA        bool
	KeyUsage    x509.KeyUsage
	ExtKeyUsage []x509.ExtKeyUsage
}

X509Simplified simplified

Jump to

Keyboard shortcuts

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