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.
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.
Index ¶
- func AESCBCPKCS7Decrypt(key, src []byte) ([]byte, error)
- func AESCBCPKCS7Encrypt(key, src []byte) ([]byte, error)
- func GetRandomBytes(len int) ([]byte, error)
- func InitPKCS11(lib, pin, label string) error
- func New(securityLevel int, hashFamily string, keyStore bccsp.KeyStore) (bccsp.BCCSP, error)
- func NewDefaultSecurityLevel(keyStorePath string) (bccsp.BCCSP, error)
- func NewDefaultSecurityLevelWithKeystore(keyStore bccsp.KeyStore) (bccsp.BCCSP, error)
- type DummyKeyStore
- type FileBasedKeyStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESCBCPKCS7Decrypt ¶
AESCBCPKCS7Decrypt combines CBC decryption and PKCS7 unpadding
func AESCBCPKCS7Encrypt ¶
AESCBCPKCS7Encrypt combines CBC encryption and PKCS7 padding
func GetRandomBytes ¶
GetRandomBytes returns len random looking bytes
func InitPKCS11 ¶
func New ¶
New returns a new instance of the software-based BCCSP set at the passed security level, hash family and KeyStore.
func NewDefaultSecurityLevel ¶
NewDefaultSecurityLevel returns a new instance of the software-based BCCSP at security level 256, hash family SHA2 and using FolderBasedKeyStore as KeyStore.
Types ¶
type DummyKeyStore ¶
type DummyKeyStore struct { }
dummyKeyStore is a read-only KeyStore that neither loads nor stores keys.
func (*DummyKeyStore) GetKey ¶
func (ks *DummyKeyStore) GetKey(ski []byte) (k bccsp.Key, err error)
GetKey returns a key object whose SKI is the one passed.
func (*DummyKeyStore) ReadOnly ¶
func (ks *DummyKeyStore) ReadOnly() bool
ReadOnly returns true if this KeyStore is read only, false otherwise. If ReadOnly is true then StoreKey will fail.
type FileBasedKeyStore ¶
type FileBasedKeyStore struct {
// contains filtered or unexported fields
}
fileBasedKeyStore is a folder-based KeyStore. Each key is stored in a separated file whose name contains the key's SKI and flags to identity the key's type. All the keys are stored in a folder whose path is provided at initialization time. The KeyStore can be initialized with a password, this password is used to encrypt and decrypt the files storing the keys. A KeyStore can be read only to avoid the overwriting of keys.
func (*FileBasedKeyStore) GetKey ¶
func (ks *FileBasedKeyStore) GetKey(ski []byte) (k bccsp.Key, err error)
GetKey returns a key object whose SKI is the one passed.
func (*FileBasedKeyStore) Init ¶
func (ks *FileBasedKeyStore) Init(pwd []byte, path string, readOnly bool) error
Init initializes this KeyStore with a password, a path to a folder where the keys are stored and a read only flag. Each key is stored in a separated file whose name contains the key's SKI and flags to identity the key's type. If the KeyStore is initialized with a password, this password is used to encrypt and decrypt the files storing the keys. The pwd can be nil for non-encrypted KeyStores. If an encrypted key-store is initialized without a password, then retrieving keys from the KeyStore will fail. A KeyStore can be read only to avoid the overwriting of keys.
func (*FileBasedKeyStore) ReadOnly ¶
func (ks *FileBasedKeyStore) ReadOnly() bool
ReadOnly returns true if this KeyStore is read only, false otherwise. If ReadOnly is true then StoreKey will fail.