github.com/bigzoro/my_simplechain@v0.0.0-20240315012955-8ad0a2a29bb9/core/access_contoller/crypto/hsm/dummy.go (about)

     1  /*
     2  Copyright (C) BABEC. All rights reserved.
     3  Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
     4  
     5  SPDX-License-Identifier: Apache-2.0
     6  */
     7  
     8  package hsm
     9  
    10  import "fmt"
    11  
    12  type dummyAdapter struct {
    13  }
    14  
    15  func (i dummyAdapter) PKCS11_GetSM2KeyId(keyIdex int, isPrivate bool) (string, error) {
    16  	return fmt.Sprintf("%d", keyIdex), nil
    17  }
    18  
    19  func (i dummyAdapter) PKCS11_GetRSAKeyId(keyIdex int, isPrivate bool) (string, error) {
    20  	return fmt.Sprintf("%d", keyIdex), nil
    21  }
    22  
    23  func (i dummyAdapter) PKCS11_GetECCKeyId(keyIdex int, isPrivate bool) (string, error) {
    24  	return fmt.Sprintf("%d", keyIdex), nil
    25  }
    26  
    27  func (i dummyAdapter) PKCS11_GetSM4KeyId(keyIdex int) (string, error) {
    28  	return fmt.Sprintf("%d", keyIdex), nil
    29  }
    30  
    31  func (i dummyAdapter) PKCS11_GetAESKeyId(keyIdex int) (string, error) {
    32  	return fmt.Sprintf("%d", keyIdex), nil
    33  }
    34  
    35  func (i dummyAdapter) PKCS11_GetSM3SM2CKM() uint {
    36  	return 0
    37  }
    38  
    39  func (i dummyAdapter) SDF_GetSM2KeyAccessRight(keyIdex int) (newKeyIdex int, need bool) {
    40  	return keyIdex, false
    41  }
    42  
    43  func (i dummyAdapter) SDF_GetSM4KeyAccessRight(keyIdex int) (newKeyIdex int, need bool) {
    44  	return keyIdex, false
    45  }
    46  
    47  func (i dummyAdapter) SDF_GetRSAKeyAccessRight(keyIdex int) (newKeyIdex int, need bool) {
    48  	return keyIdex, false
    49  }
    50  
    51  func (i dummyAdapter) SDF_GetAESKeyAccessRight(keyIdex int) (newKeyIdex int, need bool) {
    52  	return keyIdex, false
    53  }