Class | GPGME::Ctx |
In: |
lib/gpgme.rb
lib/gpgme/compat.rb |
Parent: | Object |
A context within which all cryptographic operations are performed.
Create a new instance from the given options. options is a Hash whose keys are
Generate a new key pair. parms is a string which looks like
<GnupgKeyParms format="internal"> Key-Type: DSA Key-Length: 1024 Subkey-Type: ELG-E Subkey-Length: 1024 Name-Real: Joe Tester Name-Comment: with stupid passphrase Name-Email: joe@foo.bar Expire-Date: 0 Passphrase: abc </GnupgKeyParms>
If pubkey and seckey are both set to nil, it stores the generated key pair into your key ring.
Set the passphrase callback with given hook value. passfunc should respond to call with 5 arguments.
def passfunc(hook, uid_hint, passphrase_info, prev_was_bad, fd) $stderr.write("Passphrase for #{uid_hint}: ") $stderr.flush begin system('stty -echo') io = IO.for_fd(fd, 'w') io.puts(gets) io.flush ensure (0 ... $_.length).each do |i| $_[i] = ?0 end if $_ system('stty echo') end $stderr.puts end ctx.set_passphrase_callback(method(:passfunc))
Set the progress callback with given hook value. progfunc should respond to call with 5 arguments.
def progfunc(hook, what, type, current, total) $stderr.write("#{what}: #{current}/#{total}\r") $stderr.flush end ctx.set_progress_callback(method(:progfunc))
Create a signature for the text. plain is a data object which contains the text. sig is a data object where the generated signature is stored.