github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/ecdsaopts.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  
    17  package bccsp
    18  
    19  // ECDSAP256KeyGenOpts contains options for ECDSA key generation with curve P-256.
    20  type ECDSAP256KeyGenOpts struct {
    21  	Temporary bool
    22  }
    23  
    24  // Algorithm returns the key generation algorithm identifier (to be used).
    25  func (opts *ECDSAP256KeyGenOpts) Algorithm() string {
    26  	return ECDSAP256
    27  }
    28  
    29  // Ephemeral returns true if the key to generate has to be ephemeral,
    30  // false otherwise.
    31  func (opts *ECDSAP256KeyGenOpts) Ephemeral() bool {
    32  	return opts.Temporary
    33  }
    34  
    35  // ECDSAP384KeyGenOpts contains options for ECDSA key generation with curve P-384.
    36  type ECDSAP384KeyGenOpts struct {
    37  	Temporary bool
    38  }
    39  
    40  // Algorithm returns the key generation algorithm identifier (to be used).
    41  func (opts *ECDSAP384KeyGenOpts) Algorithm() string {
    42  	return ECDSAP384
    43  }
    44  
    45  // Ephemeral returns true if the key to generate has to be ephemeral,
    46  // false otherwise.
    47  func (opts *ECDSAP384KeyGenOpts) Ephemeral() bool {
    48  	return opts.Temporary
    49  }