factory

package
v1.0.0-preview Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: Apache-2.0 Imports: 7 Imported by: 4,863

Documentation

Overview

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. 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. 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. 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

Constants

View Source
const (
	// PKCS11BasedFactoryName is the name of the factory of the hsm-based BCCSP implementation
	PKCS11BasedFactoryName = "P11"
)
View Source
const (
	// SoftwareBasedFactoryName is the name of the factory of the software-based BCCSP implementation
	SoftwareBasedFactoryName = "SW"
)

Variables

This section is empty.

Functions

func GetBCCSP

func GetBCCSP(opts Opts) (bccsp.BCCSP, error)

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

func GetDefault

func GetDefault() (bccsp.BCCSP, error)

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

func GetDefaultOrPanic

func GetDefaultOrPanic() bccsp.BCCSP

GetDefaultOrPanic returns a non-ephemeral (long-term) BCCSP or panic if an error occurs.

Types

type BCCSPFactory

type BCCSPFactory interface {

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

	// Get returns an instance of BCCSP using opts.
	Get(opts Opts) (bccsp.BCCSP, error)
}

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

type DefaultOpts

type DefaultOpts struct {
	ProviderName  string
	EphemeralFlag bool
}

DefaultOpts offers a default implementation for Opts

func (*DefaultOpts) Ephemeral

func (o *DefaultOpts) Ephemeral() bool

Ephemeral returns true if the CSP has to be ephemeral, false otherwise

func (*DefaultOpts) FactoryName

func (o *DefaultOpts) FactoryName() string

FactoryName returns the name of the provider

type Opts

type Opts interface {

	// FactoryName returns the name of the factory to be used
	FactoryName() string

	// Ephemeral returns true if the BCCSP has to be ephemeral, false otherwise
	Ephemeral() bool
}

Opts contains options for instantiating BCCSPs.

type PKCS11Factory

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

PKCS11Factory is the factory of the HSM-based BCCSP.

func (*PKCS11Factory) Get

func (f *PKCS11Factory) Get(opts Opts) (bccsp.BCCSP, error)

Get returns an instance of BCCSP using Opts.

func (*PKCS11Factory) Name

func (f *PKCS11Factory) Name() string

Name returns the name of this factory

type PKCS11Opts

type PKCS11Opts struct {
	Ephemeral_ bool
	SecLevel   int
	HashFamily string
	KeyStore   bccsp.KeyStore
}

PKCS11Opts contains options for the P11Factory

func (*PKCS11Opts) Ephemeral

func (o *PKCS11Opts) Ephemeral() bool

Ephemeral returns true if the CSP has to be ephemeral, false otherwise

func (*PKCS11Opts) FactoryName

func (o *PKCS11Opts) FactoryName() string

FactoryName returns the name of the provider

type SWFactory

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

SWFactory is the factory of the software-based BCCSP.

func (*SWFactory) Get

func (f *SWFactory) Get(opts Opts) (bccsp.BCCSP, error)

Get returns an instance of BCCSP using Opts.

func (*SWFactory) Name

func (f *SWFactory) Name() string

Name returns the name of this factory

type SwOpts

type SwOpts struct {
	Ephemeral_ bool
	SecLevel   int
	HashFamily string
	KeyStore   bccsp.KeyStore
}

SwOpts contains options for the SWFactory

func (*SwOpts) Ephemeral

func (o *SwOpts) Ephemeral() bool

Ephemeral returns true if the CSP has to be ephemeral, false otherwise

func (*SwOpts) FactoryName

func (o *SwOpts) FactoryName() string

FactoryName returns the name of the provider

Jump to

Keyboard shortcuts

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