Class: OpenPGP::Client::GnuPG

Inherits:
Object
  • Object
show all
Defined in:
lib/openpgp/client/gnupg.rb

Overview

GNU Privacy Guard (GnuPG) implementation.

See Also:

Constant Summary

VERSION =
OpenPGP::VERSION

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (GnuPG) initialize(options = {})

A new instance of GnuPG



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/openpgp/client/gnupg.rb', line 11

def initialize(options = {})
  @options = {
    :homedir => ENV['GNUPGHOME'] || '~/.gnupg',
    :version => false,
  }
  @options.merge!(options)

  if options.has_key?(:options)
    parse_options_file(options[:options])
  end
end

Instance Attribute Details

- (Object) options

Returns the value of attribute options



9
10
11
# File 'lib/openpgp/client/gnupg.rb', line 9

def options
  @options
end

Instance Method Details

- card_edit

This method returns an undefined value.

Presents a menu to work with a smartcard.

Raises:

  • (NotImplementedError)


274
275
276
# File 'lib/openpgp/client/gnupg.rb', line 274

def card_edit
  raise NotImplementedError # TODO
end

- card_status

This method returns an undefined value.

Shows the content of the smart card.

Raises:

  • (NotImplementedError)


282
283
284
# File 'lib/openpgp/client/gnupg.rb', line 282

def card_status
  raise NotImplementedError # TODO
end

- change_pin

This method returns an undefined value.

Presents a menu to allow changing the PIN of a smartcard.

Raises:

  • (NotImplementedError)


290
291
292
# File 'lib/openpgp/client/gnupg.rb', line 290

def change_pin
  raise NotImplementedError # TODO
end

- check_sigs

This method returns an undefined value.

Same as #list_sigs, but the signatures are verified.

Raises:

  • (NotImplementedError)


248
249
250
# File 'lib/openpgp/client/gnupg.rb', line 248

def check_sigs
  raise NotImplementedError # TODO
end

- check_trustdb

This method returns an undefined value.

Does trust database maintenance without user interaction.

Raises:

  • (NotImplementedError)


424
425
426
# File 'lib/openpgp/client/gnupg.rb', line 424

def check_trustdb
  raise NotImplementedError # TODO
end

- (Symbol) cipher_algorithm (protected)

Returns:

  • (Symbol)


731
732
733
734
735
736
737
738
739
740
741
# File 'lib/openpgp/client/gnupg.rb', line 731

def cipher_algorithm
  unless options[:cipher_algo]
    Cipher::CAST5 # this is the default cipher
  else
    algorithm = options[:cipher_algo].to_s.upcase.to_sym
    unless cipher_algorithms.has_key?(algorithm)
      abort "gpg: selected cipher algorithm is invalid"
    end
    cipher_algorithms[algorithm]
  end
end

- (Hash) cipher_algorithms (protected)

Returns:

  • (Hash)


757
758
759
760
761
762
763
764
765
766
767
# File 'lib/openpgp/client/gnupg.rb', line 757

def cipher_algorithms
  {
    :3DES"   => Cipher::TripleDES,
    :CAST5    => Cipher::CAST5,
    :BLOWFISH => Cipher::Blowfish,
    :AES      => Cipher::AES128,
    :AES192   => Cipher::AES192,
    :AES256   => Cipher::AES256,
    #:TWOFISH  => Cipher::Twofish, # N/A
  }
end

- clearsign

This method returns an undefined value.

Makes a clear text signature.

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/openpgp/client/gnupg.rb', line 82

def clearsign
  raise NotImplementedError # TODO
end

- (Symbol) compress_algorithm (protected)

Returns:

  • (Symbol)


751
752
753
# File 'lib/openpgp/client/gnupg.rb', line 751

def compress_algorithm
  options[:compress_algo]
end

- (Hash) compress_algorithms (protected)

Returns:

  • (Hash)


777
778
779
780
781
782
783
784
# File 'lib/openpgp/client/gnupg.rb', line 777

def compress_algorithms
  {
    :none     => nil,
    :ZIP      => nil, # TODO
    :ZLIB     => nil, # TODO
    :BZIP2    => nil, # TODO
  }
end

- dearmor(file)

This method returns an undefined value.

Unpacks an arbitrary input from an OpenPGP ASCII armor.

Parameters:

  • (String, #to_s) file


542
543
544
545
# File 'lib/openpgp/client/gnupg.rb', line 542

def dearmor(file)
  data = OpenPGP.dearmor(File.read(file))
  puts data # FIXME
end

- decrypt(file)

This method returns an undefined value.

Decrypts data.

Parameters:

  • (String, #to_s) file

Raises:

  • (NotImplementedError)


138
139
140
# File 'lib/openpgp/client/gnupg.rb', line 138

def decrypt(file)
  raise NotImplementedError # TODO
end

- decrypt_files(*files)

This method returns an undefined value.

Identical to --multifile --decrypt.

Parameters:

  • (Array<String>) files


176
177
178
179
# File 'lib/openpgp/client/gnupg.rb', line 176

def decrypt_files(*files)
  options[:multifile] = true
  files.each { |file| decrypt(file) }
end

- delete_key(name)

This method returns an undefined value.

Removes key from the public keyring.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


299
300
301
# File 'lib/openpgp/client/gnupg.rb', line 299

def delete_key(name)
  raise NotImplementedError # TODO
end

- delete_secret_and_public_key(name)

This method returns an undefined value.

Removes key from the secret and public keyring. If a secret key exists, it will be removed first.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


318
319
320
# File 'lib/openpgp/client/gnupg.rb', line 318

def delete_secret_and_public_key(name)
  raise NotImplementedError # TODO
end

- delete_secret_key(name)

This method returns an undefined value.

Removes key from the secret and public keyring.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


308
309
310
# File 'lib/openpgp/client/gnupg.rb', line 308

def delete_secret_key(name)
  raise NotImplementedError # TODO
end

- desig_revoke(name)

This method returns an undefined value.

Generates a designated revocation certificate for a key.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


571
572
573
# File 'lib/openpgp/client/gnupg.rb', line 571

def desig_revoke(name)
  raise NotImplementedError # TODO
end

- detach_sign

This method returns an undefined value.

Makes a detached signature.

Raises:

  • (NotImplementedError)


90
91
92
# File 'lib/openpgp/client/gnupg.rb', line 90

def detach_sign
  raise NotImplementedError # TODO
end

- (Symbol) digest_algorithm (protected)

Returns:

  • (Symbol)


745
746
747
# File 'lib/openpgp/client/gnupg.rb', line 745

def digest_algorithm
  options[:digest_algo]
end

- (Array) digest_algorithms (protected)

Returns:

  • (Array)


771
772
773
# File 'lib/openpgp/client/gnupg.rb', line 771

def digest_algorithms
  [:MD5, :SHA1, :RIPEMD160, :SHA256, :SHA384, :SHA512]
end

- dump_options

This method returns an undefined value.

Prints a list of all available options and commands.



59
60
61
62
63
64
65
66
# File 'lib/openpgp/client/gnupg.rb', line 59

def dump_options
  self.class.public_instance_methods(false).each do |command|
    if command =~ /^[\w\d_]+$/
      puts "--#{command.to_s.gsub('_', '-')}"
    end
  end
  # TODO: list available options, too.
end

- edit_key(key)

This method returns an undefined value.

Presents a menu which enables you to do most of the key management related tasks.

Parameters:

  • (String, #to_s) key

Raises:

  • (NotImplementedError)


581
582
583
# File 'lib/openpgp/client/gnupg.rb', line 581

def edit_key(key)
  raise NotImplementedError # TODO
end

- enarmor(file)

This method returns an undefined value.

Packs an arbitrary input into an OpenPGP ASCII armor.

Parameters:

  • (String, #to_s) file


532
533
534
535
# File 'lib/openpgp/client/gnupg.rb', line 532

def enarmor(file)
  text = OpenPGP.enarmor(File.read(file), :armored_file, :comment => 'Use "gpg --dearmor" for unpacking', :line_length => 64)
  puts text # FIXME
end

- encrypt

This method returns an undefined value.

Encrypts data.

Raises:

  • (NotImplementedError)


98
99
100
# File 'lib/openpgp/client/gnupg.rb', line 98

def encrypt
  raise NotImplementedError # TODO
end

- encrypt_files(*files)

This method returns an undefined value.

Identical to --multifile --encrypt.

Parameters:

  • (Array<String>) files


166
167
168
169
# File 'lib/openpgp/client/gnupg.rb', line 166

def encrypt_files(*files)
  options[:multifile] = true
  files.each { |file| encrypt(file) }
end

- export(*keys)

This method returns an undefined value.

Exports keys from the public keyring.

Parameters:

  • (Array<String>) keys

Raises:

  • (NotImplementedError)


327
328
329
# File 'lib/openpgp/client/gnupg.rb', line 327

def export(*keys)
  raise NotImplementedError # TODO
end

- export_ownertrust

This method returns an undefined value.

Sends the ownertrust values to stdout.

Raises:

  • (NotImplementedError)


432
433
434
# File 'lib/openpgp/client/gnupg.rb', line 432

def export_ownertrust
  raise NotImplementedError # TODO
end

- export_secret_keys

This method returns an undefined value.

Exports the secret keys.

Raises:

  • (NotImplementedError)


344
345
346
# File 'lib/openpgp/client/gnupg.rb', line 344

def export_secret_keys
  raise NotImplementedError # TODO
end

- export_secret_subkeys

This method returns an undefined value.

Exports the secret subkeys.

Raises:

  • (NotImplementedError)


352
353
354
# File 'lib/openpgp/client/gnupg.rb', line 352

def export_secret_subkeys
  raise NotImplementedError # TODO
end

- fast_import(*keys)

This method returns an undefined value.

Alias for #import.

Parameters:

  • (Array<String>) keys


370
371
372
# File 'lib/openpgp/client/gnupg.rb', line 370

def fast_import(*keys)
  import(*keys)
end

- fetch_keys(*uris)

This method returns an undefined value.

Retrieves keys located at the specified URIs.

Parameters:

  • (Array<String>) uris

Raises:

  • (NotImplementedError)


407
408
409
410
# File 'lib/openpgp/client/gnupg.rb', line 407

def fetch_keys(*uris)
  require 'open-uri'
  raise NotImplementedError # TODO
end

- fingerprint(*keys)

This method returns an undefined value.

Lists all keys (or the specified ones) along with their fingerprints.

Parameters:

  • (Array<String>) keys


257
258
259
260
# File 'lib/openpgp/client/gnupg.rb', line 257

def fingerprint(*keys)
  options[:fingerprint] = true
  list_keys(*keys)
end

- (String) format_fingerprint(input, column = 0) (protected)

Parameters:

  • (String) input
  • (Integer) column (defaults to: 0)

Returns:

  • (String)


695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'lib/openpgp/client/gnupg.rb', line 695

def format_fingerprint(input, column = 0)
  group_size = case input.size
    when 32 then 2 # MD5
    when 40 then 4 # SHA1, RIPEMD160
            else 8 # SHA2*
  end

  lines, line, pos = [], '', 0
  input.upcase!
  input.each_byte do |c|
    line << c
    if (pos += 1) % group_size == 0
      if (line.size + column) >= (80 - group_size)
        lines << line
        line, pos = '', 0
      else
        line << ' '
      end
    end
  end
  lines << line.strip unless line.empty?

  output = lines.join($/ + (' ' * column))
  output = output.insert(output.size / 2, ' ') if group_size < 8
  return output
end

- (String) format_keyspec(key) (protected)

Parameters:

Returns:

  • (String)


687
688
689
# File 'lib/openpgp/client/gnupg.rb', line 687

def format_keyspec(key)
  "____?/#{key.key_id}" # TODO
end

- gen_key

This method returns an undefined value.

Generates a new key pair.

Raises:

  • (NotImplementedError)


553
554
555
# File 'lib/openpgp/client/gnupg.rb', line 553

def gen_key
  raise NotImplementedError # TODO
end

- gen_prime(mode, bits, qbits = nil)

This method returns an undefined value.

Generates a prime number.

Parameters:

  • (Integer, #to_i) mode
  • (Integer, #to_i) bits
  • (Integer, #to_i) qbits (defaults to: nil)


518
519
520
521
522
523
524
525
# File 'lib/openpgp/client/gnupg.rb', line 518

def gen_prime(mode, bits, qbits = nil)
  case mode.to_i
    when 1..4
      raise NotImplementedError # TODO
    else
      wrong_args "--gen-prime mode bits [qbits]"
  end
end

- gen_random(level = 0, count = nil)

This method returns an undefined value.

Emits count random bytes of the given quality level.

Parameters:

  • (Integer, #to_i) level (defaults to: 0)
  • (Integer, #to_i) count (defaults to: nil)


496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/openpgp/client/gnupg.rb', line 496

def gen_random(level = 0, count = nil)
  wrong_args "--gen-random 0|1|2 [count]" unless (0..2).include?(level)

  require 'openssl'
  count   = count.to_i if count
  endless = count.nil?
  while endless || count > 0
    n = !endless && count < 99 ? count : 99
    p = Random.bytes(n)
    print options[:armor] ? [p].pack('m').delete("\n") : p
    count -= n unless endless
  end
  puts if options[:armor]
end

- gen_revoke(name)

This method returns an undefined value.

Generates a revocation certificate for the complete key.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


562
563
564
# File 'lib/openpgp/client/gnupg.rb', line 562

def gen_revoke(name)
  raise NotImplementedError # TODO
end

- help

This method returns an undefined value.

Prints a usage message summarizing the most useful command-line options.



45
# File 'lib/openpgp/client/gnupg.rb', line 45

def help() end

- import(*keys)

This method returns an undefined value.

Imports/merges keys, adding the given keys to the keyring.

Parameters:

  • (Array<String>) keys

Raises:

  • (NotImplementedError)


361
362
363
# File 'lib/openpgp/client/gnupg.rb', line 361

def import(*keys)
  raise NotImplementedError # TODO
end

- import_ownertrust(*files)

This method returns an undefined value.

Updates the trustdb with the ownertrust values stored in files or stdin.

Parameters:

  • (Array<String>) files

Raises:

  • (NotImplementedError)


442
443
444
# File 'lib/openpgp/client/gnupg.rb', line 442

def import_ownertrust(*files)
  raise NotImplementedError # TODO
end

- (Message) keyring(file) (protected)

Parameters:

  • (String, #to_s) file

Returns:



643
644
645
# File 'lib/openpgp/client/gnupg.rb', line 643

def keyring(file)
  OpenPGP::Message.parse(File.read(File.expand_path(file)))
end

- list_keys(*keys)

This method returns an undefined value.

Lists keys from the public keyrings.

Parameters:

  • (Array<String>) keys


186
187
188
# File 'lib/openpgp/client/gnupg.rb', line 186

def list_keys(*keys)
  list_public_keys(*keys)
end

- list_packets

This method returns an undefined value.

Lists only the sequence of packets.

Raises:

  • (NotImplementedError)


266
267
268
# File 'lib/openpgp/client/gnupg.rb', line 266

def list_packets
  raise NotImplementedError # TODO
end

- list_public_keys(*keys)

This method returns an undefined value.

Lists keys from the public keyrings.

Parameters:

  • (Array<String>) keys


195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/openpgp/client/gnupg.rb', line 195

def list_public_keys(*keys)
  public_keyrings.each do |keyring_filename, keyring|
    puts (keyring_filename = File.expand_path(keyring_filename))
    print '-' * keyring_filename.size

    keyring.each do |packet|
      case packet
        when Packet::PublicSubkey
          print_key_listing(packet, :sub)
        when Packet::PublicKey
          print_key_listing(packet, :pub)
        when Packet::UserID
          print_uid_listing(packet)
      end
    end
  end
end

- list_secret_keys(*keys)

This method returns an undefined value.

Lists keys from the secret keyrings.

Parameters:

  • (Array<String>) keys


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/openpgp/client/gnupg.rb', line 218

def list_secret_keys(*keys)
  secret_keyrings.each do |keyring_filename, keyring|
    puts (keyring_filename = File.expand_path(keyring_filename))
    print '-' * keyring_filename.size

    keyring.each do |packet|
      case packet
        when Packet::SecretSubkey
          print_key_listing(packet, :ssb)
        when Packet::SecretKey
          print_key_listing(packet, :sec)
        when Packet::UserID
          print_uid_listing(packet)
      end
    end
  end
end

- list_sigs

This method returns an undefined value.

Same as #list_keys, but the signatures are listed too.

Raises:

  • (NotImplementedError)


240
241
242
# File 'lib/openpgp/client/gnupg.rb', line 240

def list_sigs
  raise NotImplementedError # TODO
end

- lsign_key(name)

This method returns an undefined value.

Signs a public key with your secret key but marks it as non-exportable.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


600
601
602
# File 'lib/openpgp/client/gnupg.rb', line 600

def lsign_key(name)
  raise NotImplementedError # TODO
end

- parse_options_file(file) (protected)

This method returns an undefined value.

Parameters:

  • (String, #to_s) file


725
726
727
# File 'lib/openpgp/client/gnupg.rb', line 725

def parse_options_file(file)
  # TODO
end

This method returns an undefined value.

Parameters:

  • (Packet) packet
  • (Symbol, #to_sym) type


669
670
671
672
673
674
675
# File 'lib/openpgp/client/gnupg.rb', line 669

def print_key_listing(packet, type)
  puts unless (is_sub_key = [:sub, :ssb].include?(type))
  puts "#{type}   #{format_keyspec(packet)} #{Time.at(packet.timestamp).strftime('%Y-%m-%d')}"
  if options[:fingerprint] && !is_sub_key
    puts "      Key fingerprint = #{format_fingerprint(packet.fingerprint)}"
  end
end

This method returns an undefined value.

Prints message digest of algorithm algo for all given files or stdin.

Parameters:

  • (String, #to_s) algo
  • (Array<String>) files


461
462
463
464
465
466
467
468
469
470
471
# File 'lib/openpgp/client/gnupg.rb', line 461

def print_md(algo, *files)
  unless digest_algorithms.include?(algorithm = algo.to_s.upcase.to_sym)
    abort "gpg: invalid hash algorithm `#{algo}'"
  else
    digest = Digest.for(algorithm)
  end

  files.each do |file|
    puts (prefix = "#{file}: ") << format_fingerprint(digest.file(file).hexdigest, prefix.size)
  end
end

This method returns an undefined value.

Prints message digests of all available algorithms for all given files or stdin.

Parameters:

  • (Array<String>) files


479
480
481
482
483
484
485
486
487
488
# File 'lib/openpgp/client/gnupg.rb', line 479

def print_mds(*files)
  files.each do |file|
    digest_algorithms.each do |algorithm|
      algorithm = :RMD160 if algorithm == :RIPEMD160
      digest    = Digest.for(algorithm)

      puts (prefix = "#{file}: #{algorithm.to_s.rjust(6)} = ") << format_fingerprint(digest.file(file).hexdigest, prefix.size)
    end
  end
end

This method returns an undefined value.

Parameters:



680
681
682
# File 'lib/openpgp/client/gnupg.rb', line 680

def print_uid_listing(packet)
  puts "uid" + (' ' * 18) + packet.to_s
end

- (String) public_keyring_file (protected)

Returns:

  • (String)


649
650
651
# File 'lib/openpgp/client/gnupg.rb', line 649

def public_keyring_file
  File.join(options[:homedir], 'pubring.gpg')
end

- (Hash) public_keyrings (protected)

Returns:

  • (Hash)


630
631
632
# File 'lib/openpgp/client/gnupg.rb', line 630

def public_keyrings
  {public_keyring_file => keyring(public_keyring_file)} # FIXME
end

- (String) read_passphrase (protected)

Returns:

  • (String)


620
621
622
623
624
625
626
# File 'lib/openpgp/client/gnupg.rb', line 620

def read_passphrase
  if options[:passphrase]
    options[:passphrase]
  else
    # TODO
  end
end

- rebuild_keydb_caches

This method returns an undefined value.

Creates signature caches in the keyring.

Raises:

  • (NotImplementedError)


450
451
452
# File 'lib/openpgp/client/gnupg.rb', line 450

def rebuild_keydb_caches
  raise NotImplementedError # TODO
end

- recv_keys(*keys)

This method returns an undefined value.

Imports the keys with the given key IDs from a keyserver.

Parameters:

  • (Array<String>) keys

Raises:

  • (NotImplementedError)


379
380
381
# File 'lib/openpgp/client/gnupg.rb', line 379

def recv_keys(*keys)
  raise NotImplementedError # TODO
end

- refresh_keys(*keys)

This method returns an undefined value.

Requests updates from a keyserver for keys that already exist on the local keyring.

Parameters:

  • (Array<String>) keys

Raises:

  • (NotImplementedError)


389
390
391
# File 'lib/openpgp/client/gnupg.rb', line 389

def refresh_keys(*keys)
  raise NotImplementedError # TODO
end

- search_keys(*names)

This method returns an undefined value.

Searches the keyserver for the given names.

Parameters:

  • (Array<String>) names

Raises:

  • (NotImplementedError)


398
399
400
# File 'lib/openpgp/client/gnupg.rb', line 398

def search_keys(*names)
  raise NotImplementedError # TODO
end

- (String) secret_keyring_file (protected)

Returns:

  • (String)


655
656
657
# File 'lib/openpgp/client/gnupg.rb', line 655

def secret_keyring_file
  File.join(options[:homedir], 'secring.gpg')
end

- (Hash) secret_keyrings (protected)

Returns:

  • (Hash)


636
637
638
# File 'lib/openpgp/client/gnupg.rb', line 636

def secret_keyrings
  {secret_keyring_file => keyring(secret_keyring_file)} # FIXME
end

- send_keys(*keys)

This method returns an undefined value.

Sends keys to a keyserver.

Parameters:

  • (Array<String>) keys

Raises:

  • (NotImplementedError)


336
337
338
# File 'lib/openpgp/client/gnupg.rb', line 336

def send_keys(*keys)
  raise NotImplementedError # TODO
end

- sign

This method returns an undefined value.

Makes a signature.

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/openpgp/client/gnupg.rb', line 74

def sign
  raise NotImplementedError # TODO
end

- sign_key(name)

This method returns an undefined value.

Signs a public key with your secret key.

Parameters:

  • (String, #to_s) name

Raises:

  • (NotImplementedError)


590
591
592
# File 'lib/openpgp/client/gnupg.rb', line 590

def sign_key(name)
  raise NotImplementedError # TODO
end

- (IO) stderr (protected)

Returns:

  • (IO)


616
# File 'lib/openpgp/client/gnupg.rb', line 616

def stderr() $stdout end

- (IO) stdin (protected)

Returns:

  • (IO)


608
# File 'lib/openpgp/client/gnupg.rb', line 608

def stdin()  $stdin  end

- (IO) stdout (protected)

Returns:

  • (IO)


612
# File 'lib/openpgp/client/gnupg.rb', line 612

def stdout() $stdout end

- store(file)

This method returns an undefined value.

Stores only (make a simple RFC1991 literal data packet).

Parameters:

  • (String, #to_s) file


122
123
124
125
126
127
128
129
130
131
# File 'lib/openpgp/client/gnupg.rb', line 122

def store(file)
  Message.write(stdout) do |msg|
    msg << Packet::LiteralData.new({
      :format    => :b,
      :filename  => File.basename(file),
      :timestamp => File.mtime(file),
      :data      => File.read(file),
    })
  end
end

- symmetric(file)

This method returns an undefined value.

Encrypts with a symmetric cipher using a passphrase.

Parameters:

  • (String, #to_s) file


107
108
109
110
111
112
113
114
115
# File 'lib/openpgp/client/gnupg.rb', line 107

def symmetric(file)
  print OpenPGP.encrypt(File.read(file), {
    :symmetric  => true,
    :passphrase => read_passphrase,
    :cipher     => cipher_algorithm,
    :digest     => digest_algorithm,
    :compress   => compress_algorithm,
  })
end

- (String) trustdb_file (protected)

Returns:

  • (String)


661
662
663
# File 'lib/openpgp/client/gnupg.rb', line 661

def trustdb_file
  File.join(options[:homedir], 'trustdb.gpg')
end

- update_trustdb

This method returns an undefined value.

Does trust database maintenance.

Raises:

  • (NotImplementedError)


416
417
418
# File 'lib/openpgp/client/gnupg.rb', line 416

def update_trustdb
  raise NotImplementedError # TODO
end

- verify(file)

This method returns an undefined value.

Verifies data.

Parameters:

  • (String, #to_s) file

Raises:

  • (NotImplementedError)


147
148
149
# File 'lib/openpgp/client/gnupg.rb', line 147

def verify(file)
  raise NotImplementedError # TODO
end

- verify_files(*files)

This method returns an undefined value.

Identical to --multifile --verify.

Parameters:

  • (Array<String>) files


156
157
158
159
# File 'lib/openpgp/client/gnupg.rb', line 156

def verify_files(*files)
  options[:multifile] = true
  files.each { |file| verify(file) }
end

- version

This method returns an undefined value.

Prints the program version and licensing information.



29
30
31
32
33
34
35
36
37
38
# File 'lib/openpgp/client/gnupg.rb', line 29

def version
  puts "gpg.rb (GnuPG compatible) #{VERSION}"
  puts
  puts "Home: #{options[:homedir]}"
  puts "Supported algorithms:"
  puts "Pubkey: " # TODO
  puts "Cipher: #{cipher_algorithms.keys.map(&:to_s).sort.join(', ')}"
  puts "Hash: #{digest_algorithms.join(', ')}"
  puts "Compression: #{compress_algorithms.keys.map(&:to_s).sort.join(', ')}"
end

- warranty

This method returns an undefined value.

Prints warranty information.

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/openpgp/client/gnupg.rb', line 51

def warranty
  raise NotImplementedError
end

- wrong_args(usage) (protected)

This method returns an undefined value.

Parameters:

  • (String, #to_s) usage


789
790
791
# File 'lib/openpgp/client/gnupg.rb', line 789

def wrong_args(usage)
  abort "usage: gpg.rb [options] #{usage}"
end