Documentation
¶
Index ¶
- func JKSKeyStore(certKey *CertKey, password string) []byte
- func JKSTrustStore(certKeys []*CertKey, password string) []byte
- type CertKey
- func (ck *CertKey) CertificatePEM() []byte
- func (ck *CertKey) Client(clientCert *CertKey) *http.Client
- func (ck *CertKey) ClientTLSConf(clientCert *CertKey) *tls.Config
- func (ck *CertKey) PrivateKeyPEM() []byte
- func (ck *CertKey) ServerTLSConf(clientCA *CertKey) *tls.Config
- func (ck *CertKey) StartServer(handler http.Handler, clientCA *CertKey) *httptest.Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JKSKeyStore ¶
func JKSTrustStore ¶
Types ¶
type CertKey ¶
type CertKey struct { Certificate *x509.Certificate PrivateKey *rsa.PrivateKey DERBytes []byte }
CertKey holds a certificate struct, private key and DER encoded bytes.
func New ¶
func New(template *x509.Certificate, signer *CertKey) *CertKey
New CertKey based on template and signed by signer, or self-signed if signer is nil.
func NewCert ¶
NewCert creates a dummy server cert signed by signer, or self-signed if signer is nil. The addrs list can contain strings (DNS names) or net.IP addresses, if addrs is empty will use "localhost", v4 and v6 loopback
func NewClient ¶
NewServer creates a dummy client cert signed by signer, or self-signed if signer is nil.
func (*CertKey) CertificatePEM ¶
func (*CertKey) Client ¶
Client returns a HTTP client using this cert as CA. If clientCert is not nil, client will authenticate with cert.
func (*CertKey) ClientTLSConf ¶
ClientTLSConf returns TLS configuration for a client using this cert as a CA. If clientCert is not nil, client will authenticate with cert.
func (*CertKey) PrivateKeyPEM ¶
func (*CertKey) ServerTLSConf ¶
ServerTLSConf returns TLS configuration for a server using this certificate. If clientCA is not nil, we also enable client authentication using clientCA.