Table of Contents

Class PrivateKeyCredential

Namespace
Tmds.Ssh
Assembly
Tmds.Ssh.dll

Credential for private key authentication.

public class PrivateKeyCredential : Credential
Inheritance
PrivateKeyCredential
Inherited Members

Constructors

PrivateKeyCredential(char[], Func<string?>, bool, string)

Creates a private key credential from raw key data with password prompt.

public PrivateKeyCredential(char[] rawKey, Func<string?> passwordPrompt, bool queryKey = true, string identifier = "[raw key]")

Parameters

rawKey char[]

Raw private key data.

passwordPrompt Func<string>

Callback to prompt for password for decrypting the key.

queryKey bool

Whether to check if the server knows the key before prompting for a decryption password.

identifier string

Log identifier for the key.

PrivateKeyCredential(char[], string?, string)

Creates a private key credential from raw key data.

public PrivateKeyCredential(char[] rawKey, string? password = null, string identifier = "[raw key]")

Parameters

rawKey char[]

Raw private key data.

password string

Password for decrypting the key.

identifier string

Log identifier for the key.

PrivateKeyCredential(Func<CancellationToken, ValueTask<Key>>, string)

Creates a private key credential with custom key loading logic.

protected PrivateKeyCredential(Func<CancellationToken, ValueTask<PrivateKeyCredential.Key>> loadKey, string identifier)

Parameters

loadKey Func<CancellationToken, ValueTask<PrivateKeyCredential.Key>>

Function to load the private key.

identifier string

Log identifier for the key.

Remarks

This constructor can be used to implement custom key loading, for example to use a private key stored in an Azure Key Vault without exporting the key. See the azure_key example for a demonstration.

PrivateKeyCredential(string, Func<string?>, bool, string?)

Creates a private key credential from a file with password prompt.

public PrivateKeyCredential(string path, Func<string?> passwordPrompt, bool queryKey = true, string? identifier = null)

Parameters

path string

Path to the private key file.

passwordPrompt Func<string>

Callback to prompt for password for decrypting the key.

queryKey bool

Whether to check if the server knows the key before prompting for a decryption password.

identifier string

Log identifier for the key.

PrivateKeyCredential(string, string?, string?)

Creates a private key credential from a file.

public PrivateKeyCredential(string path, string? password = null, string? identifier = null)

Parameters

path string

Path to the private key file.

password string

Password for decrypting the key.

identifier string

Log identifier for the key.