Sha256: c889166159cfd2edb36419243c52c2076edb91df8e82add6d53b16acf8197a70
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
#!/usr/bin/env ruby require 'conceal' require 'optparse' class Options < Struct.new(:trailing_newline) end def main opts = Options.new opts.trailing_newline = true OptionParser.new do |o| o.banner = 'Usage: decrypt KEY_FILE' o.on('-h', '--help', 'show this message') do puts o exit(0) end o.on('-n', "don't print the trailing newline") do opts.trailing_newline = false end o.on('-v', '--version', 'print the version') do puts Conceal::VERSION end end.parse!(ARGV) # read the key file if ARGV.empty? $stderr.puts "Missing KEY_FILE argument" exit(1) end key_file = ARGV.shift key = IO.read(key_file) # decrypt from stdin encrypted_data = $stdin.read plaintext = Conceal.decrypt(encrypted_data, key: key) $stdout.write(plaintext) $stdout.write("\n") if opts.trailing_newline end main
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
conceal-0.1.0 | bin/decrypt |