things4u / LoRa-Thing

Make one or more Things as a PoC for LoRa
45 stars 32 forks source link

Problem with encryption? #2

Open solars opened 6 years ago

solars commented 6 years ago

Hi there,

I seem to have a problem with encryption using the example. Somehow TTN does not decrypt or decrypts wrong. I've outlined it in this discussion: https://www.thethingsnetwork.org/forum/t/decrypt-aes-encoded-payload/11615/7

Is there anything wrong?

dhakkest commented 6 years ago

I think the Encrypt_Payload function uses the wrong key. The function in Encrypt_V30.cpp encrypts the payload with: AES_Encrypt(Block_A,NwkSkey); This should be: AES_Encrypt(Block_A,AppSkey);

Batigolle commented 6 years ago

I verified that the solution proposed by dhakkest is correct. I changed line 86 in the encrypt_v30.cpp file, the decrypts works !