Displaying 1 result from an estimated 1 matches for "cc_pass_iv".
2009 Feb 26
11
OpenSSL::Cipher decrypt returns 'wrong final block length'
...w(cipher_type)
aes.encrypt
aes.key = key
aes.iv = iv if iv != nil
aes.update(data) + aes.final
end
end
[/code]
And here is the model code where I encrypt and decrypt the string.
[code]
def encrypt_cc_pass
return if cc_pass.blank?
self.cc_pass_key = Time.now.to_s
self.cc_pass_iv = Date.today.to_s
self.encrypted_cc_pass = AESCrypt.encrypt(cc_pass, cc_pass_key,
cc_pass_iv)
end
def decrypted_cc_pass
AESCrypt.decrypt(encrypted_cc_pass, cc_pass_key, cc_pass_iv)
end
[/code]
And this is the error I get
wrong final block length in:config/initializers/aes_crypt.rb:...