Skip to content

SSH.Session.SendCredentials

Andrew Lambert edited this page Jan 14, 2024 · 15 revisions

SSH.Session.SendCredentials

Method Signatures

 Function SendCredentials(Username As String, PublicKey As FolderItem,  PrivateKey As FolderItem,  PrivateKeyPassword As String) As Boolean
 Function SendCredentials(Username As String, PublicKey As MemoryBlock, PrivateKey As MemoryBlock, PrivateKeyPassword As String) As Boolean
 Function SendCredentials(Username As String, Agent As SSH.Agent, KeyIndex As Integer) As Boolean
 Function SendCredentials(Username As String, Key As SSH.AgentKey) As Boolean
 Function SendCredentials(Username As String, Password As String) As Boolean

Parameters

SendCredentials(String, FolderItem, FolderItem, String)

Name Type Comment
Username String The username to authenticate with.
PublicKey FolderItem A file containing the user's public key. (Can be Nil)
PrivateKey FolderItem A file containing the user's private key.
PrivateKeyPassword String The password used to unlock the PrivateKey.

SendCredentials(String, MemoryBlock, MemoryBlock, String)

Name Type Comment
Username String The username to authenticate with.
PublicKey MemoryBlock A memory block containing the user's public key. (Can be Nil)
PrivateKey MemoryBlock A memory block containing the user's private key.
PrivateKeyPassword String The password used to unlock the PrivateKey.

SendCredentials(String, SSH.Agent, Integer)

Name Type Comment
Username String The username to authenticate with.
Agent SSH.Agent An instance of SSH.Agent.
KeyIndex Integer The index of the key which the agent should authenticate the session with.

SendCredentials(Username As String, Key As SSH.AgentKey)

Name Type Comment
Username String The username to authenticate with.
Key SSH.AgentKey An AgentKey which the agent should authenticate the session with.

SendCredentials(String, String)

Name Type Comment
Username String The username to authenticate with.
Password String The password to authenticate with.

Return value

Returns True if the user was successfully authenticated.

Remarks

Sends the user's credentials to the server. You may call this method again with different key or password parameters if authentication fails, but note that most server implementations do not permit different usernames between requests.

Key format

SSH2 private keys have no standard format. ssh.com uses one format, OpenSSH has an older and a newer format, PuTTY uses yet another, etc. In libssh2 keys must use the (older) OpenSSH format. You will need to convert your key if it is stored in a different format.

If libssh2 was built with libcrypto then the public key can be derived from the private key, and is therefore optional (pass Nil instead.)

See also

Clone this wiki locally