Use stronger encryption instead of Blowfish
Bakthat currently encrypts using beefish, which is essentially a wrapper around pycrypto's Blowfish. Although not terribly broken, like DES, Blowfish is a suboptimal choice of cipher. The author of the cipher, Bruce Schneier, already said in 2007 he is surprised it is still being used at all.
Therefore, it would be good to at least support a stronger cipher, like AES-128. For backwards compatibility, Blowfish could be default, AES configurable. AES is already supported by pycrypto.
I totally agree with you, I'm working on a bakthat rewrite (not backward compatible, with a lot of new features) and I'm already planning to drop beefish.
Months ago, I wanted to give a try to Elliptic Curve Crypto (and with https://github.com/bwesterb/py-seccure), but according to http://safecurves.cr.yp.to/, I shouldn't use any NIST curves so, I think I will drop this idea too.
I will look further into AES-256/AES-128, I will keep you updated.
Do you have a lot of experiences with pycrypto / cryptography ?
Thanks!
I have some knowledge of cryptography, but focused more around the environment, i.e. how to use it securely, than details of specific ciphers. I know very little about elliptic curve crypto.
For AES-256, you could have a look at https://github.com/rnapier/RNCryptor/tree/master/python - that seems to be the most complete library out there. It also takes care of PBKDF2 and HMACs, and packages the data, hmac, salts and IV all into a nice data format, so it takes care of the complete package. As a plus, there are implementations in a few different languages too. It is not on PyPI currently though. You could also adopt it into bakthat itself. Note that there is a (very difficult to exploit) timing attack still open: https://github.com/rnapier/RNCryptor/pull/88
Thanks for the details, and for the AES-256 reference implementation, but the RNCryptor as is can't handle file that doesn't fit in ram, It should read by chunks and deals with padding (like this snippet), maybe I can try to do it myself if you can validate what I'm doing.
Well, I can't make any promises, but I imagine we can at least make it safer than with blowfish without PBKDF2/bcrypt. What would be even nicer is if we could integrate the support you need into RNCryptor itself, so that others can reuse it in the future.
@tsileo, I'm no crypto guru, but it sounds like you might like https://github.com/jedisct1/libsodium, there are two python libraries, https://github.com/stef/pysodium and https://github.com/dstufft/pynacl. have you seen these?