Hi team, Good day.
I have 8 bytes of data. I'm using psa_aead_encrypt to encrypt the data and psa_aead_decrypt function to decrypt the data.
After performing encryption (using AES 128 key, so after encryption my data will become 16 bytes) and I'm sending that data as 2 CAN frames.
After receiving 2 frames(16 bytes) of data even though the data content is equal decryption is failing. Could you please help to resolve this problem
Thanks in advance
Best regards:
Kavya
Hello,
Without the AES encryption/decryption do you get the same CAN data ?
Is the CAN peripheral on loopback mode ?
Which AES algorithm do you use ?
Regards
Hi,
Yes Without encryption/decryption I'm receiving the original data.
After encryption I'm sending data on CAN bus. I'm receiving the encrypted data properly and I'm storing that encrypted in a buffer. But while performing decryption it is returning with value -149.
Yes I'm using CAN external loopback mode
I'm using AES PSA_ALG_CCM with key length of 128 bits
Hi, shall I share my code for reference?
Yes, please do this.
can_enc.zip
Please find the attached project
Thank you
The CAN communication is working fine so this is an encryption/decryption problem.
There is an example on AES-GCM mode which you can refer to:
github.com/.../mbed_crypto_ek_ra6m1_ep
Hi, thanks for the response.
I have already gone through the above mentioned example.
In my workspace(can_enc) decryption is working properly when I'm not using CAN bus, after receiving the CAN data when I am passing the CAN data, decryption is failing. Could you please suggest why is this happening? We are trying since 15 days.
Why do you send data 2 times ?
because in CAN protocol we can send only 8 bytes(64 bits) of data at a time and after encryption data will become 128bits i.e 16 bytes, so I'm sending 2 times
Did you check why the encrypt/decrypt are failing - the return status is very specific?