0

code looks something like this:

    from Crypto.Cipher import AES
    import os
    import base64

    def decryption(encryptedString):
        PADDING ='{'
        DecodeAES=lambda c, e:c.decrypt(base64.b64decode(e)).rstrip(PADDING)
        a = open('private_key0.pem','rb')
        key = a.read()
        print(key)
        cipher = AES.new(key)
        decoded = DecodeAES(cipher,encryptedString)
        print (decoded)
        a.close()

    s = open('session_key0.eaes','rb')
    cipher_text = s.read()
    print(cipher_text)
    s.close()

    decryption(cipher_text)

error is in line cipher = AES.new(key) and decryption(cipher_text) saying missing mode.Do i need to encrypt the already excrypted files or what?

  • A cypher mode is CBC, GCM, CTR etc. You need to check the Python documentation to see what modes are available and select one of them. – rossum Apr 22 '20 at 11:16
  • thank you ill look into it, is there anything else that's wrong with the code that wouldn't let me decrypt the session key with the private key ive been given? thank you so much – Nimra Asif Apr 22 '20 at 19:52
  • I'm afraid my Python is not up to that. Sorry. – rossum Apr 22 '20 at 20:25

0 Answers0