I am trying to decrypt some data. My data is encrypted using AES-ECB No padding method. I know the 32Byte key used for decryption. Following is the code snippet. I am not getting desired decrypted data. Any comments on this?
//key
uint8_t key[32]= {0x5A,0x34,0xF5,0xF2,0xBB,0x0C,0x6F,0xEF,0x8E,0x94,0x80,0xDE,0xE1,0x31,0x6C,0x51};
//input buffer
uint8_t ibuf[16]={0x3D,0xB7,0x7B,0x40,0x6B,0x1D,0x5B,0x38,0xA3,0xCF,0x34,0xFB,0x27,0xD8,0x3B,8E};
//output buffer to store decrypted data
uint8_t obuf[16];
//init
nrf_ecb_init();
nrf_ecb_set_key(key);
//call to decrypt data
if (true == nrf_ecb_crypt(obuf, ibuf))
{
printf("\n done");
}
else
{
printf("\n failed");
}
Using following online tool, I am able to get correct output: http://aes.online-domain-tools.com/
obuf must have following output:
0x5A,0x34,0xF5,0xF2,0xBB,0x0C,0x6F,0xEF