Python Forum
Problem with using Crypto library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with using Crypto library
#1
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
Reply
#2
hello, any one can delete this topic? I dont see option to delete by myself :)
Reply
#3
We don't delete threads.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem installing library thunderspeed 2 555 Mar-22-2020, 11:04 PM
Last Post: thunderspeed
  Python crypto byte plaintext to hexint Mangaz90 2 691 Feb-21-2020, 07:42 PM
Last Post: Mangaz90
  Problem importing resource library ChrisM 8 826 Oct-23-2019, 01:40 PM
Last Post: ChrisM
  Create file archive that contains crypto hash ED209 1 518 May-29-2019, 03:05 AM
Last Post: heiner55
  crypto import issue saisankalpj 2 3,806 Dec-20-2018, 06:08 AM
Last Post: saisankalpj
  AES encryption - does not match between arduino and python 3 crypto guillaume55 0 1,932 Sep-23-2018, 11:14 AM
Last Post: guillaume55
  Problem Using Python Library abir99 8 2,329 Nov-21-2017, 03:12 PM
Last Post: sparkz_alot
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 2,434 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020