架构CA客户端用户注册授权失败

时间:2018-08-27 09:42:54

标签: hyperledger-fabric hyperledger blockchain hyperledger-fabric-ca

我尝试使用以下方法初始化结构CA服务器后注册管理员:

 fabric-ca-server init -b “admin:adminpw”

并使用以下命令启动CA服务器:

fabric-ca-server start -b “admin:adminpw”

在客户端,注册命令:

fabric-ca-client enroll -u http://admin:adminpw@localhost:7054

客户端错误消息:

[INFO] generating key: &{A:ecdsa S:256}
[INFO] encoded CSR
Error: Response from server: Error Code: 20 - Authorization failure

服务器端:

fabric-ca-server start -b “admin:adminpw”
2018/08/27 14:48:57 [INFO] Configuration file location: 
/home/nadeem/Documents/Fabric-CA/server/fabric-ca-server-config.yaml
2018/08/27 14:48:57 [INFO] Starting server in home directory: 
/home/nadeem/Documents/Fabric-CA/server
2018/08/27 14:48:57 [INFO] Server Version: 1.2.1-snapshot-3bcdbb2
2018/08/27 14:48:57 [INFO] Server Levels: &{Identity:1 Affiliation:1 
Certificate:1 Credential:1 RAInfo:1 Nonce:1}
2018/08/27 14:48:57 [INFO] The CA key and certificate already exist
2018/08/27 14:48:57 [INFO] The key is stored by BCCSP provider 'SW'
2018/08/27 14:48:57 [INFO] The certificate is at: 
/home/nadeem/Documents/Fabric-CA/server/ca-cert.pem
2018/08/27 14:48:57 [INFO] Initialized sqlite3 database at 
/home/nadeem/Documents/Fabric-CA/server/fabric-ca-server.db
2018/08/27 14:48:57 [INFO] Home directory for default CA: 
/home/nadeem/Documents/Fabric-CA/server
2018/08/27 14:48:57 [INFO] Listening on http://0.0.0.0:7054
***2018/08/27 14:49:34 [INFO] 127.0.0.1:46350 POST /enroll 401 23 "Failed 
to get user: : scode: 404, code: 63, msg: Failed to get User: sql: no 
rows in result set"***

fabric-ca-client /服务器:

  

版本:1.2.1-snapshot-3bcdbb2 Go版本:go1.11 OS / Arch:   linux / amd64

在这里找到类似的帖子

  

https://jira.hyperledger.org/browse/FABC-302

v1.2已将其标记为已解决,但是目前尚无明确的说明来解决该问题。 谢谢:)

4 个答案:

答案 0 :(得分:0)

我一直在尝试使Fabric-CA工作一段时间, 我可以给您的最好建议是,在开始之前请取消管理凭据周围的“”。我不放它们,它对我有用。 因此命令将是:

fabric-ca-server init -b admin:adminpw

fabric-ca-server start -b admin:adminpw

答案 1 :(得分:0)

此错误消息出现。在ca启动和使用ca enroll use时,帐户和密码不相同。

答案 2 :(得分:0)

错误代码:20-授权失败

由于以下情况,出现错误代码20。 假设您已经这样注册了身份:-

fabric-ca-client  register --id.name org1 --id.type client --id.affiliation org1 --id.attrs '"hf.Registrar.Roles=user,client,peer","hf.AffiliationMgr=true","hf.Revoker=true"'

为您提供输出

2020/02/05 11:19:25 [INFO] Configuration file location: /home/username/myPros/caclient/admin/fabric-ca-client-config.yaml
Password: ZXCbhJajCObX

,您正在尝试像这样注册用户/身份:-

fabric-ca-client enroll -u http://org1-admin:ZXCbhJajCObX@localhost:7054

fabric-ca-client enroll -u http://org1-admin:adminpw@localhost:7054

长话短说,您的注册ID或密码不匹配。确保您的用户名和密码不匹配。

答案 3 :(得分:0)

可能在初始化期间。在fabric-ca-server-config.yaml文件中查找这些引号并将其删除。请勿在初始化注册时使用它们。

image of fabric-ca-server-config.yaml file