lib/eeny-meeny/models/encryptor.rb in eeny-meeny-2.2.0 vs lib/eeny-meeny/models/encryptor.rb in eeny-meeny-2.2.1
- old
+ new
@@ -90,11 +90,11 @@
# Encrypt
#
# Encrypts the given message with a random IV, then returns the ciphertext
# with the IV prepended.
def encrypt_message(message)
- aes = OpenSSL::Cipher::Cipher.new(@cipher).encrypt
+ aes = OpenSSL::Cipher.new(@cipher).encrypt
aes.key = @encryption_key
iv = aes.random_iv
aes.iv = iv
iv + (aes.update(message) << aes.final)
end
@@ -103,10 +103,10 @@
#
# Pulls the IV off the front of the message and decrypts. Catches
# OpenSSL errors and returns nil. But this should never happen, as the
# verify method should catch all corrupted ciphertexts.
def decrypt_ciphertext(ciphertext)
- aes = OpenSSL::Cipher::Cipher.new(@cipher).decrypt
+ aes = OpenSSL::Cipher.new(@cipher).decrypt
aes.key = @encryption_key
iv = ciphertext[0, aes.iv_len]
aes.iv = iv
crypted_text = ciphertext[aes.iv_len..-1]
return nil if crypted_text.nil? || iv.nil?