0

Verify a digital signature of a file(doc/pdf) in PHP

i hv a project which requirement to ensure a doc or pdf file whatever it has a digital signature or not.If the file has a digital signature then is it valid or not?

i have knowledge about it may be possible in java but i wana to do it in php.

OpenSSL is used to encrypt and decrypt but don't know how can i check doc/pdf with it.

somebody help please this newbie any feedback will be a big help for me. Thank You Everyone for reading this.

Mthe beseti
  • 599
  • 1
  • 10
  • 29

1 Answers1

0

You really don't need OpenSSL per se for this task. All you need to do is take a hash of the entire file and contents, and then include the person's username who is 'signing' the document in the hash. You can then store the hash in a database table associated with the signed document. If you need to validate it you recalculate the hash and compare it to the stored item, and if it doesn't match you invalidate the signature.

Something to keep in mind, if you are trying to comply with an FDA-style digital signature compliance - you will need to make sure that the person re-authenticates at the time of signing in order to make it compliant.