Object
Contians the details used to encrypt specified file, is what actually does any encryption.
The path to the file which GPG Will be encrypting and the path where you want the encrypted file to be output.
# File lib/gpgr.rb, line 79 def initialize(path, output_path) @file = File.expand_path(path) if output_path == path + '.pgp' @file_output = @file + '.pgp' else @file_output = File.expand_path(output_path) end @email_addresses = [] end
Encrypts the current file for the list of recipients specific (if they are valid)
# File lib/gpgr.rb, line 105 def encrypt bad_key = @email_addresses.empty? if File.exists?(@file) unless File.readable?(@file) raise InvalidFileException.new("File at #{@file} is not readable.") and return end else raise InvalidFileException.new("File at #{@file} does not exist.") and return end @email_addresses.each do |add| unless Gpgr::Keys.public_key_installed?(add) bad_key = true end end if bad_key raise InvalidEmailException.new("One or more of the e-mail addresses you supplied don't have valid keys assigned!") else command = Gpgr.command + " -q --no-verbose --yes -a -o #{@file_output} -r " + @email_addresses.join(' -r ') + " -e #{@file}" system(command) end end
Generated with the Darkfish Rdoc Generator 2.