factory

package
v0.0.0-...-e1aa8c7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SoftwareBasedFactoryName is the name of the factory of the software-based CSP implementation
	SoftwareBasedFactoryName = "SW"
)

Variables

This section is empty.

Functions

func GetCSPFromOpts

func GetCSPFromOpts(config *FactoryOpts) (csp.CSP, error)

GetCSPFromOpts returns a CSP created according to the options passed in input.

func GetDefault

func GetDefault() csp.CSP

GetDefault returns a non-ephemeral (long-term) CSP

func InitFactories

func InitFactories(config *FactoryOpts) error

InitFactories must be called before using factory interfaces It is acceptable to call with config = nil, in which case some defaults will get used Error is returned only if defaultCSP cannot be found

Types

type CSPFactory

type CSPFactory interface {

	// Name returns the name of this factory
	Name() string

	// Get returns an instance of CSP using opts.
	Get(opts *FactoryOpts) (csp.CSP, error)
}

CSPFactory is used to get instances of the CSP interface. A Factory has name used to address it.

type DummyKeystoreOpts

type DummyKeystoreOpts struct{}

type FactoryOpts

type FactoryOpts struct {
	ProviderName string  `mapstructure:"default" json:"default" yaml:"Default"`
	SwOpts       *SwOpts `mapstructure:"SW,omitempty" json:"SW,omitempty" yaml:"SwOpts"`
}

FactoryOpts holds configuration information used to initialize factory implementations

func GetDefaultOpts

func GetDefaultOpts() *FactoryOpts

GetDefaultOpts offers a default implementation for Opts returns a new instance every time

func (*FactoryOpts) FactoryName

func (o *FactoryOpts) FactoryName() string

FactoryName returns the name of the provider

type FileKeystoreOpts

type FileKeystoreOpts struct {
	KeyStorePath string `mapstructure:"keystore" yaml:"KeyStore"`
}

Pluggable Keystores, could add JKS, P12, etc..

type InmemKeystoreOpts

type InmemKeystoreOpts struct{}

InmemKeystoreOpts - empty, as there is no config for the in-memory keystore

type SWFactory

type SWFactory struct{}

SWFactory is the factory of the software-based CSP.

func (*SWFactory) Get

func (f *SWFactory) Get(config *FactoryOpts) (csp.CSP, error)

Get returns an instance of CSP using Opts.

func (*SWFactory) Name

func (f *SWFactory) Name() string

Name returns the name of this factory

type SwOpts

type SwOpts struct {
	// Default algorithms when not specified (Deprecated?)
	SecLevel   int    `mapstructure:"security" json:"security" yaml:"Security"`
	HashFamily string `mapstructure:"hash" json:"hash" yaml:"Hash"`

	// Keystore Options
	Ephemeral     bool               `mapstructure:"tempkeys,omitempty" json:"tempkeys,omitempty"`
	FileKeystore  *FileKeystoreOpts  `mapstructure:"filekeystore,omitempty" json:"filekeystore,omitempty" yaml:"FileKeyStore"`
	DummyKeystore *DummyKeystoreOpts `mapstructure:"dummykeystore,omitempty" json:"dummykeystore,omitempty"`
	InmemKeystore *InmemKeystoreOpts `mapstructure:"inmemkeystore,omitempty" json:"inmemkeystore,omitempty"`
}

SwOpts contains options for the SWFactory

Jump to

Keyboard shortcuts

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