lib/rapid-vaults/bindings/puppet_ssl_encrypt.rb
def ssl_encrypt(file, key, nonce, password_file = nil)
    begin
      require 'rapid-vaults'
    rescue LoadError
      raise 'Rapid Vaults is required to be installed on the puppet master to use this custom function!'
    end

    # initialize settings and return
    settings = { action: :encrypt, file: file, key: key, nonce: nonce }
    return_hash = {}
    # update settings with password if input
    settings[pw: File.read(password_file)] unless password_file.nil?

    return_hash[:encrypted_contents], return_hash[:tag] = RapidVaults::API.main(settings)

    return_hash
  end
# Encrypts a file with OpenSSL.
# @param [String] file The file to encrypt.
# @param [String] key The key file to use for encryption.
# @param [String] nonce The nonce file to use for encryption.
# @optional_param [String] password_file The optional password file to use for encryption.
# @return [Hash] Returns a hash. First key-value is the encrypted contents and the second is the tag.
# @example Encrypting a file.
# ssl_encrypt('/path/to/data.txt', '/path/to/cert.key', '/path/to/nonce.txt', '/path/to/password.txt') => { encrypted_contents => 'asdfnlm34kl5m3lasdf34324fdnfsd', tag => 'fwr32r2ewf' }
Encrypts a file with OpenSSL.
Encrypts a file with OpenSSL .
def ssl_encrypt(file, key, nonce, password_file = nil)
    begin
      require 'rapid-vaults'
    rescue LoadError
      raise 'Rapid Vaults is required to be installed on the puppet master to use this custom function!'
    end
    settings = { action: :encrypt, file: file, key: key, nonce: nonce }
    return_hash = {}
    settings[pw: File.read(password_file)] unless password_file.nil?
    return_hash[:encrypted_contents], return_hash[:tag] = RapidVaults::API.main(settings)
    return_hash
  end
def ssl_encrypt ( file , key , nonce , password_file = nil ) begin require 'rapid-vaults' rescue LoadError raise 'Rapid Vaults is required to be installed on the puppet master to use this custom function!' end settings = { action : :encrypt , file : file , key : key , nonce : nonce } return_hash = { } settings [ pw : File . read ( password_file ) ] unless password_file . nil? return_hash [ :encrypted_contents ] , return_hash [ :tag ] = RapidVaults :: API . main ( settings ) return_hash end
Encrypts a file with OpenSSL.
Encrypts a file with OpenSSL .
# initialize settings and return # update settings with password if input
Returns a hash. First key-value is the encrypted contents and the second is the tag.
Returns a hash . First key - value is the encrypted contents and the second is the tag .
Hash
file
key
nonce
password_file
nonce The nonce file to use for encryption.
nonce The nonce file to use for encryption .
optional_param
[String] password_file The optional password file to use for encryption.
[ String ] password_file The optional password file to use for encryption .
example
Encrypting a file. ssl_encrypt('/path/to/data.txt', '/path/to/cert.key', '/path/to/nonce.txt', '/path/to/password.txt') => { encrypted_contents => 'asdfnlm34kl5m3lasdf34324fdnfsd', tag => 'fwr32r2ewf' }
Encrypting a file . ssl_encrypt ( ' / path / to / data . txt ' ' / path / to / cert . key ' ' / path / to / nonce . txt ' ' / path / to / password . txt ' ) = > { encrypted_contents = > ' asdfnlm34kl5m3lasdf34324fdnfsd ' tag = > ' fwr32r2ewf ' }