user3602322
user3602322

Reputation: 75

Openssl aes encryption seems not to work for me

I tried to use aes-256-ebc encryption with Openssl, but it seems my output is not what I expected. The key and test vectors I used are taken from http://www.inconteam.com/software-development/41-encryption/55-aes-test-vectors#aes-ecb-256

My input is the following:

openssl enc -aes-256-ecb -in in.bin -nosalt -out out.bin -kfile k.bin -nopad

For example, I'm using 6bc1bee22e409f96e93d7e117393172a as test vector.

My out.bin is:

BD E8 25 14 C9 30 E8 86 CA B7 55 93 D7 B3 AB F1

instead of:

f3eed1bdb5d2a03c064b5a7e3db181f8

My question is if I'm using Openssl the wrong way or what could have caused this mistake?

Upvotes: 1

Views: 394

Answers (1)

Maarten Bodewes
Maarten Bodewes

Reputation: 93948

Oh well, time to test my command line fu. Didn't know I still had any :)

echo "6bc1bee22e409f96e93d7e117393172a" | perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | openssl enc -e -aes-256-ecb -K `cat key.hex` | xxd -p

Upvotes: 1

Related Questions