【问题标题】:How to get the public key of identity?如何获得身份的公钥?
【发布时间】:2020-07-10 03:26:16
【问题描述】:
const enrollment = await ca.enroll({ enrollmentID: appAdmin, enrollmentSecret: appAdminSecret });
const identity = X509WalletMixin.createIdentity(orgMSPID, enrollment.certificate, enrollment.key.toBytes());
wallet.import(appAdmin, identity);

enrollment.key.toBytes() 是私钥。如何获取对应的公钥?

【问题讨论】:

  • 您能不能试试enrollment.key.getPublicKey() 之类的方法,看看是否可行!
  • 您可以从证书中获取公钥。注册证书包含相应的公钥。

标签: hyperledger-fabric identity public-key


【解决方案1】:

您可以在证书上找到公钥。如果您在 SDK 上没有找到任何已实现的功能,您可以轻松解析该证书以获取公钥。

https://www.ssl.com/faqs/what-is-an-x-509-certificate/

【讨论】:

    猜你喜欢
    • 2015-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    • 2017-11-08
    • 1970-01-01
    • 2015-08-20
    • 2012-10-27
    相关资源
    最近更新 更多