Digital stamp with python

0

Greetings to all!

I am preparing some documents in pdf using python, and to give it a formal validity, we want to include a digital seal composed of a text string, where there is a unique key or stamp for each document, basically they are proof of assistance to an academic event, so each record must have a unique stamp.

If you ask us to check that the evidence of Gustavo Pérez Pérez is valid and authentic, it would be carried out using the unique digital stamp, of the type:

  

2016-06-18||f90979b330be2df2bbb80452930ae719||ASISTENCIA||GUSTAVO+PEREZ+PEREZ||XLII||CONGRESO||NACIONAL||

There are data that correspond to the date, the digital seal (which is what I want to generate through python) and other data.

Any ideas you can start with to generate the digital seal?

I thank you in advance for your contributions.

Receive a cordial greeting. Gustavo.

    
asked by Gustux 09.02.2017 в 03:32
source

1 answer

3

If I have understood correctly, what you are trying to do is implement an electronic signature, so that for data you can obtain the hash of the data that verifies that there are no changes since it was generated.

Thus, the electronic signature is implemented, in its simplest format, by means of a hash function (you can do it using the hashlib module) that will use that key to generate the signature when passing through your hash () function. If you wanted to add security, you could use personal keys that would be used together with the data in the hash () function, so that only the combination of the signature and the data get the correct hash string.

To get the simplest hash, simply get a representation of each record (for all fields), and do something similar to what they show here: link

You will see that if you save that hash, you change a data in the registry, and you get the hash again, it will have changed and they will not be the same.

    
answered by 12.02.2017 / 01:37
source