Upgraded Ruby to 2.4.2, fixed OpenSSL warnings, and 3 gems

This commit is contained in:
Al Snow
2017-09-25 12:58:06 -04:00
parent c242fb27e3
commit 20635993c8
9 changed files with 414 additions and 19 deletions
+6 -6
View File
@@ -2,19 +2,19 @@ module Encryption
# Added a re-usable encryption routine, shouldn't be an issue!
def self.encrypt_sensitive_value(val="")
aes = OpenSSL::Cipher::Cipher.new(cipher_type)
aes = OpenSSL::Cipher.new(cipher_type)
aes.encrypt
aes.key = key
aes.iv = iv if iv != nil
aes.key = key[0..31]
aes.iv = iv[0..15] if iv != nil
new_val = aes.update("#{val}") + aes.final
Base64.strict_encode64(new_val).encode('utf-8')
end
def self.decrypt_sensitive_value(val="")
aes = OpenSSL::Cipher::Cipher.new(cipher_type)
aes = OpenSSL::Cipher.new(cipher_type)
aes.decrypt
aes.key = key
aes.iv = iv if iv != nil
aes.key = key[0..31]
aes.iv = iv[0.15] if iv != nil
decoded = Base64.strict_decode64("#{val}")
aes.update("#{decoded}") + aes.final
end