tlsutil

package
v1.6.2-tectonic.1-rc.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSAKeySize   = 2048
	Duration365d = time.Hour * 24 * 365
)

Certificate and key constants.

Variables

This section is empty.

Functions

func EncodeCertificatePEM

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

EncodeCertificatePEM returns encoded bytes for the given Certificate.

func EncodePrivateKeyPEM

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

EncodePrivateKeyPEM returns encoded bytes of the given private key.

func NewClientCertificate

func NewClientCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey, customDuration *time.Duration) (*x509.Certificate, error)

NewClientCertificate returns a new x509 client certificate, signed by the CA with the given certificate and key.

func NewPrivateKey

func NewPrivateKey() (*rsa.PrivateKey, error)

NewPrivateKey returns a new private key.

func NewServerCertificate

func NewServerCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey, customDuration *time.Duration) (*x509.Certificate, error)

NewServerCertificate returns a new x509 server certificate, signed by the CA with the given certificate and key.

func ParsePEMEncodedCert

func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)

ParsePEMEncodedCert parses raw certificate bytes and returns an x509 Certificate.

func ParsePEMEncodedPrivateKey

func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)

ParsePEMEncodedPrivateKey parses raw private keys and returns a private key.

Types

type AltNames

type AltNames struct {
	DNSNames []string
	IPs      []net.IP
}

AltNames represent TLS Subject Alternative Names.

type CertConfig

type CertConfig struct {
	CommonName   string
	Organization []string
	AltNames     AltNames
}

CertConfig is the TLS distinguished name configuration.

Jump to

Keyboard shortcuts

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