tlshandler

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinHandler

func GinHandler(router *gin.Engine, server_cert *CertSetup, httpAddr string) (err ftp_context.LogErr)

func LoadCert

func LoadCert(name string, directory string, cert *CertSetup) (err ftp_context.LogErr)

func TLSClient

func TLSClient(caPEMs ...*bytes.Buffer) (tc *http.Client)

Types

type CertData

type CertData struct {
	ftp_filehandler.FileBasic
	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 CertSetup

type CertSetup struct {
	ftp_filehandler.FileBasic

	CertData   *CertData       `json:"cert_data"`
	PrivKey    *rsa.PrivateKey `json:"private_key"`
	PEM        *bytes.Buffer   `json:"pem"`
	PrivKeyPEM *bytes.Buffer   `json:"private_key_pem"`
	TlsCert    *TlsCertJson    `json:"tls_cert"`
	// contains filtered or unexported fields
}

func NewCA

func NewCA(org *CertData) (cs *CertSetup)

set up our CA certificate

func (CertSetup) Error

func (cs CertSetup) Error() string

func (CertSetup) HasErr

func (cs CertSetup) HasErr() bool

func (CertSetup) NewServerCert

func (c_a CertSetup) NewServerCert(org *CertData) (cs *CertSetup)

func (CertSetup) ServerTlsConfig

func (cs CertSetup) ServerTlsConfig() (tlc *tls.Config, err error)

func (CertSetup) UnderlyingError

func (cs CertSetup) UnderlyingError() error

type NotAfterStruct

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

type TlsCertJson added in v0.3.3

type TlsCertJson struct {
	tls.Certificate
	Cert [][]byte `json:"certificate"`
	// PrivateKey contains the private key corresponding to the public key in
	// Leaf. This must implement crypto.Signer with an RSA, ECDSA or Ed25519 PublicKey.
	// For a server up to TLS 1.2, it can also implement crypto.Decrypter with
	// an RSA PublicKey.
	PrivKey crypto.PrivateKey `json:"private_key"`
	// SupportedSignatureAlgorithms is an optional list restricting what
	// signature algorithms the PrivateKey can be used for.
	SSA []tls.SignatureScheme `json:"supported_signature_algorithms"`
	// OCSPStaple contains an optional OCSP response which will be served
	// to clients that request it.
	OCSPS []byte `json:"OCSP_staple"`
	// SignedCertificateTimestamps contains an optional list of Signed
	// Certificate Timestamps which will be served to clients that request it.
	SCT [][]byte `json:"signed_certificate_timestamps"`
	// Leaf is the parsed form of the leaf certificate, which may be initialized
	// using x509.ParseCertificate to reduce per-handshake processing. If nil,
	// the leaf certificate will be parsed as needed.
	L *x509.Certificate `json:"leaf"`
}

func NewTlsCertJson added in v0.3.3

func NewTlsCertJson(tlc tls.Certificate) *TlsCertJson

Jump to

Keyboard shortcuts

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