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.