KeyPassphraseNeeded Event
Requests a key protection password from the application.
Syntax
public event OnKeyPassphraseNeededHandler OnKeyPassphraseNeeded; public delegate void OnKeyPassphraseNeededHandler(object sender, PgpwriterKeyPassphraseNeededEventArgs e); public class PgpwriterKeyPassphraseNeededEventArgs : EventArgs { public string KeyID { get; } public string UserID { get; } public bool MainKey { get; } public string Passphrase { get; set; } public bool Skip { get; set; } }
Public Event OnKeyPassphraseNeeded As OnKeyPassphraseNeededHandler Public Delegate Sub OnKeyPassphraseNeededHandler(sender As Object, e As PgpwriterKeyPassphraseNeededEventArgs) Public Class PgpwriterKeyPassphraseNeededEventArgs Inherits EventArgs Public ReadOnly Property KeyID As String Public ReadOnly Property UserID As String Public ReadOnly Property MainKey As Boolean Public Property Passphrase As String Public Property Skip As Boolean End Class
Remarks
The component fires this event to request a secret key passphrase from the application. Note that this event asks for a key protection passphrase rather than a message protection passphrase. The component fires it when it attempts to use a secret key to sign the data.
This event is fired for every protected secret key residing in SigningKeys. KeyID specifies the key for which the password is requested, and UserID identifies its user. MainKey tells whether the key is a master key or a subkey.
The handler should provide password via the Passphrase parameter, or set Skip to True to skip this key.
For each key KeyPassphraseNeeded is called in a loop until the correct password is provided or the maximum number of password attempts reached.