load_private_key (Net::SSH::Transport::OSSL::KeyFactory)

    # File lib/net/ssh/transport/ossl/key-factory.rb, line 60
              def load_private_key( filename )
                file = File.read( filename )

                if file.match( /-----BEGIN DSA PRIVATE KEY-----/ )
                  key_type = OpenSSL::PKey::DSA
                elsif file.match( /-----BEGIN RSA PRIVATE KEY-----/ )
                  key_type = OpenSSL::PKey::RSA
                elsif file.match( /-----BEGIN (.*) PRIVATE KEY-----/ )
                  raise OpenSSL::PKey::PKeyError, "not a supported key type '#{$1}'"
                else
                  raise OpenSSL::PKey::PKeyError, "not a private key (#{filename})"
                end

                encrypted_key = file.match( /ENCRYPTED/ )
                password = encrypted_key ? 'nil' : nil
                tries = 0

                begin
                  return key_type.new( file, password )
                rescue OpenSSL::PKey::RSAError, OpenSSL::PKey::DSAError => e
                  if encrypted_key && @prompter
                    tries += 1
                    if tries <= 3
                      password = @prompter.password(
                        "Enter password for #{filename}: " )
                      retry
                    else
                      raise
                    end
                  else
                    raise
                  end
                end
              end