Hi,
I wrote the following enc/dec code;
AES_KEY enc_key, dec_key;
AES_set_encrypt_key((unsigned char*)p_key, 128, &enc_key);
AES_ecb_encrypt((unsigned char*)textManip, (unsigned char*)enc_out, &enc_key, 1);
AES_set_decrypt_key((unsigned char*)p_key, 128, &dec_key);
AES_decrypt((unsigned char*)enc_out, (unsigned char*)dec_out, &dec_key);
AES_KEY enc_key, dec_key;
AES_set_encrypt_key((unsigned char*)p_key, 128, &enc_key);
AES_ecb_encrypt((unsigned char*)textManip, (unsigned char*)enc_out, &enc_key, 1);
AES_set_decrypt_key((unsigned char*)p_key, 128, &dec_key);
AES_decrypt((unsigned char*)enc_out, (unsigned char*)dec_out, &dec_key);
To copy to clipboard, switch view to plain text mode
& to test it;
qDebug() << "Original: " << (char*)(text);
enc_out[strlen(p_Text)] = '\0';
qDebug() << "Encrypted: " <<(enc_out);
dec_out[strlen(p_Text)] = '\0';
qDebug() << "Decrypted: " << (dec_out);
qDebug() << "Original: " << (char*)(text);
enc_out[strlen(p_Text)] = '\0';
qDebug() << "Encrypted: " <<(enc_out);
dec_out[strlen(p_Text)] = '\0';
qDebug() << "Decrypted: " << (dec_out);
To copy to clipboard, switch view to plain text mode
the output is;
Original: WirofonPC010101
Encrypted: ??c?'r???)?A?
Decrypted: WirofonPC010101
which seems ecryption is working. But I somehow thought that my encrypted characters are no good. I mean Shouldn't they like
"31298sdf788123" or "122dfsdrwer324" ??
Thanks..
Bookmarks