tls

package
v0.0.0-...-5efa5bd Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2017 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CAFile is the default ca file name
	CAFile = "ca.pem"
)

Variables

This section is empty.

Functions

func APIConfig

func APIConfig(caFile string, insecure bool) (*tls.Config, error)

APIConfig returns a tls.Config for the apiclient

func Fingerprint

func Fingerprint(b []byte) string

Fingerprint returns the sha256 hash of []byte

Types

type CertificateAuthority

type CertificateAuthority struct {
	// protects crl
	sync.RWMutex
	// contains filtered or unexported fields
}

CertificateAuthority is the server ca

CA represents the server's certificate authority

func NewCA

func NewCA(caDir, HTTPCert, HTTPKey string, serverNames []string) (ca *CertificateAuthority, err error)

NewCA returns a new server ca

func (*CertificateAuthority) Revoke

func (ca *CertificateAuthority) Revoke(serial string) error

Revoke revokes the provided certificate

func (*CertificateAuthority) ServerConfig

func (ca *CertificateAuthority) ServerConfig() (*tls.Config, error)

ServerConfig returns a tls.Config for the harkonn server

func (*CertificateAuthority) Sign

func (ca *CertificateAuthority) Sign(data []byte) (core.ClientCert, error)

Sign signs a csr

func (*CertificateAuthority) Verify

func (ca *CertificateAuthority) Verify(state tls.ConnectionState, host string) (string, error)

Verify verifies the client hostname and certificate revocation

func (*CertificateAuthority) WebConfig

func (ca *CertificateAuthority) WebConfig() (*tls.Config, error)

WebConfig returns a tls.Config for the http server

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client ca

func NewClient

func NewClient(master string) *Client

NewClient returns a new client ca

func (*Client) Config

func (c *Client) Config() (*tls.Config, error)

Config returns a tls.Config for the harkonn client

func (*Client) Csr

func (c *Client) Csr() ([]byte, error)

Csr generates a new or reads an existing csr

func (*Client) RemoveCA

func (c *Client) RemoveCA() error

RemoveCA deletes a ca certificate

func (*Client) RemoveCsr

func (c *Client) RemoveCsr() error

RemoveCsr deletes a csr

func (*Client) RemoveKey

func (c *Client) RemoveKey() error

RemoveKey deletes a key

func (*Client) RemovePem

func (c *Client) RemovePem() error

RemovePem deletes a pem certificate

func (*Client) Signed

func (c *Client) Signed() bool

Signed checks if the client has been signed

func (*Client) WriteCA

func (c *Client) WriteCA(b []byte) error

WriteCA writes a ca certificate to the file system

func (*Client) WritePem

func (c *Client) WritePem(b []byte) error

WritePem writes a pem certificate to the file system

Jump to

Keyboard shortcuts

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