diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/x509.rst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/x509.rst b/docs/x509.rst index 44d53a45..f17c3dae 100644 --- a/docs/x509.rst +++ b/docs/x509.rst @@ -205,6 +205,12 @@ X.509 Certificate Object :raises cryptography.x509.DuplicateExtension: If more than one extension of the same type is found within the certificate. + .. doctest:: + + >>> for ext in cert.extensions: + ... print(ext) + <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> + .. class:: Name .. versionadded:: 0.8 @@ -292,6 +298,23 @@ X.509 Extensions An X.509 Extensions instance is an ordered list of extensions. The object is iterable to get every extension. + .. method:: get_extension_for_oid(oid) + + :param oid: An :class:`ObjectIdentifier` instance. + + :returns: An instance of the extension class. + + :raises cryptography.x509.ExtensionNotFound: If the certificate does + not have the extension requested. + + :raises cryptography.x509.UnsupportedExtension: If the certificate + contains an extension that is not supported. + + .. doctest:: + + >>> cert.extensions.get_extension_for_oid(x509.OID_BASIC_CONSTRAINTS) + <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> + .. class:: Extension .. versionadded:: 0.9 @@ -546,6 +569,17 @@ Exceptions Returns the OID. +.. class:: ExtensionNotFound + + This is raised when calling :meth:`Extensions.get_extension_for_oid` with + an extension OID that is not present in the certificate. + + .. attribute:: oid + + :type: :class:`ObjectIdentifier` + + Returns the OID. + .. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure .. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security |