模组:WBR1D,tuyaos:3.3.4
使用aes_inf.h头文件里的aes128_ecb_decode_raw解密接口解密错误,解密出来的数据不对,麻烦帮忙看下同样的数据,加密成功了,用同一个Key就解密不出来,以下为代码片段
Code: Select all
BYTE_T data1[] ="b4046667e3c549673aa75369b605f342";
BYTE_T datakey1[] ="6r4mq0ptoan2wf70";
//UINT32_T outlen1 = 0;
BYTE_T outdata1[33] = {0};
aes128_ecb_decode_raw(data1, strlen(data1), outdata1, datakey1);
TAL_PR_INFO("data1;%s", data1);
TAL_PR_INFO("strlen(data1);%d", strlen(data1));
TAL_PR_INFO("outdata1;%s", outdata1);
TAL_PR_INFO("strlen(outdata1);%d", strlen(outdata1));
TAL_PR_INFO("datakey1;%s", datakey1);
TAL_PR_DEBUG("AES_DE2: ");
memset(dataget,0,32);
for (int j = 0; j < strlen(outdata1); j++) {
memset(cat,0,8);
sprintf(cat,"%02x",outdata1[j]);
strcat(dataget,cat);
}
TAL_PR_INFO("dedataget;%s", dataget);
aes_free_data(outdata1);
以下为日志内容
Code: Select all
[2024-03-06 08:27:34.144]# RECV ASCII>
I][tuya_app_main.c:268] data1;b4046667e3c549673aa75369b605f342
[01-01 08:00:03 TUYA I][tuya_app_main.c:269] strlen(data1);32
[01-01 08:00:03 TUYA I][tuya_app_main.c:270] outdata1;?
[01-01 08:00:03 TUYA I][tuya_app_main.c:271] strlen(outdata1);2
[01-01 08:00:03 TUYA I][tuya_app_main.c:272] datakey1;6r4mq0ptoan2wf70
[01-01 08:00:03 TUYA D][tuya_app_main.c:273] AES_DE2:
[01-01 08:00:03 TUYA I][tuya_app_main.c:280] dedataget;9231