[pycrypto] Unicode?

Dave Pawson dave.pawson at gmail.com
Mon Feb 3 01:39:43 PST 2014


I'm having a problem 'sharing' an encrypted file between
MSDOS and Linux.

so I thought I'd replace \nl in the plain text with a non ASCII
character prior to encryption.

encryptor = AES.new(key, AES.MODE_CBC, iv)
outfile.write(encryptor.encrypt(chunk))

gives me

 File "/usr/lib64/python2.7/site-packages/Crypto/Cipher/blockalgo.py",
line 244, in encrypt
    return self._cipher.encrypt(plaintext)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in
position 34: ordinal not in range(128)


It would seem I can't use non-ASCII characters, at least with AES, is
this right ?

If not, how to address it please?


regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk


More information about the pycrypto mailing list