i am trying to use hybrid cryptography to encrypt plaintext using AES DES and blowfish. encryption is successful but decryption gives the error object has no attribute cipher

code snippet

class AEScipher1:

    def encryptAES(self,ct1):

            self.pass_phrase = os.urandom(16)
            self.secret_key = generate_secret_key(self.pass_phrase)
            f= open("AESkey.txt",'w')
            cipher= AESCipher(self.secret_key)
            self.raw_text = ct1
            self.encrypt_text= cipher.encrypt(self.raw_text)
            #assert raw_text != encrypt_text
            return self.encrypt_text

    def decryptAES (self,CT3):

            #pass_phrase = os.urandom(16)
            #secret_key = generate_secret_key(pass_phrase)

            # generate cipher
            #cipher = AESCipher(secret_key)

            self.raw_text =CT3

            decrypt_text = self.cipher.decrypt(self.raw_text) => #PROBLEM ('AEScipher1' object has no attribute 'cipher')
            #assert encrypt_text != decrypt_text
            #assert decrypt_text == raw_text     
            return decrypt_text


0 Answers