While working through recipe 1 (Protecting Information with Symmetric Ciphers), I am getting an error in Ruby 1.9 that I don’t see in Ruby 1.8:
$ ruby1.9 symmetric_cipher.rb
ciphertext non-base64 length: 85
final': wrong final block length (OpenSSL::Cipher::CipherError)
from symmetric_cipher.rb:10:in '
This is the call to Cipher.final.
Any insight into this? I thought perhaps the 1.9 bindings for OpenSSL changed padding behavior. I have tried modifying the Cipher.padding value for 32-byte/256 bit but that doesn’t seem to make a difference.
I’m on a MacBook Pro, OS X 10.6.1. Both my ruby 1.8 and 1.9 are via MacPorts, and I have the MacPorts openssl 0.9.8k installed. Everything on my system is updated to the latest versions.
Thanks for any thoughts!
Sincerely, Todd Fiala