Answer the question
In order to leave comments, you need to log in
How to make a file manager with an electronic signature?
Good afternoon.
It is necessary to implement a file manager with the ability to add an electronic signature to the downloaded data.
For now, I imagine it like this:
if you want to sign a document of an arbitrary format, then you need to encode it in base64 formathow can this be done in PHP or JavaScript?
Answer the question
In order to leave comments, you need to log in
First, decide which signature you will use. Will key pairs be issued by your server or will you use the digital signature of CAs accredited by you. If signatures are generated by you, will both keys be stored on the server or will only the user have the private key.
In any case, before signing the document, it is necessary to generate its hash. To do this, it is highly desirable to integrate into the document all the resources to which it refers (fonts, subdocuments, pictures, etc.). Then a part of the document is selected, which must be closed with a signature (in the simplest case, this is the entire document file) and some hash is calculated from it. This hash is encrypted with a private key, the resulting encrypted hash is the signature.
For verification, exactly the same hash generation procedure is carried out, the signature is decrypted with the public key and compared with the hash just calculated. If they match, then the signature is valid.
The storage of signatures depends on whether the next signature must approve the previous one or only the document itself. For simple signatures, it is enough to store in a separate table a link to the document, to the signer and the signature itself. For the chain, you need to add another link to the previous signature.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question