PowerTCP SSH and SFTP for .NET
Authenticate(String,String,String) Method




The username used for authentication.
Passphrase for the PEM private key. Can be null or empty if the private key is not encrypted.
PEM-encoded DSA/RSA private key in OpenSSH, SSH2, or SSH.com key format.
Performs 'publickey' authentication.
Syntax
'Declaration
 
Public Overloads Sub Authenticate( _
   ByVal username As String, _
   ByVal pemPassPhrase As String, _
   ByVal pemPrivateKey As String _
) 
'Usage
 
Dim instance As SshConnection
Dim username As String
Dim pemPassPhrase As String
Dim pemPrivateKey As String
 
instance.Authenticate(username, pemPassPhrase, pemPrivateKey)
public void Authenticate( 
   string username,
   string pemPassPhrase,
   string pemPrivateKey
)
public: void Authenticate( 
   string* username,
   string* pemPassPhrase,
   string* pemPrivateKey
) 
public:
void Authenticate( 
   String^ username,
   String^ pemPassPhrase,
   String^ pemPrivateKey
) 

Parameters

username
The username used for authentication.
pemPassPhrase
Passphrase for the PEM private key. Can be null or empty if the private key is not encrypted.
pemPrivateKey
PEM-encoded DSA/RSA private key in OpenSSH, SSH2, or SSH.com key format.
Exceptions
ExceptionDescription
System.Security.Authentication.AuthenticationException Authentication was unsuccessful. The server does not support this authentication method or the arguments are invalid.
Remarks

For more information on public key authentication, please see the "Public Key/Private Key Overview" top-level help topic.

The technique used to invoke this method is dependent upon the value of ThreadingModel. If ThreadingModel.Free, this method executes on the current thread and returns when complete (this is standard for creating applications in multi-threading environments like .NET). If ThreadingModel.ApartmentBlocking, this method blocks and processes windows UI messages while a worker thread executes (this is useful for making a simple blocking call in an apartment model environment like VB6). If ThreadingModel.ApartmentAsync, this method immediately returns after starting a worker thread that executes asynchronously (this is useful for creating advanced communications applications in an apartment model environment like VB6). The StateChanged event will be raised upon completion, or the Error event raised if an exception is thrown.

To support multi-factor authentication, the value of State can be checked after this method completes. If it returns ConnectionState.ConnectedAndPartiallyAuthenticated, further authentication is required and Connection.GetRemainingAuthMethods can be checked for a list of authentication methods that the server will accept as the subsequent authentication factor.

See Also

Reference

SshConnection Class
SshConnection Members
Overload List


PowerTCP SSH and SFTP for .NET Documentation Version 7.0
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic