How to Encrypt PDF with Python Keyczar

131 views
Skip to first unread message

Hancho Bravo

unread,
Feb 17, 2016, 4:39:48 PM2/17/16
to Keyczar Discuss
Hello,
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:

https://github.com/google/keyczar/blob/master/python/src/keyczar/keyczar.py#L309-L310

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

Thanks

Jay Tuley

unread,
Feb 17, 2016, 6:13:32 PM2/17/16
to keyczar...@googlegroups.com
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 keyczar-discu...@googlegroups.com.
To post to this group, send email to keyczar...@googlegroups.com.
Visit this group at https://groups.google.com/group/keyczar-discuss.
For more options, visit https://groups.google.com/d/optout.

Steve Weis

unread,
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 Cryptography.io is actively maintained:
https://cryptography.io/en/latest/

Reply all
Reply to author
Forward
0 new messages