My use case is the following: I want to use ethereum to track devices, and device owners. This is easy to do using ethereum and smart contract. But I want to store a secret associated with the device. Is there a way to do this, for instance, by encrypting this secret data with the public key of the holder?
Basically, if A=Asset, O1= A first owner, O2=A next owner, I would like to achieve this:
- A is owned by O1, A secret is encrypted with O1 public key, and stored in the blockchain
- A is transferred by O1 to O2 (new owner) using a smart contract executed by O1. O1 decrpyt A secret using his private key, and encrypt it using O2 public key and store this
- A is owned by O2, A secret is encrypted with O2 public key and stored in the blockchain
This seems fine except that the smart contract needs to access to some secret key... Is there an idea how such contract can be done, or if there is a better option for this ?