module EncryptDecrypt

Handles encryption and decryption of files

Public Instance Methods

decrypt(data) click to toggle source

Decrypt data

# File lib/encrypt_decrypt.rb, line 13
def decrypt(data)
  crypto = GPGME::Crypto.new
  encrypted = crypto.verify(data){|sig| sig.valid?}.read
  return crypto.decrypt(encrypted).to_s
end
encrypt_data(file_obj, recipient, signer) click to toggle source

Encrypt file

# File lib/encrypt_decrypt.rb, line 6
def encrypt_data(file_obj, recipient, signer)
  crypto = GPGME::Crypto.new
  encrypted = crypto.encrypt(file_obj, recipients: recipient, armor: true)
  return crypto.clearsign(encrypted.to_s, {signer: signer})    
end