Sha256: 9ab5d5d7ab4a08458eed87b891e6038f7d94a308f9974f57dff6af7d954afa22
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' require 'io/console' require_relative '../../lib/rnp' options = {armored: false, keys_armored: false} parser = OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] <seckey> <passphrase>" opts.on('-k', '--keys-armored', 'Keys are ASCII armored') do options[:keys_armored] = true end opts.on('-a', '--armored', 'Input is ASCII armored') do options[:armored] = true end opts.on('-h', '--help', 'Print this help') do puts opts exit end end parser.parse! if ARGV.length != 2 parser.display exit end seckey_filename = ARGV.shift passphrase = ARGV.shift + "\n" secring = RNP::load_keyring(File.binread(seckey_filename), options[:keys_armored]) $stdin.binmode data = $stdin.read seckey = secring[0] decrypted_data = seckey.decrypt(data, passphrase, options[:armored]) if decrypted_data $stderr.puts 'Decryption succeeded' $stdout.puts decrypted_data else $stderr.puts 'Decryption failed!' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rnp-0.2.0 | examples/highlevel/decrypt_mem.rb |