Sha256: 6fda485f2bd1c24db0d08ca0fbf6411a9ceb4b671134f5abef056fd71c66f76e

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

require 'rapid-vaults'

# returns key, nonce
def ssl_generate
  options = {}
  options[:action] = :generate
  RapidVaults::API.main(options)
end

# returns encrypted_contents, tag
def ssl_encrypt
  options = {}
  options[:action] = :encrypt
  options[:file] = '/path/to/data.txt'
  options[:key] = '/path/to/cert.key'
  options[:nonce] = '/path/to/nonce.txt'
  options[:pw] = File.read('/path/to/password.txt') # optional
  RapidVaults::API.main(options)
end

# returns decrypted_contents
def ssl_decrypt
  options = {}
  options[:action] = :decrypt
  options[:file] = '/path/to/encrypted_data.txt'
  options[:key] = '/path/to/cert.key'
  options[:nonce] = '/path/to/nonce.txt'
  options[:tag] = '/path/to/tag.txt'
  options[:pw] = File.read('/path/to/password.txt') # optional
  RapidVaults::API.main(options)
end

# returns exit code on status of gnupg setup
def gpg_generate
  ENV['GNUPGHOME'] = '/home/alice/.gnupg'

  options = {}
  options[:action] = :generate
  options[:algorithm] = :gpgme
  options[:gpgparams] = File.read('gpgparams.txt')
  RapidVaults::API.main(options)
end

# returns encrypted_contents
def gpg_encrypt
  ENV['GNUPGHOME'] = '/home/bob/.gnupg'

  options = {}
  options[:action] = :encrypt
  options[:algorithm] = :gpgme
  options[:file] = '/path/to/data.txt'
  options[:pw] = File.read('/path/to/password.txt')
  RapidVaults::API.main(options)
end

# returns decrypted_contents
def gpg_decrypt
  ENV['GNUPGHOME'] = '/home/chris/.gnupg'

  options = {}
  options[:action] = :decrypt
  options[:algorithm] = :gpgme
  options[:file] = '/path/to/encrypted_data.txt'
  options[:pw] = File.read('/path/to/password.txt')
  RapidVaults::API.main(options)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapid-vaults-1.2.0 lib/rapid-vaults/bindings/chef.rb
rapid-vaults-1.1.2 lib/rapid-vaults/bindings/chef.rb