identity

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 9 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadKey

func LoadKey(keyAddr string) (crypto.PrivateKey, error)

Types

type ID

type ID struct {
	IdentityConfig
	// contains filtered or unexported fields
}

func (*ID) CA

func (id *ID) CA() *x509.CertPool

func (*ID) Cert

func (id *ID) Cert() *tls.Certificate

func (*ID) ClientTLSConfig

func (i *ID) ClientTLSConfig() *tls.Config

func (*ID) ServerCert

func (id *ID) ServerCert() *tls.Certificate

func (*ID) ServerTLSConfig

func (i *ID) ServerTLSConfig() *tls.Config

type Identity

type Identity interface {
	Cert() *tls.Certificate
	ServerCert() *tls.Certificate
	CA() *x509.CertPool
	ServerTLSConfig() *tls.Config
	ClientTLSConfig() *tls.Config
}

func LoadIdentity

func LoadIdentity(cfg IdentityConfig) (Identity, error)

type IdentityConfig

type IdentityConfig struct {
	Key        string `json:"key" yaml:"key" mapstructure:"key"`
	Cert       string `json:"cert" yaml:"cert" mapstructure:"cert"`
	ServerCert string `json:"server_cert,omitempty" yaml:"server_cert,omitempty" mapstructure:"server_cert,omitempty"`
	ServerKey  string `json:"server_key,omitempty" yaml:"server_key,omitempty" mapstructure:"server_key,omitempty"`
	CA         string `json:"ca,omitempty" yaml:"ca,omitempty" mapstructure:"ca"`
}

type TokenId

type TokenId struct {
	Id    Identity
	Token string
	Data  map[uint32][]byte
}

func LoadClientIdentity

func LoadClientIdentity(certPath, keyPath, caCertPath string) (*TokenId, error)

func LoadServerIdentity

func LoadServerIdentity(clientCertPath, serverCertPath, keyPath, caCertPath string) (*TokenId, error)

func NewIdentity

func NewIdentity(id Identity) *TokenId

func (*TokenId) ClientTLSConfig

func (i *TokenId) ClientTLSConfig() *tls.Config

func (*TokenId) ServerTLSConfig

func (i *TokenId) ServerTLSConfig() *tls.Config

func (*TokenId) ShallowCloneWithNewToken

func (i *TokenId) ShallowCloneWithNewToken(token string) *TokenId

Jump to

Keyboard shortcuts

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