Class PrivateKeyCredential
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
rawKeychar[]Raw private key data.
passwordPromptFunc<string>Callback to prompt for password for decrypting the key.
queryKeyboolWhether to check if the server knows the key before prompting for a decryption password.
identifierstringLog 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
rawKeychar[]Raw private key data.
passwordstringPassword for decrypting the key.
identifierstringLog 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
loadKeyFunc<CancellationToken, ValueTask<PrivateKeyCredential.Key>>Function to load the private key.
identifierstringLog 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
pathstringPath to the private key file.
passwordPromptFunc<string>Callback to prompt for password for decrypting the key.
queryKeyboolWhether to check if the server knows the key before prompting for a decryption password.
identifierstringLog 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)