module Brightbox::Config::GpgEncryptedPasswords
Attributes
Public Instance Methods
Source
# File lib/brightbox-cli/config/gpg_encrypted_passwords.rb, line 6 def gpg_encrypted_password_filename file_name = "#{client_name}.password.gpg" @gpg_encrypted_password_filename ||= File.join(config_directory, file_name) end
Source
# File lib/brightbox-cli/config/gpg_encrypted_passwords.rb, line 12 def gpg_password if defined?(@gpg_password) && !@gpg_password.nil? return @gpg_password end @gpg_password = if File.exist?(gpg_encrypted_password_filename) gpg_decrypt_password end end
Return the password from gpg if it’s possible
Private Instance Methods
Source
# File lib/brightbox-cli/config/gpg_encrypted_passwords.rb, line 25 def gpg_decrypt_password info "INFO: Decrypting #{gpg_encrypted_password_filename} to obtain password" begin IO.popen(["gpg", "--decrypt", gpg_encrypted_password_filename], "r") do |io| io.read.chomp end rescue Errno::ENOENT nil end end
Use gpg to decrypt the password