class Chef::Util::Powershell::PSCredential
Public Class Methods
Source
# File lib/chef/util/powershell/ps_credential.rb, line 25 def initialize(username, password) @username = username @password = password end
Public Instance Methods
Inspect has no business leaking anything but the username, and to be honest even that one could be dicey
Alias for: to_plaintext
Source
# File lib/chef/util/powershell/ps_credential.rb, line 34 def to_plaintext "#<Chef::Util::Powershell::PSCredential:#{object_id} @username=#{@username.inspect}>" end
Also aliased as: inspect
Source
# File lib/chef/util/powershell/ps_credential.rb, line 30 def to_psobject "New-Object System.Management.Automation.PSCredential('#{@username}',('#{encrypt(@password)}' | ConvertTo-SecureString))" end
These leak an encrypted password, however we can’t rely on no-one using these assuming that behavior.
Alias for: to_psobject
Private Instance Methods
Source
# File lib/chef/util/powershell/ps_credential.rb, line 49 def encrypt(str) Chef::ReservedNames::Win32::Crypto.encrypt(str) end