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

2015-10-09 Thread Erwann Abalea
Bonjour,

> Le 9 oct. 2015 à 12:20, karel-de-ma...@wanadoo.fr a écrit :
> 
[…]
> 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
> 000 S i n g l e b l o c k m s g
> 020
> openssl enc -nosalt -aes-128-cbc -in clear3.txt -e -out test.enc -K 
> 06a9214036b8a15b512e03d534120006 -iv 3dafba429d9eb430b422da802c9fac41
> 
> :~/git/aes/openssl$ od -x test.enc
> 000 53e3 9c77 7910 b8ae 0827 2d94 77be 1a18
> 020 7cb9 5e82 781c 4651 2d54 6939 bc41 5de5
> 040
> 
> The first 16 bit are the answer given but what are the 16 following one ?

Padding, so the decryption process knows how many useful octets were encrypted. 
In your case, since the block is full, padding adds another block.

> 
> 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
> 000 1100 3322 5544 7766 9988 bbaa ddcc ffee
> 020
> :~/git/aes/openssl$ openssl enc -nosalt -in clear2.txt -out encrypted.dat -e 
> -aes-128-cbc -k 000102030405060708090a0b0c0d0e0f -iv 
> 

-k is not the same as -K.


Cordialement,
Erwann Abalea

___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


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

2015-10-09 Thread karel-de-macil
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
000 S i n g l e b l o c k m s g
020
openssl enc -nosalt -aes-128-cbc -in clear3.txt -e -out test.enc -K 
06a9214036b8a15b512e03d534120006 -iv 3dafba429d9eb430b422da802c9fac41

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


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
000 1100 3322 5544 7766 9988 bbaa ddcc ffee
020
:~/git/aes/openssl$ openssl enc -nosalt -in clear2.txt -out encrypted.dat -e 
-aes-128-cbc -k 000102030405060708090a0b0c0d0e0f -iv 


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

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-ma...@wanadoo.fr
___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users