Question

I'm working on converting a Java program into Python and part of its core networking uses AES encryption to handle packets going up and down the line. Java's AES is initialized like so:

byte[] key = { 0x13, 0x00, 0x00, 0x00 };
sKeySpec = new SecretKeySpec(key, "AES");

I want to do the same in Python, and will use PyCrypto, but I'm not sure how to initialize the above in it as it only allows string-based "secret keys."

Was it helpful?

Solution

Use a string then

key = '\x13\x00\x00\x00'

OTHER TIPS

Why Don't you Try using Jython , because You can directly import the .class file without having to re-write it .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top