crypto.cipher des cbc failure
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python-Crypto |
New
|
Undecided
|
Unassigned |
Bug Description
>>> from Crypto.Cipher import DES
>>> DES.new(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
return DESCipher(key, *args, **kwargs)
File "/usr/local/
blockalgo.
File "/usr/local/
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Invalid key size (must be either 16 or 24 bytes long)
this should not be happened ?
If you really want to use Single DES, the key must be 8 bytes long, not 16 (the exception string is clearly wrong and misleading though).
If you want to actually use Triple DES, use must use the DES3 module, not the DES module.
In either case, the IV (3rd parameter to new() method) must be 8 bytes long, not 16.