/usr/share/doc/ruby-gpgme/examples/sign.rb is in ruby-gpgme 2.0.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/usr/bin/env ruby
require 'gpgme'
# If you do not have gpg-agent installed, comment out the following
# and set it as :passphrase_callback.
#
# 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
unless ENV['GPG_AGENT_INFO']
$stderr.puts("gpg-agent is not running. See the comment in #{$0}.")
exit(1)
end
crypto = GPGME::Crypto.new
signature = crypto.clearsign('test test test', {
# :passphrase_callback => method(:passfunc)
})
puts signature.read
|