AES Standard Examples confusion

I am integrating with a 3rd party using AES encryption. Our encryption
and theirs do not match up, So I set to find some standard examples. I
found some test vectors/known examples at
http://www.inconteam.com/software-development/41-encryption/55-aes-test-vectors.

I used these samples to create some tests to see what cases were not
working. The good news is that decrypting something I have encrypted
results in what I have started with. The bad news is that none of the
examples matches the expectation.

The code is here:

At this point I am assuming that I’ve messed it up some how, but I am
open to other explanations.
I’m going to keep looking around to see if I can find tests for openssl.

Thanks!

The test vectors are hexadecimal and you’re using base64

Thanks for the feedback!

I’ve ripped out the base64 encoding decoding, though i’ll be providing
wrapper methods for that once I get everything sorted out.

I am now converting the strings from hexdigest to hex strings and things
are much better!

All of the specs pass except those having to do with CBC cipher mode.

For CBC
decrypting after encrypting gets me back what I started with. Yay.
expected cipher_text is a substring of the actual cipher_text. ???
expected cipher_text is 16 characters long, the actual is 32 characters
long. hrm…

This is puzzling. I suppose I could have copied the examples
incorrectly, but the lengths of all of the the cbc fields seems
consistent with the other cipher modes.

It uses padding per default:

http://ruby-doc.org/stdlib-1.8.7/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-padding-3D

If your plaintext is a multiple of the block size you can do
cipher.padding
= 0 to shut it off