[openssl-users] using openssl to validate an external AES program

karel-de-macil at wanadoo.fr karel-de-macil at wanadoo.fr
Fri Oct 9 10:20:56 UTC 2015


Hi all, i'm curently trying to use openssl to validate my own aes program.
The first thing i'm trying to to is to validate the return of openssl with aes-128-cbc and some entry i have found here :



https://tools.ietf.org/html/rfc3602


Case #1: Encrypting 16 bytes (1 block) using AES-CBC with 128-bit key
Key : 0x06a9214036b8a15b512e03d534120006
IV : 0x3dafba429d9eb430b422da802c9fac41
Plaintext : "Single block msg"
Ciphertext: 0xe353779c1079aeb82708942dbe77181a

the command line i launch is the following


:~/git/aes/openssl$ od -c clear3.txt
0000000 S i n g l e b l o c k m s g
0000020
openssl enc -nosalt -aes-128-cbc -in clear3.txt -e -out test.enc -K 06a9214036b8a15b512e03d534120006 -iv 3dafba429d9eb430b422da802c9fac41

:~/git/aes/openssl$ od -x test.enc
0000000 53e3 9c77 7910 b8ae 0827 2d94 77be 1a18
0000020 7cb9 5e82 781c 4651 2d54 6939 bc41 5de5
0000040


The first 16 bit are the answer given but what are the 16 following one ?


bellow that, my own program is AES-128 , not aes-128-cbc but for a msg of 16 bit only and a nul iv there should be no difference for what i understand.


but when i use the following number found here :


http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf


PLAINTEXT: 00112233445566778899aabbccddeeff
KEY:
000102030405060708090a0b0c0d0e0f


round[10].output 69c4e0d86a7b0430d8cdb78070b4c55a

i get the following

:~/git/aes/openssl$ od -x clear2.txt
0000000 1100 3322 5544 7766 9988 bbaa ddcc ffee
0000020
:~/git/aes/openssl$ openssl enc -nosalt -in clear2.txt -out encrypted.dat -e -aes-128-cbc -k 000102030405060708090a0b0c0d0e0f -iv 00000000000000000000000000000000

abel at adminstation:~/git/aes/openssl$ od -x encrypted.dat
0000000 1c0f d284 0304 2a7c fd51 6e50 2462 cef7
0000020 9a65 ecff 71d8 3aa6 8290 2233 d5ba f0d3
0000040

which is not at all what i'm expecting. So what is my error ?
when i look here :
https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29
it seems like with a null iv vectore and for a 16 bit length message, aes and aes-cbc should be the same.

where am i wrong ?

best regards and thnaks for your kind support.





Abel
Artiste en herbe,musicien , informaticien, roliste , tout et son contraire
Blog Perso
karel-de-macil at wanadoo.fr


More information about the openssl-users mailing list