lib/keen/aes_helper.rb in keen-0.9.7 vs lib/keen/aes_helper.rb in keen-0.9.8

- old
+ new

@@ -15,9 +15,10 @@ aes.iv = unhexlify(iv) aes.update(unhexlify(encrypted)) + aes.final end def aes256_encrypt(key, plaintext, iv = nil) + raise OpenSSL::Cipher::CipherError.new("iv must be 16 bytes") if !iv.nil? && iv.length != 16 aes = OpenSSL::Cipher::AES.new(256, :CBC) aes.encrypt aes.key = unhexlify(key) aes.iv = iv unless iv.nil? iv ||= aes.random_iv