Re: how to obtain an org's root CA certificate in application chaincode?

qs meng <qsmeng@...>

Baohua, now I see what you mean. Even I can put some sdk in chaincoded, the sdk wont work because  the chaincode only run in a  container, only can commnicate with  peers, but peers dont know how to deal with the sdk.
Thank you.

At 2019-05-06 16:46:16, "Baohua Yang" <yangbaohua@...> wrote:
The chaincode cannot get the msp info from peer.

You can only use the stub APIs in chaincode.

On Mon, May 6, 2019 at 12:07 PM qs meng <qsmeng@...> wrote:
    suppose one application certificate is issued by one fabric org's ca and the certificate needs being verified in  an application chaincode. 
    One way is to get the org's root ca certificate. But I do not know how to obtain the root certificate.
     Another way:  similar to forming a proposal, the application certificate is passed in chaincde as a creator,  and  use identity.Validate() to validate.  To do that, the chaincode including the following code:
      channelID := stub.GetChannelID()
     creatorByte, _ := stub.GetCreator()
     mspObj := mspmgmt.GetIdentityDeserializer(channelID)
     creator, err := mspObj.DeserializeIdentity(creatorByte)
     err = creator.Validate()
    return shim.Error("[error] return:" + err.Error())
after the successful import mgmt package and instantiation, the chaincode runs timeout.
  How to solve this problem? Thank you.
  Best regards,
qs meng


Best wishes!

Baohua Yang


Join to automatically receive all group messages.