DES3-CBC gotcha encrypt/decrypt on same object

Bug #673120 reported by ine ya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python-Crypto
Fix Released
Undecided
Unassigned

Bug Description

I just spent quite a while trying to use the same object to encrypt something and decrypt the result. As I later figured out, this doesn't work and although this is not a bug, I would kindly ask to mention this in documentation, possibly to include example similar to one below.

========================================
#!/usr/bin/python

from Crypto.Cipher import DES3
obj=DES3.new('a'*16, DES3.MODE_CBC)
plain="Guido van Rossum is a space alien."

ciph=obj.encrypt(plain+'XXXXXX')
print repr(ciph)

obj2=DES3.new('a'*16, DES3.MODE_CBC)

print obj.decrypt(ciph) # doesn't work -> avoid!
print obj2.decrypt(ciph) # works
========================================

Revision history for this message
Darsey Litzenberger (dlitz) wrote :
Changed in pycrypto:
status: New → Fix Committed
Revision history for this message
Darsey Litzenberger (dlitz) wrote :

Released in PyCrypto 2.4.

Changed in pycrypto:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.