I'm trying to convert the following Javascript code to python:
cryptoJs.AES.encrypt("secrettext", cryptoJs.enc.Base64.parse("QWJjZGVmZ2hpamtsbW5vcA=="), { iv: cryptoJs.enc.Base64.parse("AAAAAAAAAAAAAAAAAAAAAA==")}).ciphertext.toString(cryptoJs.enc.Base64)
I've been trying to figure out the python equivalent of the different parts (key and iv), but nothing is working. This is what I last tried but was given an error that my IV was the incorrect length:
key = b"QWJjZGVmZ2hpamtsbW5vcA=="
iv = b"AAAAAAAAAAAAAAAAAAAAAA=="
text = b"secrettext"
base64_key = base64.b64encode(key)
base64_iv = base64.b64encode(iv)
padtext=pad(text,16,style='pkcs7')
encryptor = AES.new(base64_key, AES.MODE_CBC, base64_iv)
result = encryptor.encrypt(padtext)
print(binascii.hexlify(result))