Class: PGP::Decryptor

Inherits:
Object
  • Object
show all
Includes:
KeysImporter
Defined in:
lib/pgp/decryptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from KeysImporter

#add_keys, #add_keys_from_file

Instance Attribute Details

#passphraseObject

Returns the value of attribute passphrase.



5
6
7
# File 'lib/pgp/decryptor.rb', line 5

def passphrase
  @passphrase
end

Instance Method Details

#decrypt(encrypted_data) ⇒ Object



7
8
9
10
# File 'lib/pgp/decryptor.rb', line 7

def decrypt(encrypted_data)
  result = GPG::Engine.new.decrypt(encrypted_data, self.passphrase)
  result[1]
end

#decrypt_file(file_path) ⇒ Object



12
13
14
# File 'lib/pgp/decryptor.rb', line 12

def decrypt_file(file_path)
  decrypt File.read(file_path)
end