UnknownKeyReceived Event
Signals that the server has introduced itself with an unknown key.
Syntax
public event OnUnknownKeyReceivedHandler OnUnknownKeyReceived; public delegate void OnUnknownKeyReceivedHandler(object sender, SftpclientUnknownKeyReceivedEventArgs e); public class SftpclientUnknownKeyReceivedEventArgs : EventArgs { public string Algorithm { get; } public int Bits { get; } public string FingerprintSHA256 { get; } public int Action { get; set; } }
Public Event OnUnknownKeyReceived As OnUnknownKeyReceivedHandler Public Delegate Sub OnUnknownKeyReceivedHandler(sender As Object, e As SftpclientUnknownKeyReceivedEventArgs) Public Class SftpclientUnknownKeyReceivedEventArgs Inherits EventArgs Public ReadOnly Property Algorithm As String Public ReadOnly Property Bits As Integer Public ReadOnly Property FingerprintSHA256 As String Public Property Action As Integer End Class
Remarks
The component fires this event to tell the application that the server has introduced itself with a key not present in TrustedKeysFile. The details of the key are provided. In this event handler, you need to make a decision whether to proceed with the connection.
Use ServerKey to access more key details.
Use Action to tell the component what it should do with the key, supported values: catAcceptOnce = 1, catAcceptPermanently = 2, catReject = 3. Note that accepting an unknown and unchecked key may be risky.