lib/rapid-vaults/bindings/puppet_gpg_decrypt.rb
# Decrypts a file with GnuPG.
# @param [String] file The file to decrypt.
# @param [String] gpghome The path to the GnuPG home directory containing the credentials.
# @param [String] password_file The password file to use for decryption.
# @return [String] Returns a string of decrypted contents.
# @example Decrypting a file.
# gpg_encrypt('/path/to/encrypted_data.txt', '/home/alice/.gnupg', '/path/to/password.txt') => 'decrypted'
Decrypts a file with GnuPG.
Decrypts a file with GnuPG .
def gpg_decrypt(file, gpghome, password_file)
    begin
      require 'rapid-vaults'
    rescue LoadError
      raise 'Rapid Vaults is required to be installed on the puppet master to use this custom function!'
    end
    ENV['GNUPGHOME'] = gpghome
    RapidVaults::API.main(action: :decrypt, algorithm: :gpgme, file: file, pw: password_file)
  end
def gpg_decrypt ( file , gpghome , password_file ) begin require 'rapid-vaults' rescue LoadError raise 'Rapid Vaults is required to be installed on the puppet master to use this custom function!' end ENV [ 'GNUPGHOME' ] = gpghome RapidVaults :: API . main ( action : :decrypt , algorithm : :gpgme , file : file , pw : password_file ) end
Decrypts a file with GnuPG.
Decrypts a file with GnuPG .
Returns a string of decrypted contents.
Returns a string of decrypted contents .
String
file
gpghome
password_file
password_file The password file to use for decryption.
password_file The password file to use for decryption .
example
Decrypting a file. gpg_encrypt('/path/to/encrypted_data.txt', '/home/alice/.gnupg', '/path/to/password.txt') => 'decrypted'
Decrypting a file . gpg_encrypt ( ' / path / to / encrypted_data . txt ' ' / home / alice / . gnupg ' ' / path / to / password . txt ' ) = > ' decrypted '