on_key_passphrase_needed Event
Requests a key protection password from the application.
Syntax
class PGPWriterKeyPassphraseNeededEventParams(object): @property def key_id() -> str: ... @property def user_id() -> str: ... @property def main_key() -> bool: ... @property def passphrase() -> str: ... @passphrase.setter def passphrase(value) -> None: ... @property def skip() -> bool: ... @skip.setter def skip(value) -> None: ... # In class PGPWriter: @property def on_key_passphrase_needed() -> Callable[[PGPWriterKeyPassphraseNeededEventParams], None]: ... @on_key_passphrase_needed.setter def on_key_passphrase_needed(event_hook: Callable[[PGPWriterKeyPassphraseNeededEventParams], None]) -> None: ...
Remarks
The class 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 class 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 signing_keys. 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.