如何修复方法C_GenerateKeyPair返回的CKR_FUNCTION_FAILED

时间:2019-03-24 19:12:13

标签: c# .net pkcs#11 pkcs11interop

当我生成公钥/私钥时,我遇到错误“方法C_GenerateKeyPair返回了CKR_FUNCTION_FAILED”时,我正尝试使用Pkcs11Interop库从HSM(Safenet inc)获取我自己的证书

我的代码

append

以下是一些日志

  

0x00002478:0x00001af8:属性7
  0x00002478:0x00001af8:属性:265(CKA_SIGN_RECOVER)
  0x00002478:0x00001af8:p值:0597E850
  0x00002478:0x00001af8:ulValueLen:1
  0x00002478:0x00001af8:* pValue:HEX(01)
  0x00002478:0x00001af8:属性8
  0x00002478:0x00001af8:属性:263(CKA_UNWRAP)
  0x00002478:0x00001af8:p值:0597E830
  0x00002478:0x00001af8:ulValueLen:1
  0x00002478:0x00001af8: pValue:HEX(01)
  0x00002478:0x00001af8:
结束属性模板*
  0x00002478:0x00001af8:phPublicKey:0643EA74
  0x00002478:0x00001af8:* phPublicKey:0
  0x00002478:0x00001af8:phPrivateKey:0643EA70
  0x00002478:0x00001af8:* phPrivateKey:0
  0x00002478:0x00001af8:返回6(CKR_FUNCTION_FAILED)
  0x00002478:0x00001af8:****************************** 2019-03-22 16:37:32 *
  0x00002478:0x00001af8:调用C_CloseSession
  0x00002478:0x00001af8:输入
  0x00002478:0x00001af8:hSession:2490369
  0x00002478:0x00001af8:返回0(CKR_OK)
  0x00002478:0x00001af8:****************************** 2019-03-22 16:37:32 *
< br />   0x00002478:0x00001af8:调用C_Finalize
  0x00002478:0x00001af8:输入
  0x00002478:0x00001af8:p保留:00000000
  0x00002478:0x00001af8:返回0(CKR_OK)

1 个答案:

答案 0 :(得分:-1)

不幸的是,PKCS#11 API没有提供有关version: '3' # specify docker-compose version # Define the services/containers to be run services: angular: # name of the first service build: client # specify the directory of the Dockerfile ports: - "4200:4200" # specify port forwarding #WHEN ADDING VOLUMES, ERROR APPEARS!!!!!! volumes: - ./client:/usr/src/app express: #name of the second service build: server # specify the directory of the Dockerfile ports: - "3000:3000" #specify ports forwarding links: - database #WHEN ADDING VOLUMES, ERROR APPEARS!!!!!! volumes: - ./server:/usr/src/app database: # name of the third service image: mongo # specify image to build container from ports: - "27017:27017" # specify port forwarding 函数失败的原因的任何详细信息,但是许多PKCS#11库支持某种内部日志记录机制,这可能会揭示错误的真正原因。启用日志记录所需的确切步骤应在PKCS#11库供应商提供的文档中提供。