sconn

package module
v0.0.0-...-c556cf2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: MIT Imports: 24 Imported by: 0

README

sconn

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Files

func Files(dir string, files []string, f func() ([][]byte, error)) ([][]byte, error)

func Hash

func Hash(conn *tls.Conn) string

TODO: keep in mind we only hash verified chains here - test it if using more than one segment!

func VerifyCertificate

func VerifyCertificate(cert []byte, ca []byte, i ...[]byte) error

Types

type Config

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

CA holds the

func NewConfig

func NewConfig() *Config

func (*Config) Build

func (cfg *Config) Build() (*Config, error)

Build configuration.

func (*Config) Dial

func (cfg *Config) Dial(addr string) (*tls.Conn, error)

func (*Config) Listen

func (cfg *Config) Listen(addr string, handler func(conn *tls.Conn)) (*Listener, error)

func (*Config) Present

func (cfg *Config) Present(certPEMBlock []byte, keyPEMBlock []byte) *Config

Present a Certificate.

func (*Config) Trust

func (cfg *Config) Trust(certPEMBlock []byte) *Config

Trust a CA Certificate.

func (*Config) Tunnel

func (cfg *Config) Tunnel(addr string, handler func(conn *tls.Conn)) (*Tunnel, error)

type EcdsaCurve

type EcdsaCurve string
const (
	EcdsaCurveP224 EcdsaCurve = "P224"
	EcdsaCurveP256 EcdsaCurve = "P256"
	EcdsaCurveP384 EcdsaCurve = "P384"
	EcdsaCurveP521 EcdsaCurve = "P521"
)

type KeyType

type KeyType int
const (
	Server         KeyType = 0
	Client         KeyType = 1
	ServerClient   KeyType = 2
	ServerCA       KeyType = 3
	ClientCA       KeyType = 4
	ServerClientCA KeyType = 5
)

type Keygen

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

func NewKeygenECDSA

func NewKeygenECDSA(ecdsaCurve EcdsaCurve) *Keygen

func NewKeygenRSA

func NewKeygenRSA(rsaBits int) *Keygen

func (*Keygen) Generate

func (kg *Keygen) Generate(t KeyType, serial *big.Int, subject pkix.Name, validFrom time.Time, validFor time.Duration) ([]byte, []byte, error)

func (*Keygen) SetCaCert

func (kg *Keygen) SetCaCert(certPEMBlock []byte, keyPEMBlock []byte) error

type Listener

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

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

type Profile

type Profile struct {
	Host   string
	Blocks [][]byte
}

func ParseProfile

func ParseProfile(b []byte) (*Profile, error)

func (Profile) Encode

func (p Profile) Encode() []byte

type Registry

type Registry struct {
	UniqueCN bool             `json:"unique"`
	Counter  int              `json:"counter"`
	Certs    []*RegistryEntry `json:"certs"`
	// contains filtered or unexported fields
}

func LoadRegistry

func LoadRegistry(dir string, organization string, uniqueCN bool) (*Registry, error)

func (*Registry) Add

func (reg *Registry) Add(certPEMBlock []byte) error

func (*Registry) CertificatePool

func (reg *Registry) CertificatePool() (*x509.CertPool, error)

get a pool with all loadable certificates

func (*Registry) Certificates

func (reg *Registry) Certificates() ([]*x509.Certificate, error)

get list of all certificates

func (*Registry) Entries

func (reg *Registry) Entries() []*RegistryEntry

GetEntries of registry.

func (*Registry) Generate

func (reg *Registry) Generate() (*big.Int, error)

func (*Registry) Revoke

func (reg *Registry) Revoke(serial []byte) error

type RegistryEntry

type RegistryEntry struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Serial  []byte `json:"serial"`
	Revoked bool   `json:"revoked,omitempty"`
}

func (*RegistryEntry) FileName

func (entry *RegistryEntry) FileName() string

type Tunnel

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

func (*Tunnel) Close

func (tun *Tunnel) Close() error

Jump to

Keyboard shortcuts

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