tls

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertAsBytes

func CertAsBytes(cert *x509.Certificate) (b []byte, err error)

func CertMatchesParams

func CertMatchesParams(key *rsa.PrivateKey, cert *x509.Certificate, params *CertParams) bool

CertMatchesParams returns true if the given key and cert match the CertParams struct.

func NewCA

func NewCA(cn string) (*rsa.PrivateKey, *x509.Certificate, error)

NewCA returns a new rsa.PrivateKey and x509.Certificate for a CA corresponding to the given CommonName.

func NewCert

func NewCert(p *CertParams) (*rsa.PrivateKey, *x509.Certificate, error)

NewCert returns a new rsa.PrivateKey and x509.Certificate for a certificate corresponding to the given CertParams struct.

func NewPrivateKey

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

NewPrivateKey returns a new 2048-bit rsa.PrivateKey

func ParseCert

func ParseCert(b []byte) (*x509.Certificate, error)

func ParsePrivateKey

func ParsePrivateKey(b []byte) (*rsa.PrivateKey, error)

func PrivateKeyAsBytes

func PrivateKeyAsBytes(key *rsa.PrivateKey) (b []byte, err error)

func PublicKeyAsBytes

func PublicKeyAsBytes(key *rsa.PublicKey) (b []byte, err error)

func SSHPublicKeyAsString

func SSHPublicKeyAsString(key *rsa.PublicKey) (s string, err error)

Types

type CertParams

type CertParams struct {
	Subject     pkix.Name
	DNSNames    []string
	IPAddresses []net.IP
	ExtKeyUsage []x509.ExtKeyUsage
	SigningKey  *rsa.PrivateKey   // leave nil for self-signed
	SigningCert *x509.Certificate // leave nil for self-signed
}

CertParams defines the parameters which can be passed into NewCert.

Jump to

Keyboard shortcuts

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