# HG changeset patch # User Chris Cannam # Date 1309275133 -3600 # Node ID f72cad3baa342f0e89b468a274764fe08d24feaf # Parent ff6252986354d093e625f94e4703b57791e8b378 Ensure encryption happens in CBC mode diff -r ff6252986354 -r f72cad3baa34 easyhg.py --- a/easyhg.py Tue Jun 28 16:22:42 2011 +0100 +++ b/easyhg.py Tue Jun 28 16:32:13 2011 +0100 @@ -66,11 +66,11 @@ salt = os.urandom(8) text = '%d.%s.%s' % (len(text), base64.b64encode(salt), text) text += (16 - len(text) % 16) * ' ' - cipher = AES.new(key) + cipher = AES.new(key, AES.MODE_CBC) return base64.b64encode(cipher.encrypt(text)) def decrypt_salted(ctext, key): - cipher = AES.new(key) + cipher = AES.new(key, AES.MODE_CBC) text = cipher.decrypt(base64.b64decode(ctext)) (tlen, d, text) = text.partition('.') (salt, d, text) = text.partition('.')