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

Method certify

pgpy/pgp.py:2058–2222  ·  view source on GitHub ↗

certify(subject, level=SignatureType.Generic_Cert, **prefs) Sign a key or a user id within a key. :param subject: The user id or key to be certified. :type subject: :py:obj:`PGPKey`, :py:obj:`PGPUID` :param level: :py:obj:`~constants.SignatureType.Generic_C

(self, subject, level=SignatureType.Generic_Cert, **prefs)

Source from the content-addressed store, hash-verified

2056
2057 @KeyAction(KeyFlags.Certify, is_unlocked=True, is_public=False)
2058 def certify(self, subject, level=SignatureType.Generic_Cert, **prefs):
2059 """
2060 certify(subject, level=SignatureType.Generic_Cert, **prefs)
2061
2062 Sign a key or a user id within a key.
2063
2064 :param subject: The user id or key to be certified.
2065 :type subject: :py:obj:`PGPKey`, :py:obj:`PGPUID`
2066 :param level: :py:obj:`~constants.SignatureType.Generic_Cert`, :py:obj:`~constants.SignatureType.Persona_Cert`,
2067 :py:obj:`~constants.SignatureType.Casual_Cert`, or :py:obj:`~constants.SignatureType.Positive_Cert`.
2068 Only used if subject is a :py:obj:`PGPUID`; otherwise, it is ignored.
2069 :raises: :py:exc:`~pgpy.errors.PGPError` if the key is passphrase-protected and has not been unlocked
2070 :raises: :py:exc:`~pgpy.errors.PGPError` if the key is public
2071 :returns: :py:obj:`PGPSignature`
2072
2073 In addition to the optional keyword arguments accepted by :py:meth:`PGPKey.sign`, the following optional
2074 keyword arguments can be used with :py:meth:`PGPKey.certify`.
2075
2076 These optional keywords only make sense, and thus only have an effect, when self-signing a key or User ID:
2077
2078 :keyword usage: A ``set`` of key usage flags, as :py:obj:`~constants.KeyFlags`.
2079 This keyword is ignored for non-self-certifications.
2080 :type usage: ``set``
2081 :keyword ciphers: A list of preferred symmetric ciphers, as :py:obj:`~constants.SymmetricKeyAlgorithm`.
2082 This keyword is ignored for non-self-certifications.
2083 :type ciphers: ``list``
2084 :keyword hashes: A list of preferred hash algorithms, as :py:obj:`~constants.HashAlgorithm`.
2085 This keyword is ignored for non-self-certifications.
2086 :type hashes: ``list``
2087 :keyword compression: A list of preferred compression algorithms, as :py:obj:`~constants.CompressionAlgorithm`.
2088 This keyword is ignored for non-self-certifications.
2089 :type compression: ``list``
2090 :keyword key_expiration: Specify a key expiration date for when this key should expire, or a
2091 :py:obj:`~datetime.timedelta` of how long after the key was created it should expire.
2092 This keyword is ignored for non-self-certifications.
2093 :type key_expiration: :py:obj:`datetime.datetime`, :py:obj:`datetime.timedelta`
2094 :keyword attested_certifications: A list of third-party certifications, as :py:obj:`PGPSignature`, that
2095 the certificate holder wants to attest to for redistribution with the certificate.
2096 Alternatively, any element in the list can be a ``bytes`` or ``bytearray`` object
2097 of the appropriate length (the length of this certification's digest).
2098 This keyword is only used for signatures of type Attestation.
2099 :type attested_certifications: ``list``
2100 :keyword keyserver: Specify the URI of the preferred key server of the user.
2101 This keyword is ignored for non-self-certifications.
2102 :type keyserver: ``str``, ``unicode``, ``bytes``
2103 :keyword keyserver_flags: A set of Key Server Preferences, as :py:obj:`~constants.KeyServerPreferences`.
2104 :type keyserver_flags: ``set``
2105 :keyword primary: Whether or not to consider the certified User ID as the primary one.
2106 This keyword is ignored for non-self-certifications, and any certifications directly on keys.
2107 :type primary: ``bool``
2108
2109 These optional keywords only make sense, and thus only have an effect, when signing another key or User ID:
2110
2111 :keyword trust: Specify the level and amount of trust to assert when certifying a public key. Should be a tuple
2112 of two ``int`` s, specifying the trust level and trust amount. See
2113 `RFC 4880 Section 5.2.3.13. Trust Signature <https://tools.ietf.org/html/rfc4880#section-5.2.3.13>`_
2114 for more on what these values mean.
2115 :type trust: ``tuple`` of two ``int`` s

Callers 4

add_uidMethod · 0.95
test_certify_uidMethod · 0.80
test_certify_photoMethod · 0.80
test_self_certify_keyMethod · 0.80

Calls 5

_signMethod · 0.95
addnewMethod · 0.80
updateMethod · 0.80
canonical_bytesMethod · 0.80
newMethod · 0.45

Tested by 3

test_certify_uidMethod · 0.64
test_certify_photoMethod · 0.64
test_self_certify_keyMethod · 0.64