Beispiel #1
0
    def test_decript_aes(self):
        if self.SKIP_C7_PLAINTEXT_RECREATION:
            return
        cipher_address = 'tests/resources/aes128ecb.txt'
        secret_address = 'tests/resources/c7decript.txt'
        key = b'YELLOW SUBMARINE'

        cipher = read_cipher_file(cipher_address)
        secret = aes.decrypt_aes_ecb(cipher, key).decode('utf-8')

        secret_file = open(os.getcwd() + "/" + secret_address, "w")
        secret_file.write(secret)
        secret_file.close()
Beispiel #2
0
 def test_ecb_integration(self):
     key = b'YELLOW SUBMARINE'
     cipher = read_cipher_file('tests/resources/aes128ecb.txt')
     secret = aes.decrypt_aes_ecb(cipher, key)
     assert cipher == aes.encrypt_aes_ecb(secret, key), \
         "ECB integration failure, cipher != encrypt(decrypt(cipher))"