lib/symmetric_encryption/key.rb in symmetric-encryption-4.1.0.beta1 vs lib/symmetric_encryption/key.rb in symmetric-encryption-4.1.0

- old
+ new

@@ -9,10 +9,11 @@ @cipher_name = cipher_name end def encrypt(string) return if string.nil? + string = string.to_s return string if string.empty? # Creates a new OpenSSL::Cipher with every call so that this key instance is thread-safe. openssl_cipher = ::OpenSSL::Cipher.new(cipher_name) @@ -24,9 +25,10 @@ result << openssl_cipher.final end def decrypt(encrypted_string) return if encrypted_string.nil? + encrypted_string = encrypted_string.to_s encrypted_string.force_encoding(SymmetricEncryption::BINARY_ENCODING) return encrypted_string if encrypted_string.empty? # Creates a new OpenSSL::Cipher with every call so that this key instance is thread-safe.