Clinically Awesome
Jason Mansfield is a Linux engineer, code hacker, and crazy thinker that rambles in San Diego.
CBC-MAC on the command line
openssl enc -e -aes-128-cbc -K 0123456789ABCDEF -iv 0000000000000000 < testdata | tail -c 16 | od -h
The 16 “tail -c 16” corresponds to the block size of the encryption algorithm. If you were using aes-256-cbc you’d want to say 32 instead of 16. I don’t like the “od -h” representation but hex is more common and I care to dig through and just get hex. You could instead use | openss enc -e -base64 if you prefer base64.