[Clug-tech] OpenSLL enc AES produces 32bytes (2 blocks) with 16byte input, why?

Simon Wood simon at mungewell.org
Sat Jan 17 11:02:31 PST 2009


This is probably a 'feature' in the way that I am doing this but... 

Using the AES cipher with an input block of 16 bytes (128bits) causes OpenSSL enc to output 2 blocks (256bits). I thought that any block <=128 bits block could/would be output as 128bits.

Any suggestion as to why more than 1 block is output, and/or how I can ensure that only 1 block is output?

Simon.

--

Get exactly 16bytes:
simon at bourne:~$ head -c 16 /dev/random | hexdump -C
00000000  ab 57 45 a2 f6 e3 93 e3  1e dd 48 c6 b1 ba d6 1d |.WE.......H.....| 
00000010

Feed this through 'enc' which outputs 32bytes/256bits:
simon at bourne:~$ head -c 16 /dev/random |  openssl enc -aes-128-cbc -nosalt -pass pass:test | hexdump -C
00000000  3f f8 1b 78 12 be d3 c1  f1 82 39 c6 84 56 87 b5 |?..x......9..V..|
00000010  40 46 f8 d3 ea d8 2d db  c7 f9 1d 8a 90 46 f4 10 |@F....-......F..|
00000020

But if I only use 15byte input, it outputs 16bytes/128bits
simon at bourne:~$ head -c 15 /dev/random |  openssl enc -aes-128-cbc -nosalt -pass pass:test | hexdump -C
00000000  ef 4e cd 48 62 b4 e4 e5  b4 06 23 f2 e8 ff a0 10 |.N.Hb.....#.....|
00000010



More information about the clug-tech mailing list