github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/hyperledger/fabric/bccsp/gmopts.go (about)

     1  package bccsp
     2  
     3  const (
     4  	SM4 = "SM4"
     5  
     6  	SM3 = "SM3" //add GM
     7  
     8  	SM2 = "SM2"
     9  
    10  	SM = "SM"
    11  )
    12  
    13  type SM3Opts struct { // add GM
    14  }
    15  
    16  // Algorithm add GM
    17  // Algorithm returns the hash algorithm identifier (to be used).
    18  func (opts *SM3Opts) Algorithm() string {
    19  	return SM3
    20  }
    21  
    22  // SM2KeyGenOpts contains options for SM2 key generation.
    23  type SM2KeyGenOpts struct {
    24  	Temporary bool
    25  }
    26  
    27  // Algorithm returns the key generation algorithm identifier (to be used).
    28  func (opts *SM2KeyGenOpts) Algorithm() string {
    29  	return SM2
    30  }
    31  
    32  // Ephemeral returns true if the key to generate has to be ephemeral,
    33  // false otherwise.
    34  func (opts *SM2KeyGenOpts) Ephemeral() bool {
    35  	return opts.Temporary
    36  }
    37  
    38  // SM4KeyGenOpts contains options for SM4 key generation.
    39  type SM4KeyGenOpts struct {
    40  	Temporary bool
    41  }
    42  
    43  // Algorithm returns the key generation algorithm identifier (to be used).
    44  func (opts *SM4KeyGenOpts) Algorithm() string {
    45  	return SM4
    46  }
    47  
    48  // Ephemeral returns true if the key to generate has to be ephemeral,
    49  // false otherwise.
    50  func (opts *SM4KeyGenOpts) Ephemeral() bool {
    51  	return opts.Temporary
    52  } // Add GM
    53  
    54  // SM4ImportKeyOpts contains options for importing SM4 128 keys.
    55  type SM4ImportKeyOpts struct {
    56  	Temporary bool
    57  }
    58  
    59  // Algorithm returns the key importation algorithm identifier (to be used).
    60  func (opts *SM4ImportKeyOpts) Algorithm() string {
    61  	return SM4
    62  }
    63  
    64  // Ephemeral returns true if the key generated has to be ephemeral,
    65  // false otherwise.
    66  func (opts *SM4ImportKeyOpts) Ephemeral() bool {
    67  	return opts.Temporary
    68  }