tlshandler

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientTLSConf

func ClientTLSConf(caPems ...CAPem) (clientTLSConf *tls.Config)

func ExampleCACert

func ExampleCACert(ca_data CertData) (CA_X509 x509.Certificate)

func ExampleTLSCert

func ExampleTLSCert(ca_data CertData) (CA_X509 x509.Certificate)

func GetSubject

func GetSubject(cd CertData) pkix.Name

func ServerTLSConf

func ServerTLSConf(serverCert tls.Certificate) (serverTLSConf *tls.Config)

Types

type CAPem

type CAPem struct {
	X509       x509.Certificate `json:"x509"`
	PrivKey    *rsa.PrivateKey  `json:"priv_key"`
	Cert       []byte           `json:"ca"`
	PEM        []byte           `json:"pem"`
	PrivKeyPEM []byte           `json:"priv_key_pem"`
}

func GenerateCAPem

func GenerateCAPem(X509_ x509.Certificate) (caPem CAPem, err error)

type CertData

type CertData struct {
	Organization  string         `json:"organisation"`
	Country       string         `json:"country"`
	Province      string         `json:"province"`
	Locality      string         `json:"locality"`
	StreetAddress string         `json:"street_address"`
	PostalCode    string         `json:"postal_code"`
	NotAfter      NotAfterStruct `json:"add_date"`
	IPAddrresses  []net.IP       `json:"ip_addresses"`
}

type NotAfterStruct

type NotAfterStruct struct {
	Years  int `json:"years"`
	Months int `json:"months"`
	Days   int `json:"days"`
}

type TLSCert

type TLSCert struct {
	CAPem

	TlsCert tls.Certificate `json:"tls_cert"`
}

func GenerateTLSCert

func GenerateTLSCert(ca_pem *CAPem, X509_ x509.Certificate) (tls_cert *TLSCert, err error)

Jump to

Keyboard shortcuts

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