Class/Module Index [+]

Quicksearch

Fog::Compute::HP::Utils

Public Instance Methods

decrypt_using_private_key(encrypted_text, private_key_data) click to toggle source
# File lib/fog/hp/compute.rb, line 118
def decrypt_using_private_key(encrypted_text, private_key_data)
  return if (encrypted_text.nil? || private_key_data.nil?)
  private_key = OpenSSL::PKey::RSA.new(private_key_data)
  from_base64 = Base64.decode64(encrypted_text)
  private_key.private_decrypt(from_base64).strip
end
encrypt_using_public_key(text, public_key_data) click to toggle source
# File lib/fog/hp/compute.rb, line 111
def encrypt_using_public_key(text, public_key_data)
  return if (text.nil? || public_key_data.nil?)
  public_key = OpenSSL::PKey::RSA.new(public_key_data)
  encrypted_text = public_key.public_encrypt(text).strip
  Base64.encode64(encrypted_text)
end
extract_password_from_log(log_text) click to toggle source

extract windows password from log

# File lib/fog/hp/compute.rb, line 88
def extract_password_from_log(log_text)
  encrypted_text = ""
  section        = []
  return if log_text.nil?
  log_text.each_line do |line|
    case line
      when /^-----BEGIN (\w+)/
        section.push $1
        next
      when /^-----END (\w+)/
        section.pop
        next
    end

    case section
      when ["BASE64"]
        encrypted_text << line
    end
  end
  # return the encrypted portion only
  encrypted_text
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.