Re: Limiting dissemination of hashes of private collection keys and values?
Victor Dods
Thanks for the reply, Yacov! Appending a salt to the plaintext of each key* means that I need to retain and supply that salt in order to use GetPrivateData, which further means that I need to know which keys I'll be accessing in advance of the transaction proposal so I can send the appropriate salt(s) in the transient data field. This represents (1) a significant architectural burden, (2) broken encapsulation of the chaincode call (the caller can't and shouldn't be expected to know all the keys that the chaincode will use in advance). Perhaps it would be useful to elaborate on a more essential version of my suggestion. Forget the part about the HMAC. Add a modified version of PutPrivateData to ChaincodeStubInterface: - PutPrivateDataWithNonces(collection string, key string, keyNonce []byte, value []byte, valueNonce []byte) error When this is called, it stores the quadruple (key, keyNonce, value, valueNonce) in the Private State, and it stores (hash(keyNonce+key), hash(valueNonce+value)) in the Channel State. Here, the chaincode author is responsible for generating those nonces. Then the hash scheme is exactly as you say, except that now the nonces don't interfere with the keys and values, and I can use GetPrivateData and other related functions just as I would if I didn't have to worry about nonces (i.e. GetPrivateData etc are backward-compatible). The concerns are now separate. - PutPrivateData doesn't change, and internally it just uses empty byte arrays for keyNonce and valNonce, so the behavior of the hash scheme is still compatible with the existing Fabric protocol. The difference between this and my original suggestion is that Fabric would be: - generating those nonces for you (so no repetitive boilerplate for chaincode authors) - automatically (so all chaincode authors benefit without additional work on their part) - using a well-defined, tested scheme (so each chaincode author isn't burdened with having to implement it correctly themselves). *You might suggest that you could just use a single salt for all keys, but (1) that still imposes a burden to manage that salt outside of the chaincode and (2) still allows an attacker to see that two keys are equal, two values are equal, or a key is equal to a value. Victor Dods Chief Software Architect LedgerDomain
On Fri, Mar 27, 2020 at 1:43 PM Yacov Manevich <YACOVM@...> wrote: why do you need a MAC? What's wrong with just appending a salt to the plaintext? You're not protecting against any length extension attacks or doing any kind of authentication.
|
|