github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/bccsp/aesopts.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  // AES128KeyGenOpts contains options for AES key generation at 128 security level
    20  type AES128KeyGenOpts struct {
    21  	Temporary bool
    22  }
    23  
    24  // Algorithm returns the key generation algorithm identifier (to be used).
    25  func (opts *AES128KeyGenOpts) Algorithm() string {
    26  	return AES128
    27  }
    28  
    29  // Ephemeral returns true if the key to generate has to be ephemeral,
    30  // false otherwise.
    31  func (opts *AES128KeyGenOpts) Ephemeral() bool {
    32  	return opts.Temporary
    33  }
    34  
    35  // AES192KeyGenOpts contains options for AES key generation at 192  security level
    36  type AES192KeyGenOpts struct {
    37  	Temporary bool
    38  }
    39  
    40  // Algorithm returns the key generation algorithm identifier (to be used).
    41  func (opts *AES192KeyGenOpts) Algorithm() string {
    42  	return AES192
    43  }
    44  
    45  // Ephemeral returns true if the key to generate has to be ephemeral,
    46  // false otherwise.
    47  func (opts *AES192KeyGenOpts) Ephemeral() bool {
    48  	return opts.Temporary
    49  }
    50  
    51  // AES256KeyGenOpts contains options for AES key generation at 256 security level
    52  type AES256KeyGenOpts struct {
    53  	Temporary bool
    54  }
    55  
    56  // Algorithm returns the key generation algorithm identifier (to be used).
    57  func (opts *AES256KeyGenOpts) Algorithm() string {
    58  	return AES256
    59  }
    60  
    61  // Ephemeral returns true if the key to generate has to be ephemeral,
    62  // false otherwise.
    63  func (opts *AES256KeyGenOpts) Ephemeral() bool {
    64  	return opts.Temporary
    65  }