How to Encrypt PDF with Python Keyczar

Skip to first unread message

Hancho Bravo

Feb 17, 2016, 4:39:48 PM2/17/16
to Keyczar Discuss
I'm new to keyzcar and encryption. I'm not seeing any options on the keyczar Python interfaces for encrypting files in general. I'm noticing that the methods I want to use should be taking strings and not binary data:

Does anyone have an example on how to encrypt and decrypt a PDF or PNG?


Jay Tuley

Feb 17, 2016, 6:13:32 PM2/17/16
There is a very old pull request with a python 2to3 version that offers IO stream interface for encryption/decryption. 

But otherwise I kinda assume this project is long dead.

You received this message because you are subscribed to the Google Groups "Keyczar Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Steve Weis

Feb 17, 2016, 6:48:47 PM2/17/16
to Keyczar Discuss
Jay, yes, nobody has updated any Keyczar code for almost year. Google was supposed to be working on Keyczar 2, but I don't know if that went anywhere.

Hancho, in terms of encrypting a PDF or PNG, what is your goal here? Are you writing something for fun or are you just trying to encrypt some files? If you just want to encrypt some files, Keyczar is probably not the right tool for the job.

If you're writing something for fun, the Python interface just handles strings. You would either have to buffer a whole file as a string or could use Jay's pull request. In terms of general Python crypto support, I haven't looked at it closely, by is actively maintained:

Reply all
Reply to author
0 new messages