tls

package
v10.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 14 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertAsBytes

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

func CertChainAsBytes

func CertChainAsBytes(certs []*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)

ParseCert takes certificate as bytes and returns x509.Certificate

func ParseCertChain

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

ParseCertChain takes certificate as bytes and returns slice of all x509.Certificate

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)

func UniqueCert

func UniqueCert(certs []*x509.Certificate) []*x509.Certificate

UniqueCert takes slice of the certificate and returns certificate slice with unique values

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