inkcert

package module
v0.0.0-...-6cd758a Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Organization  string
	Country       string
	Province      string
	Locality      string
	StreetAddress string
	PostalCode    string
}

type Server

type Server struct {
	CAPrivateKey   *ecdsa.PrivateKey
	CADer          []byte
	CA             *x509.Certificate
	ClientRandSeed [32]byte
	Client         map[string]*tls.Certificate
	sync.RWMutex
}

func NewServer

func NewServer(rand io.Reader, info *Info) *Server

NewServer creates the certificates using the given rand

func NewServerDeterministic

func NewServerDeterministic(seed []byte, info *Info) *Server

NewServerDeterministic creates the certificate with an deterministic key, it always creates the same certificate/key using the same `seed`.

func (*Server) CreateClientCertDomain

func (s *Server) CreateClientCertDomain(u *url.URL) (*tls.Certificate, error)

func (*Server) CreateClientCertIP

func (s *Server) CreateClientCertIP(ip net.IP) (*tls.Certificate, error)

func (*Server) TLSGetCertificate

func (s *Server) TLSGetCertificate(info *tls.ClientHelloInfo) (*tls.Certificate, error)

It's supposed to be used inside the `TLSConfig` as such:

 CERTSERVER := inkcert.NewServer(nil, nil)
 http.Server{
	   TLSConfig: &tls.Config{
			GetCertificate: CERTSERVER.TLSGetCertificate,
	   }

Jump to

Keyboard shortcuts

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