Sha256: 8c73d0ad1cc2597a40b44fe50d7e66421f2b759fde2d136f873d44239c6af3b8
Contents?: true
Size: 1.36 KB
Versions: 38
Compression:
Stored size: 1.36 KB
Contents
module Encryption def self.encrypt(text, password) EncryptionTools.encrypt_and_armour(text, password) end def self.decrypt(text, password) EncryptionTools.dearmour_and_decrypt(text, password) end def self.menus Redcar::Menu::Builder.build do sub_menu "Plugins" do sub_menu "Encryption", :priority => 55 do item "Encrypt Document", EncryptDocumentCommand item "Decrypt Document", DecryptDocumentCommand end end end end def self.lazy_load require File.dirname(__FILE__) + "/jarmor-1.1" require File.dirname(__FILE__) + "/ezcrypto" end class DecryptDocumentCommand < Redcar::EditTabCommand def execute Encryption.lazy_load result = Redcar::Application::Dialog.input("Password", "Enter password") return if result[:button] == :cancel pw = result[:value] begin doc.text = Encryption.decrypt(doc.to_s, pw) rescue => e Redcar::Application::Dialog.message_box("Couldn't decrypt!", :type => :error) end end end class EncryptDocumentCommand < Redcar::EditTabCommand def execute Encryption.lazy_load result = Redcar::Application::Dialog.input("Password", "Enter password") return if result[:button] == :cancel pw = result[:value] doc.text = Encryption.encrypt(doc.to_s, pw) end end end
Version data entries
38 entries across 38 versions & 2 rubygems