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. 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. 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
- Variables
- func GetBCCSP(name string) (bccsp.BCCSP, error)
- func GetBCCSPFromOpts(config *FactoryOpts) (bccsp.BCCSP, error)
- func GetDefault() bccsp.BCCSP
- func InitFactories(config *FactoryOpts) error
- type BCCSPFactory
- type DummyKeystoreOpts
- type FactoryOpts
- type FileKeystoreOpts
- type PKCS11Factory
- type SWFactory
- type SwOpts
Constants ¶
const (
// PKCS11BasedFactoryName is the name of the factory of the hsm-based BCCSP implementation
PKCS11BasedFactoryName = "PKCS11"
)
const (
// SoftwareBasedFactoryName is the name of the factory of the software-based BCCSP implementation
SoftwareBasedFactoryName = "SW"
)
Variables ¶
var DefaultOpts = FactoryOpts{ ProviderName: "SW", SwOpts: &SwOpts{ HashFamily: "SHA2", SecLevel: 256, Ephemeral: true, }, }
DefaultOpts offers a default implementation for Opts
Functions ¶
func GetBCCSP ¶
GetBCCSP returns a BCCSP created according to the options passed in input.
func GetBCCSPFromOpts ¶
func GetBCCSPFromOpts(config *FactoryOpts) (bccsp.BCCSP, error)
GetBCCSPFromOpts returns a BCCSP created according to the options passed in input.
func GetDefault ¶
GetDefault returns a non-ephemeral (long-term) BCCSP
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 defaultBCCSP cannot be found
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 *FactoryOpts) (bccsp.BCCSP, error) }
BCCSPFactory is used to get instances of the BCCSP 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"` Pkcs11Opts *pkcs11.PKCS11Opts `mapstructure:"PKCS11,omitempty" json:"PKCS11,omitempty" yaml:"PKCS11"` }
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 PKCS11Factory ¶
type PKCS11Factory struct{}
PKCS11Factory is the factory of the HSM-based BCCSP.
func (*PKCS11Factory) Get ¶
func (f *PKCS11Factory) Get(config *FactoryOpts) (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 SWFactory ¶
type SWFactory struct{}
SWFactory is the factory of the software-based BCCSP.
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"` }
SwOpts contains options for the SWFactory