Python Forum

Full Version: Problem with using Crypto library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello my execute error are
Error:
“Traceback (most recent call last): File "main.py", line 151, in <module> File "main.py", line 113, in menu File "main.py", line 64, in start_encryption File "symmetric.py", line 20, in encrypt File "site-packages/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length”
It happen when i exec command (only with several files)
encrypted = AES_obj.encrypt(file_content)
I know that it file_content length problem, but how solve this problem if i dont want to mess with file structure (now i'll encrypt it and next time i need to decrypt it to orginal state)

Some more code
def start_encryption(files):
    AES_and_base64_path = []
    for found_file in files:
        key = generate_keys.generate_key(128, True)
        AES_obj = symmetric.AESCipher(key)

        found_file = base64.b64decode(found_file)
        print(found_file)
        try:
            with open(found_file, 'rb') as f:
                file_content = f.read()
        except:
            continue

#       print(file_content)
        encrypted = AES_obj.encrypt(file_content)
#       print(encrypted)
        utils.shred(found_file)
Best regards
~Reks
hello, any one can delete this topic? I dont see option to delete by myself :)
We don't delete threads.