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

Method revoker

pgpy/pgp.py:2271–2304  ·  view source on GitHub ↗

Generate a signature that specifies another key as being valid for revoking this key. :param revoker: The :py:obj:`PGPKey` to specify as a valid revocation key. :type revoker: :py:obj:`PGPKey` :raises: :py:exc:`~pgpy.errors.PGPError` if the key is passphrase-protect

(self, revoker, **prefs)

Source from the content-addressed store, hash-verified

2269
2270 @KeyAction(is_unlocked=True, is_public=False)
2271 def revoker(self, revoker, **prefs):
2272 """
2273 Generate a signature that specifies another key as being valid for revoking this key.
2274
2275 :param revoker: The :py:obj:`PGPKey` to specify as a valid revocation key.
2276 :type revoker: :py:obj:`PGPKey`
2277 :raises: :py:exc:`~pgpy.errors.PGPError` if the key is passphrase-protected and has not been unlocked
2278 :raises: :py:exc:`~pgpy.errors.PGPError` if the key is public
2279 :returns: :py:obj:`PGPSignature`
2280
2281 In addition to the optional keyword arguments accepted by :py:meth:`PGPKey.sign`, the following optional
2282 keyword arguments can be used with :py:meth:`PGPKey.revoker`.
2283
2284 :keyword sensitive: If ``True``, this sets the sensitive flag on the RevocationKey subpacket. Currently,
2285 this has no other effect.
2286 :type sensitive: ``bool``
2287 """
2288 hash_algo = prefs.pop('hash', None)
2289
2290 sig = PGPSignature.new(SignatureType.DirectlyOnKey, self.key_algorithm, hash_algo, self.fingerprint.keyid, created=prefs.pop('created', None))
2291
2292 # signature options that only make sense when adding a revocation key
2293 sensitive = prefs.pop('sensitive', False)
2294 keyclass = RevocationKeyClass.Normal | (RevocationKeyClass.Sensitive if sensitive else 0x00)
2295
2296 sig._signature.subpackets.addnew('RevocationKey',
2297 hashed=True,
2298 algorithm=revoker.key_algorithm,
2299 fingerprint=revoker.fingerprint,
2300 keyclass=keyclass)
2301
2302 # revocation keys should really not be revocable themselves
2303 prefs['revocable'] = False
2304 return self._sign(self, sig, **prefs)
2305
2306 @KeyAction(is_unlocked=True, is_public=False)
2307 def bind(self, key, **prefs):

Callers 1

Calls 3

_signMethod · 0.95
addnewMethod · 0.80
newMethod · 0.45

Tested by 1