github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/keystore.go (about)

     1  /*
     2  Copyright IBM Corp. 2016 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  		 http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  package bccsp
    17  
    18  // KeyStore represents a storage system for cryptographic keys.
    19  // It allows to store and retrieve bccsp.Key objects.
    20  // The KeyStore can be read only, in that case StoreKey will return
    21  // an error.
    22  type KeyStore interface {
    23  
    24  	// ReadOnly returns true if this KeyStore is read only, false otherwise.
    25  	// If ReadOnly is true then StoreKey will fail.
    26  	ReadOnly() bool
    27  
    28  	// GetKey returns a key object whose SKI is the one passed.
    29  	GetKey(ski []byte) (k Key, err error)
    30  
    31  	// StoreKey stores the key k in this KeyStore.
    32  	// If this KeyStore is read only then the method will fail.
    33  	StoreKey(k Key) (err error)
    34  }