Sha256: b23286cc6641cf6d88a40f194205822bf47e8e1ddfb461164b1b9551dfc3c60a

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require 'openssl'
require File.dirname(__FILE__) + "/jarmor-1.1"
require File.dirname(__FILE__) + "/ezcrypto"

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

  class DecryptDocumentCommand < Redcar::EditTabCommand
    def execute
      result = Redcar::Application::Dialog.input(win, "Password", "Enter password")
      pw = result[:value]
      begin
        doc.text = EncryptionTools.dearmour_and_decrypt(doc.to_s, pw)
      rescue => e
        Redcar::Application::Dialog.message_box(win, "Couldn't decrypt!", :type => :error)
      end
    end
  end
  
  class EncryptDocumentCommand < Redcar::EditTabCommand
    def execute
      result = Redcar::Application::Dialog.input(win, "Password", "Enter password")
      pw = result[:value]
      doc.text = EncryptionTools.encrypt_and_armour(doc.to_s, pw)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redcar-0.3.4.3 plugins/encryption/encryption.rb
redcar-0.3.4.2 plugins/encryption/encryption.rb
redcar-0.3.4.1 plugins/encryption/encryption.rb
redcar-0.3.4 plugins/encryption/encryption.rb
redcar-0.3.3 plugins/encryption/encryption.rb