module Helpema::GPG

Attributes

version[RW]

Public Instance Methods

decrypt(passphrase:, string:nil, output:nil, input:nil, ioin:nil, ioout:nil) click to toggle source
# File lib/helpema/gpg.rb, line 65
def decrypt(passphrase:,
            string:nil,
            output:nil,
            input:nil,
            ioin:nil,
            ioout:nil)
  unless [string,input,ioin].count{_1} == 1
   raise "Need only one of string, input, or ioin"
  end
  raise "Can't have both output and ioout" if output and ioout
  GPG.cryptor(decrypt:    true,
              passphrase: passphrase,
              string:     string,
              input:      input,
              output:     output,
              ioin:       ioin,
              ioout:      ioout)
end
encrypt(passphrase:, string:nil, output:nil, input:nil, ioin:nil, ioout:nil) click to toggle source
# File lib/helpema/gpg.rb, line 46
def encrypt(passphrase:,
            string:nil,
            output:nil,
            input:nil,
            ioin:nil,
            ioout:nil)
  unless [string,input,ioin].count{_1} == 1
    raise "Need only one of string, input, or ioin"
  end
  raise "Can't have both output and ioout" if output and ioout
  GPG.cryptor(symmetric:  true,
              passphrase: passphrase,
              string:     string,
              input:      input,
              output:     output,
              ioin:       ioin,
              ioout:      ioout)
end