Sha256: f3252ce7fab924d87ac1964fe1c99f235a05b4251785cf823dbc93851a4e7bcf
Contents?: true
Size: 1.27 KB
Versions: 23
Compression:
Stored size: 1.27 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") 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") pw = result[:value] doc.text = Encryption.encrypt(doc.to_s, pw) end end end
Version data entries
23 entries across 23 versions & 1 rubygems