AES256 in PyCrypto

mirandacascade at yahoo.com mirandacascade at yahoo.com
Sat Jan 6 20:49:02 EST 2007


Attempting to determine whether the PyCrypto package has the capability
to perform AES256 encryption.  I received the following C# snippet:

CryptoProvider provider = new CryptoProvider();
Encrypted_Type password = new Encrypted_Type();
password.EncryptedData = new EncryptedDataType();
password.EncryptedData.EncryptionMethod = new EncryptionMethodType();
password.EncryptedData.EncryptionMethod.Algorithm = "AES256-cbc";

and I was told that it was the setup code for code that later on
performs AES256 encryption.  I'm assuming that setting the Algorithm
property is what informs the system as to the type of encryption to
perform.  I included the above snippet as a reference point, because
I'm attempting to understand how to do something equivalent in Python.

Would the following Python code perform AES256 encryption on plainText
from Crypto.Cipher  import AES
x = AES.new(a, AES.MODE_CBC, iv)
x.encrypt(plainText)

assuming:
a = the key value
iv = an initialization vector
?

If the above Python code does not perform AES256 encryption:
a) is there functionality within PyCrypto that allows one to perform
AES256 encryption?
b) if such functionality does not exist in PyCrypto, does it exist in
some other Python package?

Operating System: Windows XP
Vsn of Python: 2.4

Thank you.




More information about the Python-list mailing list