if cipher_key.blank? || text.blank?
text
else
- c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
+ c = OpenSSL::Cipher.new("aes-256-cbc")
iv = c.random_iv
c.encrypt
c.key = cipher_key
return text
end
text = match[1]
- c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
+ c = OpenSSL::Cipher.new("aes-256-cbc")
e, iv = text.split("--").map {|s| Base64.decode64(s)}
c.decrypt
c.key = cipher_key
def cipher_key
key = Redmine::Configuration['database_cipher_key'].to_s
- key.blank? ? nil : Digest::SHA256.hexdigest(key)
+ key.blank? ? nil : Digest::SHA256.hexdigest(key)[0..31]
end
-
+
def logger
Rails.logger
end
object.send :write_attribute, attribute, clear
raise(ActiveRecord::Rollback) unless object.save(:validation => false)
end
- end
- end ? true : false
+ end ? true : false
+ end
end
private