Re: Private data existence verification from non-members organizations

Roxana Danger
 

Thank you very much, Sijo.
It works!
Roxana


On Mon, Jul 13, 2020 at 9:13 PM Sijo Cherian <sijo.cher@...> wrote:
Hi,

Use theĀ chaincode API GetPrivateDataHash() that allows chaincode on non-member peers to read the hash value of a private key.


So any member of the channel, can get Hash if the key is known. If Hash returned is empty, then key does not exist in the Collection.

/sijo

On Mon, Jul 13, 2020 at 10:47 AM Roxana Danger <roxana.danger@...> wrote:

I have a channel with a private data collection, and a contract that allows to add data to this private collection. I would like to extend the functionality of this contract with a new transaction that allows to publish the hash of a data in the collection to the whole channel.

My publish transaction method is as follows:

@Transaction
void public boolean publish(MLModelContext ctx,
                            String collection,
                            String pdhash){
     byte[] privateData = ctx.getStub().getPrivateData(collection, pdhash);
     if (privateData!= null){
          ctx.getStub().putState(getKey(), pdhash.getBytes("UTF8") );
          return true;
     }
     return false;
} 

The problem here is that only members of the private collection can verify the existence of the private data as the line privateData = ... results in an unauthorized access for non-member organizations.

A solution here could be trust on the transaction submitter and put the state without verifying the existence of the private data, but it could raise security and consistency issues.

I would like to includes in my chaincode an exists query that evaluates the existence of a private data with this hash.

Is there in HF any available mechanism for doing this? How should I proceed if I have to implement it?

Many thanks,

Roxana

Join fabric@lists.hyperledger.org to automatically receive all group messages.