const (
// PluginFactoryName is the factory name for BCCSP plugins
PluginFactoryName = "PLUGIN"
)
const (
// SoftwareBasedFactoryName is the name of the factory of the software-based BCCSP implementation
SoftwareBasedFactoryName = "SW"
)
func GetBCCSP(name string) (bccsp.BCCSP, error)
GetBCCSP returns a BCCSP created according to the options passed in input.
func GetBCCSPFromOpts(config *FactoryOpts) (bccsp.BCCSP, error)
GetBCCSPFromOpts returns a BCCSP created according to the options passed in input.
func GetDefault() bccsp.BCCSP
GetDefault returns a non-ephemeral (long-term) BCCSP
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 defaultBCCSP cannot be found
BCCSPFactory is used to get instances of the BCCSP interface. A Factory has name used to address it.
type BCCSPFactory interface {
// Name returns the name of this factory
Name() string
// Get returns an instance of BCCSP using opts.
Get(opts *FactoryOpts) (bccsp.BCCSP, error)
}
type DummyKeystoreOpts struct{}
FactoryOpts holds configuration information used to initialize factory implementations
type FactoryOpts struct {
ProviderName string `mapstructure:"default" json:"default" yaml:"Default"`
SwOpts *SwOpts `mapstructure:"SW,omitempty" json:"SW,omitempty" yaml:"SwOpts"`
PluginOpts *PluginOpts `mapstructure:"PLUGIN,omitempty" json:"PLUGIN,omitempty" yaml:"PluginOpts"`
}
func GetDefaultOpts() *FactoryOpts
GetDefaultOpts offers a default implementation for Opts returns a new instance every time
func (o *FactoryOpts) FactoryName() string
FactoryName returns the name of the provider
Pluggable Keystores, could add JKS, P12, etc..
type FileKeystoreOpts struct {
KeyStorePath string `mapstructure:"keystore" yaml:"KeyStore"`
}
InmemKeystoreOpts - empty, as there is no config for the in-memory keystore
type InmemKeystoreOpts struct{}
PluginFactory is the factory for BCCSP plugins
type PluginFactory struct{}
func (f *PluginFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)
Get returns an instance of BCCSP using Opts.
func (f *PluginFactory) Name() string
Name returns the name of this factory
PluginOpts contains the options for the PluginFactory
type PluginOpts struct {
// Path to plugin library
Library string
// Config map for the plugin library
Config map[string]interface{}
}
SWFactory is the factory of the software-based BCCSP.
type SWFactory struct{}
func (f *SWFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)
Get returns an instance of BCCSP using Opts.
func (f *SWFactory) Name() string
Name returns the name of this factory
SwOpts contains options for the SWFactory
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"`
}