I would like to create a solution that would sign the data and will have a increasing counter so I can track the number of signatures.

One of the requirement is to have an increasing order of signature to track the history. As I would like to store counters on external file I need to protect the file also for change of the history.

For example I will store increased counters in file, let's be it number 15. Then I will do another signature and store updated file with the number 16. I would like to protect the solution from replacing file with the previous version of the file containing counter 15, so it wouldn't be possible to go back in the past.

I am aware of cryptographic techniques to protect the integrity of the file but I do not know how to ensure that it wouldn't be possible to replace the file with the previous version.

Any advice?

  • Not sure if I understand properly your question but looks like blockchain will help with your solution. Bear in mind that I'm not referring to the bitcoin components or distributed, just the way the blockhain tracks the integrity of the blocks (with sha256 hashes). – camp0 Apr 18 '19 at 13:21
  • Thank you for your comment, however I think that in case of the blockchain the same can happen if I would have only one node, someone can replace the ledger with previous version and I wouldn't be able to detect it...is that right? – user1563721 Apr 18 '19 at 13:24
  • Blockchain is older than the bitcoin. Chained integrity is what you need. – kelalaka Apr 18 '19 at 14:50

You need a Consensus Protocol for that. Keep the file saved on 3 (or 5, or more) distinct servers, and every time the file is modified, send the new version for those servers.

The servers, in turn, verify if the file is a new version with the incremented counter, and if so, they can store the hash of the file on the ledger after the majority of the servers agree the file is a new one.

To verify any file, you submit your file to the server, the server verifies if he have the same version, and tells you if your version is an older version, the current version, or a version never seen before.

This way, an attacker would have to compromise the majority of the servers to revert any file to a previous version.

Or you can use existing solutions for that. There are current solutions for storing data on the blockchain. There are Ethereum smart contracts for that: you can store the counter and the hash of the document, and keep track of changes. If anyone tries to revert the counter, you can search on the Ethereum blockchain and detect it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.