lib/rapid-vaults/bindings/puppet_ssl_decrypt.rb
def ssl_decrypt(file, key, nonce, tag, 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
    settings = { action: :decrypt, file: file, key: key, nonce: nonce, tag: tag }
    # update settings with password if input
    settings[pw: File.read(password_file)] unless password_file.nil?

    RapidVaults::API.main(settings)
  end
# Decrypts a file with OpenSSL.
# @param [String] file The file to decrypt.
# @param [String] key The key file to use for decryption.
# @param [String] nonce The nonce file to use for decryption.
# @param [String] tag The tag file to use for decryption.
# @optional_param [String] password_file The optional password file to use for decryption.
# @return [String] Returns a string of decrypted contents.
# @example Decrypting a file.
# ssl_decrypt('/path/to/encrypted_data.txt', '/path/to/cert.key', '/path/to/nonce.txt', '/path/to/tag.txt', '/path/to/password.txt') => 'decrypted'
Decrypts a file with OpenSSL.
Decrypts a file with OpenSSL .
def ssl_decrypt(file, key, nonce, tag, 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: :decrypt, file: file, key: key, nonce: nonce, tag: tag }
    settings[pw: File.read(password_file)] unless password_file.nil?
    RapidVaults::API.main(settings)
  end
def ssl_decrypt ( file , key , nonce , tag , 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 : :decrypt , file : file , key : key , nonce : nonce , tag : tag } settings [ pw : File . read ( password_file ) ] unless password_file . nil? RapidVaults :: API . main ( settings ) end
Decrypts a file with OpenSSL.
Decrypts a file with OpenSSL .
# initialize settings # update settings with password if input
Returns a string of decrypted contents.
Returns a string of decrypted contents .
String
file
key
nonce
tag
password_file
tag The tag file to use for decryption.
tag The tag file to use for decryption .
optional_param
[String] password_file The optional password file to use for decryption.
[ String ] password_file The optional password file to use for decryption .
example
Decrypting a file. ssl_decrypt('/path/to/encrypted_data.txt', '/path/to/cert.key', '/path/to/nonce.txt', '/path/to/tag.txt', '/path/to/password.txt') => 'decrypted'
Decrypting a file . ssl_decrypt ( ' / path / to / encrypted_data . txt ' ' / path / to / cert . key ' ' / path / to / nonce . txt ' ' / path / to / tag . txt ' ' / path / to / password . txt ' ) = > ' decrypted '