aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-02-14 11:11:55 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2015-02-14 11:11:55 -0500
commitb8dc2f03ff2af2139ef9d77552562b0dce18d6bd (patch)
tree6194f6b33a680584af8ffe195c834e4db6471f84 /docs
parent0f696fab0e012bca0b69f2c933c679f5ecbe80ad (diff)
parentd21596e1704103d6345cd7979d1f97a2d8ca8bea (diff)
downloadcryptography-b8dc2f03ff2af2139ef9d77552562b0dce18d6bd.tar.gz
cryptography-b8dc2f03ff2af2139ef9d77552562b0dce18d6bd.tar.bz2
cryptography-b8dc2f03ff2af2139ef9d77552562b0dce18d6bd.zip
Merge pull request #1612 from reaperhulk/x509-dn
X509 distinguished name parsing support in the OpenSSL backend
Diffstat (limited to 'docs')
-rw-r--r--docs/spelling_wordlist.txt1
-rw-r--r--docs/x509.rst48
2 files changed, 49 insertions, 0 deletions
diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt
index 003e37d5..fefd26b3 100644
--- a/docs/spelling_wordlist.txt
+++ b/docs/spelling_wordlist.txt
@@ -29,6 +29,7 @@ interoperable
introspectability
invariants
iOS
+iterable
Koblitz
Lange
metadata
diff --git a/docs/x509.rst b/docs/x509.rst
index 587fd884..0298d94d 100644
--- a/docs/x509.rst
+++ b/docs/x509.rst
@@ -166,6 +166,54 @@ X.509 Certificate Object
>>> cert.not_valid_after
datetime.datetime(2030, 12, 31, 8, 30)
+ .. attribute:: issuer
+
+ .. versionadded:: 0.8
+
+ :type: :class:`Name`
+
+ The :class:`Name` of the issuer.
+
+ .. attribute:: subject
+
+ .. versionadded:: 0.8
+
+ :type: :class:`Name`
+
+ The :class:`Name` of the subject.
+
+
+.. class:: Name
+
+ .. versionadded:: 0.8
+
+ An X509 Name is an ordered list of attributes. The object is iterable to
+ get every attribute or you can use :meth:`Name.get_attributes_for_oid` to
+ obtain the specific type you want. Names are sometimes represented as a
+ slash or comma delimited string (e.g. ``/CN=mydomain.com/O=My Org/C=US`` or
+ ``CN=mydomain.com, O=My Org, C=US``).
+
+ .. doctest::
+
+ >>> len(cert.subject)
+ 3
+ >>> for attribute in cert.subject:
+ ... print(attribute)
+ <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.6, name=countryName)>, value=u'US')>
+ <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, value=u'Test Certificates 2011')>
+ <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')>
+
+ .. method:: get_attributes_for_oid(oid)
+
+ :param oid: An :class:`ObjectIdentifier` instance.
+
+ :returns: A list of :class:`NameAttribute` instances that match the
+ OID provided. If nothing matches an empty list will be returned.
+
+ .. doctest::
+
+ >>> cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME)
+ [<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')>]
.. class:: Version