[pycrypto] Typo or bug?
Dave Pawson
dave.pawson at gmail.com
Tue Jun 26 07:08:23 EDT 2012
On 26 June 2012 10:52, Legrandin <gooksankoo at hoiptorrow.mailexpire.com> wrote:
>> encobj = AES.new(secret, AES.MODE_CFB)
>> File "/usr/lib64/python2.7/site-packages/Crypto/Cipher/blockalgo.py",
>> line 141, in __init__
>> self._cipher = factory.new(key, *args, **kwargs)
>> ValueError: IV must be 16 bytes long
>>
>> So although the 'secret' is 16 bytes long, I'm getting a report saying it
>> isn't?
>>
>
> Hi Dave,
>
> The key is OK, but the IV is missing and it is mandatory for CFB.
> Your code should be:
>
> encobj = AES.new(secret, AES.MODE_CFB, some_iv)
>
> where len(some_iv)==16.
I think I have it working....
myiv = "some Random string" # which is 16 bytes long....
encobj = AES.new(secret, AES.MODE_CFB, myiv)
Would someone help me understand what is happening here please?
I'm guessing on both encode and decode the 'myiv' string should be identical...
but I'm unsure?
https://www.dlitz.net/software/pycrypto/api/current/Crypto.Cipher.AES-module.html#new
shows it in use, but with no explanation?
TIA
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
More information about the pycrypto
mailing list