MCPcopy Create free account
hub / github.com/SecurityInnovation/PGPy / key

Method key

pgpy/pgp.py:2820–2837  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 12

test_key_keyerrorMethod · 0.80
test_select_keyidMethod · 0.80
test_select_shortidMethod · 0.80
test_select_nameMethod · 0.80
test_select_commentMethod · 0.80
test_select_emailMethod · 0.80
test_unload_keyMethod · 0.80
test_unload_key_halfMethod · 0.80

Calls 1

_get_keyMethod · 0.95

Tested by 12

test_key_keyerrorMethod · 0.64
test_select_keyidMethod · 0.64
test_select_shortidMethod · 0.64
test_select_nameMethod · 0.64
test_select_commentMethod · 0.64
test_select_emailMethod · 0.64
test_unload_keyMethod · 0.64
test_unload_key_halfMethod · 0.64