diff easyhg.py @ 446:f72cad3baa34

Ensure encryption happens in CBC mode
author Chris Cannam
date Tue, 28 Jun 2011 16:32:13 +0100
parents ff6252986354
children 89b6ba707096
line wrap: on
line diff
--- 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('.')