Sha256: 693587cd2db807d8a1e8075c1b3125ff4ba003c7cc4b7b8f14dd0eb27243a903
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: encrypt 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) # encrypt from stdin plaintext = $stdin.read encrypted_data = Conceal.encrypt(plaintext, key: key) $stdout.write(encrypted_data) $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/encrypt |