如何将用户证书共享给客户端

时间:2019-03-25 07:18:39

标签: hyperledger-fabric hyperledger blockchain

哪种方法最适合与Hyperledger架构网络的最终用户共享客户端证书?

我已经设置了一个Java sdk客户端来使用admin凭据注册和注册用户。在方案的结尾,我为每个用户都有一个用户名和一个密码。我找不到客户端证书存储在本地MSP的位置以及如何将它们共享给实际的最终用户。

任何建议或提议解决方案的示例将不胜感激。

1 个答案:

答案 0 :(得分:0)

在注册用户时, 您将获得注册对象

无论使用哪种SDK(NODE,JAVA,GO)

let enrollment = await caClient.enroll(request)
const key = enrollment.key.toBytes();
const cert = enrollment.certificate;

response.key = key;
response.cert = cert;
response.secret = secret;
return response;

看起来像下面的结果

  

“数据”:{“消息”:“ nbdClient已成功注册到   机构:nbd”,“键”:“ ----- BEGIN PRIVATE   KEY ----- \ r \ nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgH7ttkV4VIDA1TlSx \ r \ N / bmsy1Ad6zgLGhjdcFtElexqAtShRANCAASHKIOk + nBTIqfn5taiqMWlRnfHKdth \ r \ nkZKyq9Up4wl + PsBEQByyKfaDV904APCQ7zDvmPtwxsdNGxA76V4EpAqO \ r \ n ----- END   私钥----- \ r \ n“,” cert“:” ----- BEGIN   CERTIFICATE ----- \ nMIICjTCCAjOgAwIBAgIUA85ydnzJXRoRxeW5v2lrNk5pe + swCgYIKoZIzj0EAwIw \ nWTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh \ nbiBGcmFuY2lzY28xDDAKBgNVBAoTA25iZDEPMA0GA1UEAxMGY2EubmJkMB4XDTE5 \ nMDgxNTE0MjQwMFoXDTIwMDgxNDE0MjkwMFowLzEZMAsGA1UECxMEdXNlcjAKBgNV \ nBAsTA25iZDESMBAGA1UEAxMJbmJkQ2xpZW50MFkwEwYHKoZIzj0CAQYIKoZIzj0D \ nAQcDQgAEhyiDpPpwUyKn5 + bWoqjFpUZ3xynbYZGSsqvVKeMJfj7AREAcsin2g1fd \ nOADwkO8w75j7cMbHTRsQO + leBKQKjqOCAQEwgf4wDgYDVR0PAQH / BAQDAgOoMB0G \ nA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0GA1Ud \ nDgQWBBRMV5nFrtT3IpichyfayTaACbqpQDArBgNVHSMEJDAigCBLcH2ot2qhX7wR \ nCP6IeDXWkgXitZ3TukhQLBZFzboaWzBzBggqAwQFBgcIAQRneyJhdHRycyI6eyJo \ nZi5BZmZpbGlhdGlvbiI6Im5iZCIsImhmLkVucm9sbG1lbnRJRCI6Im5iZENsaWVu \ ndCIsImhmLlR5cGUiOiJ1c2VyIiwibmJkVXNlcjEiOiJuYmRVc2VyMSJ9fTAKBggq \ nhkjOPQQDAgNIADBFAiEA9 / Rqd9 / WtWLkR + XE1MdS4gX / JdYTqU58E8KMaShwFmkC \ nIDkA2OsC0jRswweTHmzGk5z5gKcwhOrZbJTZagqpv2m4 \ n ----- END   CERTIFICATE ----- \ n“,” secret“:” HqknKlBGzibb“}