1、使用fabric-ca登记身份时,命令如下:
sudo fabric-ca-client enroll -u http://peer1:peer1pw@localhost:7054 -M $FABRIC_CA_CLIENT_HOME/msp
2、报了一个错,错误信息如下:
2021/03/03 15:21:38 [INFO] generating key: &{A:ecdsa S:256}
2021/03/03 15:21:38 [INFO] encoded CSR
Error: Response from server: Error Code: 20 - Authentication failure
并且在fabric-ca-server底下还会报如下错误:
3、解决办法,要在fabric-ca-server-config.yaml底下加上对应的name为peer1配置,即如下面所示:
registry:
# Maximum number of times a password/secret can be reused for enrollment
# (default: -1, which means there is no limit)
maxenrollments: -1
# Contains identity information which is used when LDAP is disabled
identities:
- name: admin
pass: adminpw
type: client
affiliation: ""
attrs:
hf.Registrar.Roles: "*"
hf.Registrar.DelegateRoles: "*"
hf.Revoker: true
hf.IntermediateCA: true
hf.GenCRL: true
hf.Registrar.Attributes: "*"
hf.AffiliationMgr: true
- name: peer1
pass: peer1pw
type: client
affiliation: ""
attrs:
hf.Registrar.Roles: "*"
hf.Registrar.DelegateRoles: "*"
hf.Revoker: true
hf.IntermediateCA: true
hf.GenCRL: true
hf.Registrar.Attributes: "*"
hf.AffiliationMgr: true
4、接着,再重新启动fabric-ca-server,输入命令:
sudo fabric-ca-server start -b admin:adminpw
5、再重新执行下命令,登记peer1身份:
sudo fabric-ca-client enroll -u http://peer1:peer1pw@localhost:7054 -M $FABRIC_CA_CLIENT_HOME/msp
如下图所示便成功了:
6、fabric-ca-server所启动的终端窗口,也会显示对应的输入日志,如下图所示: