tlsutil

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSAKeySize = 2048
)

Variables

View Source
var (
	Duration365d = time.Hour * 24 * 365
)

Functions

func DecodeCertificatePEM

func DecodeCertificatePEM(data []byte) (*x509.Certificate, error)

func DecodeCertificatesPEM added in v0.11.0

func DecodeCertificatesPEM(data []byte) ([]*x509.Certificate, error)

func DecodePrivateKeyPEM

func DecodePrivateKeyPEM(data []byte) (*rsa.PrivateKey, error)

func EncodeCertificatePEM

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

func EncodePrivateKeyPEM

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

func IsCertificatePEM added in v0.11.0

func IsCertificatePEM(data []byte) bool

func NewPrivateKey

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

func NewSelfSignedCACertificate

func NewSelfSignedCACertificate(cfg CACertConfig, key *rsa.PrivateKey) (*x509.Certificate, error)

func NewSignedClientCertificate

func NewSignedClientCertificate(cfg ClientCertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)

func NewSignedKIAMCertificate added in v0.9.10

func NewSignedKIAMCertificate(cfg ClientCertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)

func NewSignedServerCertificate

func NewSignedServerCertificate(cfg ServerCertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)

Types

type CACertConfig

type CACertConfig struct {
	CommonName   string
	Organization string
	Duration     time.Duration
}

type ClientCertConfig

type ClientCertConfig struct {
	CommonName   string
	Organization []string
	DNSNames     []string
	IPAddresses  []string
	Duration     time.Duration
}

type ServerCertConfig

type ServerCertConfig struct {
	CommonName  string
	DNSNames    []string
	IPAddresses []string
	Duration    time.Duration
}

Jump to

Keyboard shortcuts

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