Skip to content

Commit

Permalink
Merge pull request jmazzi#27 from rwc9u/iv_randomness
Browse files Browse the repository at this point in the history
Fix for OpenSSL::Cipher::CipherError: iv length too short
  • Loading branch information
jmazzi committed Jan 7, 2013
2 parents dbe922c + 6e26eb5 commit 3769caf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/crypt_keeper/provider/aes.rb
Expand Up @@ -33,9 +33,7 @@ def initialize(options = {})
def encrypt(value)
aes.encrypt
aes.key = key
iv = rand.to_s
aes.iv = iv
Base64::encode64("#{iv}#{SEPARATOR}#{aes.update(value.to_s) + aes.final}")
Base64::encode64("#{aes.random_iv}#{SEPARATOR}#{aes.update(value.to_s) + aes.final}")
end

# Public: Decrypt a string
Expand Down

0 comments on commit 3769caf

Please sign in to comment.