I do as is written to specifications, but I can't receive the correct result. I have all components of the Ai-block (in 4.3.3.1
).
That is: Dir = [0]
, DevAddr = [97,-112,-110,-87]
, FCnt = [10,0]
, i = [1]
thus my Ai-block is:[1,0,0,0,0,0,97,-112,-110,-87,0,0,10,0,0,1].
Then I encrypt this Ai-block. Then I append zero octets to my FRMPayload so that the length of the data is a multiple of 16.
My FRMPayload is [-28] and my sent data is [AA]. And then I XOR this:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-28]
^[77,24,-11,70,-97,-54,62,-126,-23,63,101,-36,-66,-91,-11,-46]
But after that a don't see my original data. What i'm doing wrong? May be I mix up sequence of bytes in Ai-block? My aes128_ecnript function work good, I checked in AES Symmetric Ciphers Online.