Skip to content
Snippets Groups Projects
Commit bac460fa authored by alexey.stratulat's avatar alexey.stratulat
Browse files

[*] The algorithm IAES 256CBC in unit test has been fixed.

parent ce2f023c
No related branches found
No related tags found
1 merge request!26Support 3689
import libdap_crypto_python_module as crypto import libTPO
import sys import sys
print ("Start test crypto iaes256 CBC") print ("Start test crypto iaes256 CBC")
s = "Test! I will crush iaes256!" s = "Test! I will crush iaes256!"
print ("Input data: "+s)
kex_buff = bytes("123", "utf-8") kex_buff = bytes("123", "utf-8")
size_kex_buff = len(kex_buff) size_kex_buff = len(kex_buff)
seed = bytes(112771128) seed = bytes(112771128)
seed_size = len(seed) seed_size = len(seed)
crypto.init() libTPO.init()
key_id = crypto.generateNewKey(0, kex_buff, size_kex_buff, seed, seed_size, 0) key_id = libTPO.Crypto.generateNewKey(0, kex_buff, size_kex_buff, seed, seed_size, 0)
print(key_id)
source = bytes(s, "utf-8") source = bytes(s, "utf-8")
enc = crypto.encryptIAES256CBCFast(key_id, source, len(source), 2048) enc = libTPO.Crypto.encryptIAES256CBCFast(key_id, source, len(source), 2048)
decrypt = crypto.decryptIAES256CBCFast(key_id, enc, len(enc), 2048) decrypt = libTPO.Crypto.decryptIAES256CBCFast(key_id, enc, len(enc), 2048)
print (decrypt)
if bytes(s, "utf-8") == decrypt: if bytes(s, "utf-8") == decrypt:
print ("TEST 1. Encode/Decode IAES256 CBC FAST done") print ("TEST 1. Encode/Decode IAES256 CBC FAST done")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment