This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to check the correctness of encryption on Big Brother

Hi all! I want to check work of AES encryption. Some code on 51822:

        uint8_t aesKey[]= {0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x31,0x32,0x33,0x34,0x35,0x36};
     uint8_t aesS[]= {0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31};
     uint8_t aesD[16];

nrf_ecb_set_key(aesKey);
nrf_ecb_crypt(aesD,aesS);

Result of this in aesD:

A6 9F B3 6C 1D EC 51 A1 F9 45 FB 40 A9 1C 59 24 

Now, I check this from Linux openssl:

#!/bin/bash

key128="1234567890123456"
iv="1234567890123456"
openssl enc -aes-128-ecb -nopad -nosalt -e -in test -out test.enc -K $key128 -iv $iv -p



exit 0

in file test:

1111111111111111

But, in file test.enc I have absolutely other values:

 E1 54 3B 33 9E B6 64 CA EA E0 9C 2B CB 1E BF BB 

What am I doing wrong?

Thank you in advance.

Related