Sha256: c873766924c5961c9f49af804fa90e97da999e15b2f5f452ae8f3553b49420c6
Contents?: true
Size: 1.19 KB
Versions: 9
Compression:
Stored size: 1.19 KB
Contents
module Encryption def self.menus Redcar::Menu::Builder.build do sub_menu "Plugins" do sub_menu "Encryption" do item "Encrypt Document", EncryptDocumentCommand item "Decrypt Document", DecryptDocumentCommand end end end end def self.lazy_load $:.push File.expand_path(File.join(Redcar.root, "openssl", "lib")) require 'openssl' 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 = EncryptionTools.dearmour_and_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 = EncryptionTools.encrypt_and_armour(doc.to_s, pw) end end end
Version data entries
9 entries across 9 versions & 1 rubygems