A context-manager method. Yields the first :py:obj:`PGPKey` object that matches the provided identifier. :param identifier: The identifier to use to select a loaded key. :type identifier: :py:exc:`PGPMessage`, :py:exc:`PGPSignature`, ``str`` :raises: :py:exc:`KeyErr
(self, identifier)
| 2818 | |
| 2819 | @contextlib.contextmanager |
| 2820 | def key(self, identifier): |
| 2821 | """ |
| 2822 | A context-manager method. Yields the first :py:obj:`PGPKey` object that matches the provided identifier. |
| 2823 | |
| 2824 | :param identifier: The identifier to use to select a loaded key. |
| 2825 | :type identifier: :py:exc:`PGPMessage`, :py:exc:`PGPSignature`, ``str`` |
| 2826 | :raises: :py:exc:`KeyError` if there is no loaded key that satisfies the identifier. |
| 2827 | """ |
| 2828 | if isinstance(identifier, PGPMessage): |
| 2829 | for issuer in identifier.issuers: |
| 2830 | if issuer in self: |
| 2831 | identifier = issuer |
| 2832 | break |
| 2833 | |
| 2834 | if isinstance(identifier, PGPSignature): |
| 2835 | identifier = identifier.signer |
| 2836 | |
| 2837 | yield self._get_key(identifier) |
| 2838 | |
| 2839 | def fingerprints(self, keyhalf='any', keytype='any'): |
| 2840 | """ |