I tried to implement AES in my code and it doesn't work properly. More specifically I'm encrypting and decrypting a 16 char string with a 16 char key just to understand if AES' functions work.
I've already read the guide suggested in one of the previous post, I followed its guidelines and both aes_encrypt and aes_decrypt return 0 if everything is ok.
Here is part of my code:
char key[17] = "ciaociaociaociao"
char data[17];
char chypertext[17];
int check = aes_encrypt(key, data, chypertext);
char plaintext[17];
check += aes_decrypt(key, chypertext, plaintext);
if (!check)
obdWriteStringCustom(&obd, (GFXfont *)&DSEG14_Classic_Bold_16, 10, 120, (char *)"0", 1);
.............
Of course I used obdWriteStringCustom with all necessary libraries and it works perfectly in every other part of my code.
aes_encrypt and aes_decrypt functions return 0 value, so it seems the did their job, and they also return an "encrypted" string.
Now it comes the problem: how do those functions encrypt data? The encryption function return a string not correctly encrypted: if Itry to pass the cyphertext to an online decrypter it never return the original plaintext.
Then I can't get the original plaintext neither giving the cyphertext to aes_decrypt since decrypt returns just some random numbers.
How can I solve it?
Thank you! :)
Hi,
I think you need config online decrypter parameters,our SDK uses the original version of AES encryption.
we test it using online decrypter as below.
encrypt:
decrypt:
Thanks for help, @Soyo.
Could you gently give me the piece of code you used for testing? I'm not able to get a right result with my code, unfortunately.
How did you pass the string to aes_encrypt? Hex or char?
Thank you,
Mattia
Hi,
I think you need config online decrypter parameters,our SDK uses the original version of AES encryption.
we test it using online decrypter as below.
encrypt:
decrypt:
Thanks for help, @Soyo.
Could you gently give me the piece of code you used for testing? I'm not able to get a right result with my code, unfortunately.
How did you pass the string to aes_encrypt? Hex or char?
Thank you,
Mattia