Let's say that Alice publishes some data on the blokchain encrypted with Bob's public key. Bob then decrypts the data. Later Bob wants to prove that he is the owner of that data, that is he wants to prove he is the only one who could decrypt that data. Everyone in the network must be able to verify that. Is it possible to achieve this with digital signatures? If so, how should I use them?
2 Answers
Bob is the only one who could decrypt that data <=> Bob is the only one who has the private key.
The latter statement can be proved by simply letting Bob provide a signature (for example using "eth_sign") of an agreed upon message. The resulting signature can be verified with his public key (as an example, Etherscan has an UI that make it easy to check this verification process).
This proves that Bob has the private key paired with the public key that the data was originally encrypted with.
Hashing refers to the concept of taking an arbitrary amount of input data, applying some algorithm to it, and generating a fixed-size output data called the hash. The input can be any number of bits that could represent a single character, an MP3 file, an entire novel, a spreadsheet of your banking history, or even the entire Internet. The point is that the input can be infinitely big. The hashing algorithm can be chosen depending on your needs and there are many publicly available hashing algorithms. The point is that the algorithm takes the infinite input of bits, applies some calculations to them, and outputs a finite number of bits. For example, 256 bits.
and this link try it and help link
thanks