pdf

How to use hashed password on pdf file?


I need to do something like this in my system:

Backend Server had a password "12345678"

hashed it to other string like "5f4dcc3b5aa265d61d8327aeb882cf39"

Frontend Server generated and use this hashed string to encrypte a pdf file

User download this pdf file and use password "12345678" to open it!

Is this possible and how to do it?


Solution

  • Hashing's irrelevant here. Backend needs plaintext password. PDF uses KDF, not hashes for encryption. Use pikepdf or similar, AES-256. Frontend? HTTPS for password transit. User types original password to open. Clear now?