I am trying to use python 3.7.3 to encrypt a given plaintext with a given key and a given iv. I am unfamiliar with python encryption libraries but have looked around for a couple hours trying to figure this out, and I am unable to.
I have tired using the pycryptodome library as I have been unable to use crypto and pycrypto (keep getting errors when I install them, maybe because I am on windows?).
from Crypto.Cipher import AES from Crypto.Util import Counter data = b"plaintext" key = b"5A557AC90890B2ACD59C536FE4279BBC" iv = b"5A557AC90890B2ACD59C536FE4279BBC" counter = Counter.new(128, initial_value=iv) cipher = AES.new(key, AES.MODE_CTR, counter=counter) enc = cipher.encrypt(data) print(enc)
My end result is to print out the encrypted string, but currently I am getting various errors such as "not supported between instances of 'bytes' and 'int'"