github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/bccsp/rsaopts.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  // RSA1024KeyGenOpts contains options for RSA key generation at 1024 security.
    20  type RSA1024KeyGenOpts struct {
    21  	Temporary bool
    22  }
    23  
    24  // Algorithm returns the key generation algorithm identifier (to be used).
    25  func (opts *RSA1024KeyGenOpts) Algorithm() string {
    26  	return RSA1024
    27  }
    28  
    29  // Ephemeral returns true if the key to generate has to be ephemeral,
    30  // false otherwise.
    31  func (opts *RSA1024KeyGenOpts) Ephemeral() bool {
    32  	return opts.Temporary
    33  }
    34  
    35  // RSA2048KeyGenOpts contains options for RSA key generation at 2048 security.
    36  type RSA2048KeyGenOpts struct {
    37  	Temporary bool
    38  }
    39  
    40  // Algorithm returns the key generation algorithm identifier (to be used).
    41  func (opts *RSA2048KeyGenOpts) Algorithm() string {
    42  	return RSA2048
    43  }
    44  
    45  // Ephemeral returns true if the key to generate has to be ephemeral,
    46  // false otherwise.
    47  func (opts *RSA2048KeyGenOpts) Ephemeral() bool {
    48  	return opts.Temporary
    49  }
    50  
    51  // RSA3072KeyGenOpts contains options for RSA key generation at 3072 security.
    52  type RSA3072KeyGenOpts struct {
    53  	Temporary bool
    54  }
    55  
    56  // Algorithm returns the key generation algorithm identifier (to be used).
    57  func (opts *RSA3072KeyGenOpts) Algorithm() string {
    58  	return RSA3072
    59  }
    60  
    61  // Ephemeral returns true if the key to generate has to be ephemeral,
    62  // false otherwise.
    63  func (opts *RSA3072KeyGenOpts) Ephemeral() bool {
    64  	return opts.Temporary
    65  }
    66  
    67  // RSA4096KeyGenOpts contains options for RSA key generation at 4096 security.
    68  type RSA4096KeyGenOpts struct {
    69  	Temporary bool
    70  }
    71  
    72  // Algorithm returns the key generation algorithm identifier (to be used).
    73  func (opts *RSA4096KeyGenOpts) Algorithm() string {
    74  	return RSA4096
    75  }
    76  
    77  // Ephemeral returns true if the key to generate has to be ephemeral,
    78  // false otherwise.
    79  func (opts *RSA4096KeyGenOpts) Ephemeral() bool {
    80  	return opts.Temporary
    81  }