Spaces:
Build error
Build error
| from cryptography.fernet import Fernet | |
| import base64 | |
| def encrypt_pdf(pdf_bytes, key): | |
| cipher = Fernet(base64.urlsafe_b64encode(key.ljust(32)[:32])) | |
| return cipher.encrypt(pdf_bytes) | |
| def decrypt_pdf(encrypted_bytes, key): | |
| cipher = Fernet(base64.urlsafe_b64encode(key.ljust(32)[:32])) | |
| return cipher.decrypt(encrypted_bytes) |