Skip to content
Snippets Groups Projects
Select Git revision
  • fa3b2d0f5a0d8d3ef9f56ebe91d292ab992a02b0
  • workshop-poc default protected
  • streamchain-paper
  • fabric-release-1.4
4 results

bccsp.go

Blame
  • bccsp.go 4.59 KiB
    /*
    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.
    */
    
    package bccsp
    
    import (
    	"crypto"
    	"hash"
    )
    
    // Key represents a cryptographic key
    type Key interface {
    
    	// Bytes converts this key to its byte representation,
    	// if this operation is allowed.
    	Bytes() ([]byte, error)
    
    	// SKI returns the subject key identifier of this key.
    	SKI() []byte
    
    	// Symmetric returns true if this key is a symmetric key,
    	// false is this key is asymmetric
    	Symmetric() bool
    
    	// Private returns true if this key is a private key,
    	// false otherwise.
    	Private() bool
    
    	// PublicKey returns the corresponding public key part of an asymmetric public/private key pair.
    	// This method returns an error in symmetric key schemes.
    	PublicKey() (Key, error)
    }
    
    // KeyGenOpts contains options for key-generation with a CSP.
    type KeyGenOpts interface {
    
    	// Algorithm returns the key generation algorithm identifier (to be used).
    	Algorithm() string
    
    	// Ephemeral returns true if the key to generate has to be ephemeral,
    	// false otherwise.
    	Ephemeral() bool
    }
    
    // KeyDerivOpts contains options for key-derivation with a CSP.
    type KeyDerivOpts interface {
    
    	// Algorithm returns the key derivation algorithm identifier (to be used).
    	Algorithm() string
    
    	// Ephemeral returns true if the key to derived has to be ephemeral,
    	// false otherwise.
    	Ephemeral() bool
    }
    
    // KeyImportOpts contains options for importing the raw material of a key with a CSP.
    type KeyImportOpts interface {