I've used gpgme recently. The code to encrypt a file looked like this
GPGME::Key.import(File.open(path_to_key)) #only needed if the key has not been imported previously
crypto = GPGME::Crypto.new :always_trust => true
File.open(path_to_encrypt) do |in_file|
File.open(output_path, 'wb') do |out_file|
crypto.encrypt in_file, :output => out_file, :recipients => "foo@example.com"
end
end
You might want to know that there's nothing "certified" about what's on rubygems - anyone can post a gem there (and it takes all of 3 minutes to do so)