fabric: github.com/hyperledger/fabric/bccsp/factory Index | Files

package factory

import "github.com/hyperledger/fabric/bccsp/factory"

Copyright IBM Corp. 2016 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright IBM Corp. 2017 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright IBM Corp. 2016 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. 2016 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Package Files

factory.go nopkcs11.go opts.go pluginfactory.go swfactory.go

Constants

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 Uses

func GetBCCSP(name string) (bccsp.BCCSP, error)

GetBCCSP returns a BCCSP created according to the options passed in input.

func GetBCCSPFromOpts Uses

func GetBCCSPFromOpts(config *FactoryOpts) (bccsp.BCCSP, error)

GetBCCSPFromOpts returns a BCCSP created according to the options passed in input.

func GetDefault Uses

func GetDefault() bccsp.BCCSP

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

func InitFactories Uses

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

type BCCSPFactory Uses

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)
}

BCCSPFactory is used to get instances of the BCCSP interface. A Factory has name used to address it.

type DummyKeystoreOpts Uses

type DummyKeystoreOpts struct{}

type FactoryOpts Uses

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"`
}

FactoryOpts holds configuration information used to initialize factory implementations

func GetDefaultOpts Uses

func GetDefaultOpts() *FactoryOpts

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

func (*FactoryOpts) FactoryName Uses

func (o *FactoryOpts) FactoryName() string

FactoryName returns the name of the provider

type FileKeystoreOpts Uses

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

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

type InmemKeystoreOpts Uses

type InmemKeystoreOpts struct{}

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

type PluginFactory Uses

type PluginFactory struct{}

PluginFactory is the factory for BCCSP plugins

func (*PluginFactory) Get Uses

func (f *PluginFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)

Get returns an instance of BCCSP using Opts.

func (*PluginFactory) Name Uses

func (f *PluginFactory) Name() string

Name returns the name of this factory

type PluginOpts Uses

type PluginOpts struct {
    // Path to plugin library
    Library string
    // Config map for the plugin library
    Config map[string]interface{}
}

PluginOpts contains the options for the PluginFactory

type SWFactory Uses

type SWFactory struct{}

SWFactory is the factory of the software-based BCCSP.

func (*SWFactory) Get Uses

func (f *SWFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)

Get returns an instance of BCCSP using Opts.

func (*SWFactory) Name Uses

func (f *SWFactory) Name() string

Name returns the name of this factory

type SwOpts Uses

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

Package factory imports 9 packages (graph) and is imported by 52 packages. Updated 2019-03-15. Refresh now. Tools for package owners.