blob: 512d940ab2c2662958a8a6ce86c3721710c56e4a [file] [log] [blame]
Paul Kehrer016e08a2014-11-26 09:41:18 -10001X.509
2=====
3
Paul Kehrera9d78c12014-11-26 10:59:03 -10004.. currentmodule:: cryptography.x509
Paul Kehrer016e08a2014-11-26 09:41:18 -10005
Paul Kehrerd26c4db2015-03-15 15:36:24 -05006.. testsetup::
7
8 pem_req_data = b"""
9 -----BEGIN CERTIFICATE REQUEST-----
10 MIIC0zCCAbsCAQAwWTELMAkGA1UEBhMCVVMxETAPBgNVBAgMCElsbGlub2lzMRAw
11 DgYDVQQHDAdDaGljYWdvMREwDwYDVQQKDAhyNTA5IExMQzESMBAGA1UEAwwJaGVs
12 bG8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhZx+Mo9VRd9
13 vsnWWa6NBCws21rZ0+1B/JGgB4hDsZS7iDE4Bj5z4idheFRtl8bBbdjPknq7BfoF
14 8v15Zq/Zv7i2xMSDL+LUrTBZezRd4bRTGqCm6YJ5EYkhqdcqeZleHCFImguHoq1J
15 Fh0+kObQrTHXw3ZP57a3o1IvyIUA3nNoCBL0QQhwBXaDXOojMKNR+bqB5ve8GS1y
16 Elr0AM/+cJsfaIahNQUgFKx3Eu3GeEOMKYOAG1lycgdQdmTUybLrT3U7vkClTseM
17 xHg1r5En7ALjONIhqRuq3rddYahrP8HXozb3zUy3cJ7P6IeaosuvNzvMXOX9P6HD
18 Ha9urDAJ1wIDAQABoDUwMwYJKoZIhvcNAQkOMSYwJDAiBgNVHREEGzAZggl3b3Js
19 ZC5jb22CDHdoYXRldmVyLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEAS4Ro6h+z52SK
20 YSLCYARpnEu/rmh4jdqndt8naqcNb6uLx9mlKZ2W9on9XDjnSdQD9q+ZP5aZfESw
21 R0+rJhW9ZrNa/g1pt6M24ihclHYDAxYMWxT1z/TXXGM3TmZZ6gfYlNE1kkBuODHa
22 UYsR/1Ht1E1EsmmUimt2n+zQR2K8T9Coa+boaUW/GsTEuz1aaJAkj5ZvTDiIhRG4
23 AOCqFZOLAQmCCNgJnnspD9hDz/Ons085LF5wnYjN4/Nsk5tS6AGs3xjZ3jPoOGGn
24 82WQ9m4dBGoVDZXsobVTaN592JEYwN5iu72zRn7Einb4V4H5y3yD2dD4yWPlt4pk
25 5wFkeYsZEA==
26 -----END CERTIFICATE REQUEST-----
27 """.strip()
28
Paul Kehrerd3dafbd2015-03-15 16:24:18 -050029 pem_data = b"""
30 -----BEGIN CERTIFICATE-----
31 MIIDfDCCAmSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJVUzEf
32 MB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgMjAxMTEVMBMGA1UEAxMMVHJ1c3Qg
33 QW5jaG9yMB4XDTEwMDEwMTA4MzAwMFoXDTMwMTIzMTA4MzAwMFowQDELMAkGA1UE
34 BhMCVVMxHzAdBgNVBAoTFlRlc3QgQ2VydGlmaWNhdGVzIDIwMTExEDAOBgNVBAMT
35 B0dvb2QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQWJpHYo37
36 Xfb7oJSPe+WvfTlzIG21WQ7MyMbGtK/m8mejCzR6c+f/pJhEH/OcDSMsXq8h5kXa
37 BGqWK+vSwD/Pzp5OYGptXmGPcthDtAwlrafkGOS4GqIJ8+k9XGKs+vQUXJKsOk47
38 RuzD6PZupq4s16xaLVqYbUC26UcY08GpnoLNHJZS/EmXw1ZZ3d4YZjNlpIpWFNHn
39 UGmdiGKXUPX/9H0fVjIAaQwjnGAbpgyCumWgzIwPpX+ElFOUr3z7BoVnFKhIXze+
40 VmQGSWxZxvWDUN90Ul0tLEpLgk3OVxUB4VUGuf15OJOpgo1xibINPmWt14Vda2N9
41 yrNKloJGZNqLAgMBAAGjfDB6MB8GA1UdIwQYMBaAFOR9X9FclYYILAWuvnW2ZafZ
42 XahmMB0GA1UdDgQWBBRYAYQkG7wrUpRKPaUQchRR9a86yTAOBgNVHQ8BAf8EBAMC
43 AQYwFwYDVR0gBBAwDjAMBgpghkgBZQMCATABMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
44 KoZIhvcNAQELBQADggEBADWHlxbmdTXNwBL/llwhQqwnazK7CC2WsXBBqgNPWj7m
45 tvQ+aLG8/50Qc2Sun7o2VnwF9D18UUe8Gj3uPUYH+oSI1vDdyKcjmMbKRU4rk0eo
46 3UHNDXwqIVc9CQS9smyV+x1HCwL4TTrq+LXLKx/qVij0Yqk+UJfAtrg2jnYKXsCu
47 FMBQQnWCGrwa1g1TphRp/RmYHnMynYFmZrXtzFz+U9XEA7C+gPq4kqDI/iVfIT1s
48 6lBtdB50lrDVwl2oYfAvW/6sC2se2QleZidUmrziVNP4oEeXINokU6T6p//HM1FG
49 QYw2jOvpKcKtWCSAnegEbgsGYzATKjmPJPJ0npHFqzM=
50 -----END CERTIFICATE-----
51 """.strip()
52
53X.509 is an ITU-T standard for a `public key infrastructure`_. X.509v3 is
54defined in :rfc:`5280` (which obsoletes :rfc:`2459` and :rfc:`3280`). X.509
55certificates are commonly used in protocols like `TLS`_.
Paul Kehrerb2de9482014-12-11 14:54:48 -060056
57Loading Certificates
58~~~~~~~~~~~~~~~~~~~~
Paul Kehrer016e08a2014-11-26 09:41:18 -100059
60.. function:: load_pem_x509_certificate(data, backend)
61
62 .. versionadded:: 0.7
63
Paul Kehrere76cd272014-12-14 19:00:51 -060064 Deserialize a certificate from PEM encoded data. PEM certificates are
65 base64 decoded and have delimiters that look like
66 ``-----BEGIN CERTIFICATE-----``.
Paul Kehrer016e08a2014-11-26 09:41:18 -100067
68 :param bytes data: The PEM encoded certificate data.
69
70 :param backend: A backend supporting the
71 :class:`~cryptography.hazmat.backends.interfaces.X509Backend`
72 interface.
73
Paul Kehrere76cd272014-12-14 19:00:51 -060074 :returns: An instance of :class:`~cryptography.x509.Certificate`.
Paul Kehrer016e08a2014-11-26 09:41:18 -100075
76.. function:: load_der_x509_certificate(data, backend)
77
78 .. versionadded:: 0.7
79
Paul Kehrere76cd272014-12-14 19:00:51 -060080 Deserialize a certificate from DER encoded data. DER is a binary format
Paul Kehrer92aac382014-12-15 16:25:28 -060081 and is commonly found in files with the ``.cer`` extension (although file
82 extensions are not a guarantee of encoding type).
Paul Kehrer016e08a2014-11-26 09:41:18 -100083
84 :param bytes data: The DER encoded certificate data.
85
86 :param backend: A backend supporting the
87 :class:`~cryptography.hazmat.backends.interfaces.X509Backend`
88 interface.
89
Paul Kehrere76cd272014-12-14 19:00:51 -060090 :returns: An instance of :class:`~cryptography.x509.Certificate`.
Paul Kehrer016e08a2014-11-26 09:41:18 -100091
Paul Kehrer016e08a2014-11-26 09:41:18 -100092.. doctest::
93
Paul Kehrercc8a26e2014-12-16 12:40:16 -060094 >>> from cryptography import x509
Paul Kehrer016e08a2014-11-26 09:41:18 -100095 >>> from cryptography.hazmat.backends import default_backend
Paul Kehrercc8a26e2014-12-16 12:40:16 -060096 >>> cert = x509.load_pem_x509_certificate(pem_data, default_backend())
Paul Kehrer016e08a2014-11-26 09:41:18 -100097 >>> cert.serial
98 2
99
Paul Kehrera1a1f232015-03-15 15:34:35 -0500100Loading Certificate Signing Requests
101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600102
Paul Kehrer31e39882015-03-11 11:37:04 -0500103.. function:: load_pem_x509_csr(data, backend)
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600104
105 .. versionadded:: 0.9
106
Paul Kehrera1a1f232015-03-15 15:34:35 -0500107 Deserialize a certificate signing request (CSR) from PEM encoded data. PEM
Paul Kehrer5aadb9c2015-03-11 20:48:42 -0500108 requests are base64 decoded and have delimiters that look like
Paul Kehrerd3dafbd2015-03-15 16:24:18 -0500109 ``-----BEGIN CERTIFICATE REQUEST-----``. This format is also known as
110 PKCS#10.
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600111
112 :param bytes data: The PEM encoded request data.
113
114 :param backend: A backend supporting the
115 :class:`~cryptography.hazmat.backends.interfaces.X509Backend`
116 interface.
117
Paul Kehrera1a1f232015-03-15 15:34:35 -0500118 :returns: An instance of
119 :class:`~cryptography.x509.CertificateSigningRequest`.
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600120
Paul Kehrer1effb6e2015-03-30 15:05:59 -0500121.. function:: load_der_x509_csr(data, backend)
122
123 .. versionadded:: 0.9
124
125 Deserialize a certificate signing request (CSR) from DER encoded data. DER
126 is a binary format and is not commonly used with CSRs.
127
128 :param bytes data: The DER encoded request data.
129
130 :param backend: A backend supporting the
131 :class:`~cryptography.hazmat.backends.interfaces.X509Backend`
132 interface.
133
134 :returns: An instance of
135 :class:`~cryptography.x509.CertificateSigningRequest`.
136
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600137.. doctest::
138
139 >>> from cryptography import x509
140 >>> from cryptography.hazmat.backends import default_backend
141 >>> from cryptography.hazmat.primitives import hashes
Paul Kehrera1a1f232015-03-15 15:34:35 -0500142 >>> csr = x509.load_pem_x509_csr(pem_req_data, default_backend())
143 >>> isinstance(csr.signature_hash_algorithm, hashes.SHA1)
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600144 True
145
Paul Kehrere76cd272014-12-14 19:00:51 -0600146X.509 Certificate Object
147~~~~~~~~~~~~~~~~~~~~~~~~
Paul Kehrerb2de9482014-12-11 14:54:48 -0600148
Paul Kehrere76cd272014-12-14 19:00:51 -0600149.. class:: Certificate
Paul Kehrerb2de9482014-12-11 14:54:48 -0600150
151 .. versionadded:: 0.7
152
153 .. attribute:: version
154
Paul Kehrere76cd272014-12-14 19:00:51 -0600155 :type: :class:`~cryptography.x509.Version`
Paul Kehrerb2de9482014-12-11 14:54:48 -0600156
Paul Kehrere76cd272014-12-14 19:00:51 -0600157 The certificate version as an enumeration. Version 3 certificates are
158 the latest version and also the only type you should see in practice.
Paul Kehrerb2de9482014-12-11 14:54:48 -0600159
Alex Gaynor89c4dc82014-12-16 16:49:33 -0800160 :raises cryptography.x509.InvalidVersion: If the version in the
Alex Gaynor6d7ab4c2014-12-16 16:50:33 -0800161 certificate is not a known
162 :class:`X.509 version <cryptography.x509.Version>`.
Paul Kehrer92aac382014-12-15 16:25:28 -0600163
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600164 .. doctest::
165
166 >>> cert.version
167 <Version.v3: 2>
168
Paul Kehrerb2de9482014-12-11 14:54:48 -0600169 .. method:: fingerprint(algorithm)
170
171 :param algorithm: The
Paul Kehrer601278a2015-02-12 12:51:00 -0600172 :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm`
Paul Kehrerb2de9482014-12-11 14:54:48 -0600173 that will be used to generate the fingerprint.
174
175 :return bytes: The fingerprint using the supplied hash algorithm as
176 bytes.
177
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600178 .. doctest::
179
180 >>> from cryptography.hazmat.primitives import hashes
181 >>> cert.fingerprint(hashes.SHA256())
Paul Kehrer78a81502014-12-16 14:47:52 -0600182 '\x86\xd2\x187Gc\xfc\xe7}[+E9\x8d\xb4\x8f\x10\xe5S\xda\x18u\xbe}a\x03\x08[\xac\xa04?'
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600183
Paul Kehrerb2de9482014-12-11 14:54:48 -0600184 .. attribute:: serial
185
186 :type: int
187
188 The serial as a Python integer.
189
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600190 .. doctest::
191
192 >>> cert.serial
193 2
194
Paul Kehrerb2de9482014-12-11 14:54:48 -0600195 .. method:: public_key()
196
197 :type:
Alex Stapletonf79c2312014-12-30 12:50:14 +0000198 :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` or
Paul Kehrer45efdbc2015-02-12 10:58:22 -0600199 :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` or
200 :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey`
Paul Kehrerb2de9482014-12-11 14:54:48 -0600201
202 The public key associated with the certificate.
203
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600204 .. doctest::
205
Alex Stapletonf79c2312014-12-30 12:50:14 +0000206 >>> from cryptography.hazmat.primitives.asymmetric import rsa
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600207 >>> public_key = cert.public_key()
Alex Stapletonf79c2312014-12-30 12:50:14 +0000208 >>> isinstance(public_key, rsa.RSAPublicKey)
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600209 True
210
Paul Kehrerb2de9482014-12-11 14:54:48 -0600211 .. attribute:: not_valid_before
212
213 :type: :class:`datetime.datetime`
214
Paul Kehrer78a81502014-12-16 14:47:52 -0600215 A naïve datetime representing the beginning of the validity period for
216 the certificate in UTC. This value is inclusive.
Paul Kehrerb2de9482014-12-11 14:54:48 -0600217
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600218 .. doctest::
219
220 >>> cert.not_valid_before
221 datetime.datetime(2010, 1, 1, 8, 30)
222
Paul Kehrerb2de9482014-12-11 14:54:48 -0600223 .. attribute:: not_valid_after
224
225 :type: :class:`datetime.datetime`
226
Paul Kehrer78a81502014-12-16 14:47:52 -0600227 A naïve datetime representing the end of the validity period for the
228 certificate in UTC. This value is inclusive.
Paul Kehrerb2de9482014-12-11 14:54:48 -0600229
Paul Kehrercc8a26e2014-12-16 12:40:16 -0600230 .. doctest::
231
232 >>> cert.not_valid_after
233 datetime.datetime(2030, 12, 31, 8, 30)
234
Paul Kehrer719d5362015-01-01 20:03:52 -0600235 .. attribute:: issuer
236
237 .. versionadded:: 0.8
238
239 :type: :class:`Name`
240
241 The :class:`Name` of the issuer.
242
243 .. attribute:: subject
244
245 .. versionadded:: 0.8
246
247 :type: :class:`Name`
248
249 The :class:`Name` of the subject.
250
Paul Kehrer8802a5b2015-02-13 12:06:57 -0600251 .. attribute:: signature_hash_algorithm
Paul Kehrer56da2a52015-02-11 23:35:07 -0600252
Paul Kehrer8802a5b2015-02-13 12:06:57 -0600253 :type: :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm`
Paul Kehrer56da2a52015-02-11 23:35:07 -0600254
Paul Kehrere612ec72015-02-16 14:33:35 -0600255 Returns the
Paul Kehrer71d40c62015-02-19 08:21:04 -0600256 :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` which
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600257 was used in signing this certificate.
Paul Kehrer56da2a52015-02-11 23:35:07 -0600258
259 .. doctest::
260
Paul Kehrer8802a5b2015-02-13 12:06:57 -0600261 >>> from cryptography.hazmat.primitives import hashes
262 >>> isinstance(cert.signature_hash_algorithm, hashes.SHA256)
263 True
Paul Kehrer719d5362015-01-01 20:03:52 -0600264
Paul Kehrerfbb7ac82015-03-16 19:26:29 -0500265 .. attribute:: extensions
266
267 :type: :class:`Extensions`
268
269 The extensions encoded in the certificate.
270
271 :raises cryptography.x509.DuplicateExtension: If more than one
272 extension of the same type is found within the certificate.
273
Paul Kehrerfa56a232015-03-17 13:14:03 -0500274 .. doctest::
275
276 >>> for ext in cert.extensions:
277 ... print(ext)
Paul Kehrercbfb1012015-04-10 20:57:20 -0400278 <Extension(oid=<ObjectIdentifier(oid=2.5.29.14, name=subjectKeyIdentifier)>, critical=False, value=<SubjectKeyIdentifier(digest='X\x01\x84$\x1b\xbc+R\x94J=\xa5\x10r\x14Q\xf5\xaf:\xc9')>)>
Paul Kehrerb511ba82015-04-15 11:22:48 -0400279 <Extension(oid=<ObjectIdentifier(oid=2.5.29.15, name=keyUsage)>, critical=True, value=<KeyUsage(digital_signature=False, content_commitment=False, key_encipherment=False, data_encipherment=False, key_agreement=False, key_cert_sign=True, crl_sign=True, encipher_only=None, decipher_only=None)>)>
Paul Kehrerfa56a232015-03-17 13:14:03 -0500280 <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)>
281
Paul Kehrer5aadb9c2015-03-11 20:48:42 -0500282X.509 CSR (Certificate Signing Request) Object
283~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600284
Paul Kehrera1a1f232015-03-15 15:34:35 -0500285.. class:: CertificateSigningRequest
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600286
287 .. versionadded:: 0.9
288
289 .. method:: public_key()
290
291 :type:
292 :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` or
293 :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` or
294 :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey`
295
296 The public key associated with the request.
297
298 .. doctest::
299
300 >>> from cryptography.hazmat.primitives.asymmetric import rsa
Paul Kehrera1a1f232015-03-15 15:34:35 -0500301 >>> public_key = csr.public_key()
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600302 >>> isinstance(public_key, rsa.RSAPublicKey)
303 True
304
305 .. attribute:: subject
306
307 :type: :class:`Name`
308
309 The :class:`Name` of the subject.
310
311 .. attribute:: signature_hash_algorithm
312
313 :type: :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm`
314
315 Returns the
316 :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` which
317 was used in signing this request.
318
319 .. doctest::
320
321 >>> from cryptography.hazmat.primitives import hashes
Paul Kehrera1a1f232015-03-15 15:34:35 -0500322 >>> isinstance(csr.signature_hash_algorithm, hashes.SHA1)
Paul Kehrerdc480ad2015-02-23 12:14:54 -0600323 True
324
Paul Kehrer719d5362015-01-01 20:03:52 -0600325.. class:: Name
326
327 .. versionadded:: 0.8
328
Paul Kehrer53d8d492015-02-13 18:47:30 -0600329 An X509 Name is an ordered list of attributes. The object is iterable to
Paul Kehrerd21596e2015-02-14 09:17:26 -0600330 get every attribute or you can use :meth:`Name.get_attributes_for_oid` to
Paul Kehrer719d5362015-01-01 20:03:52 -0600331 obtain the specific type you want. Names are sometimes represented as a
Paul Kehrer53d8d492015-02-13 18:47:30 -0600332 slash or comma delimited string (e.g. ``/CN=mydomain.com/O=My Org/C=US`` or
333 ``CN=mydomain.com, O=My Org, C=US``).
Paul Kehrer719d5362015-01-01 20:03:52 -0600334
Paul Kehrer53d8d492015-02-13 18:47:30 -0600335 .. doctest::
Paul Kehrer719d5362015-01-01 20:03:52 -0600336
Paul Kehrer8b21a4a2015-02-14 07:56:36 -0600337 >>> len(cert.subject)
Paul Kehrer53d8d492015-02-13 18:47:30 -0600338 3
Paul Kehrer8b21a4a2015-02-14 07:56:36 -0600339 >>> for attribute in cert.subject:
340 ... print(attribute)
341 <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.6, name=countryName)>, value=u'US')>
342 <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, value=u'Test Certificates 2011')>
343 <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')>
Paul Kehrer719d5362015-01-01 20:03:52 -0600344
Paul Kehrere901d642015-02-11 18:50:58 -0600345 .. method:: get_attributes_for_oid(oid)
Paul Kehrer719d5362015-01-01 20:03:52 -0600346
Paul Kehrere901d642015-02-11 18:50:58 -0600347 :param oid: An :class:`ObjectIdentifier` instance.
Paul Kehrer719d5362015-01-01 20:03:52 -0600348
Paul Kehrere901d642015-02-11 18:50:58 -0600349 :returns: A list of :class:`NameAttribute` instances that match the
350 OID provided. If nothing matches an empty list will be returned.
Paul Kehrer719d5362015-01-01 20:03:52 -0600351
352 .. doctest::
353
Paul Kehrere901d642015-02-11 18:50:58 -0600354 >>> cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME)
355 [<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')>]
Paul Kehrerb2de9482014-12-11 14:54:48 -0600356
Paul Kehrere76cd272014-12-14 19:00:51 -0600357.. class:: Version
Paul Kehrer016e08a2014-11-26 09:41:18 -1000358
359 .. versionadded:: 0.7
360
361 An enumeration for X.509 versions.
362
363 .. attribute:: v1
364
365 For version 1 X.509 certificates.
366
367 .. attribute:: v3
368
369 For version 3 X.509 certificates.
370
Paul Kehrer806bfb22015-02-02 17:05:24 -0600371.. class:: NameAttribute
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600372
373 .. versionadded:: 0.8
374
Paul Kehrer834d22f2015-02-06 11:01:07 -0600375 An X.509 name consists of a list of NameAttribute instances.
Paul Kehrer5b0a8d62015-01-30 20:05:55 -0600376
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600377 .. attribute:: oid
378
379 :type: :class:`ObjectIdentifier`
380
381 The attribute OID.
382
383 .. attribute:: value
384
Paul Kehrerd5852cb2015-01-30 08:25:23 -0600385 :type: :term:`text`
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600386
387 The value of the attribute.
388
389.. class:: ObjectIdentifier
390
391 .. versionadded:: 0.8
392
Paul Kehrer5b0a8d62015-01-30 20:05:55 -0600393 Object identifiers (frequently seen abbreviated as OID) identify the type
Paul Kehrer806bfb22015-02-02 17:05:24 -0600394 of a value (see: :class:`NameAttribute`).
Paul Kehrer5b0a8d62015-01-30 20:05:55 -0600395
Paul Kehrerd44f9a62015-02-04 14:47:34 -0600396 .. attribute:: dotted_string
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600397
398 :type: :class:`str`
399
Paul Kehrerfedf4f42015-02-06 11:22:07 -0600400 The dotted string value of the OID (e.g. ``"2.5.4.3"``)
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600401
Paul Kehrer8cf26422015-03-21 09:50:24 -0500402X.509 Extensions
403~~~~~~~~~~~~~~~~
404
Paul Kehrerfbb7ac82015-03-16 19:26:29 -0500405.. class:: Extensions
406
407 .. versionadded:: 0.9
408
409 An X.509 Extensions instance is an ordered list of extensions. The object
410 is iterable to get every extension.
411
Paul Kehrerfa56a232015-03-17 13:14:03 -0500412 .. method:: get_extension_for_oid(oid)
413
414 :param oid: An :class:`ObjectIdentifier` instance.
415
416 :returns: An instance of the extension class.
417
418 :raises cryptography.x509.ExtensionNotFound: If the certificate does
419 not have the extension requested.
420
421 :raises cryptography.x509.UnsupportedExtension: If the certificate
422 contains an extension that is not supported.
423
424 .. doctest::
425
426 >>> cert.extensions.get_extension_for_oid(x509.OID_BASIC_CONSTRAINTS)
427 <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)>
428
Paul Kehrer8cf26422015-03-21 09:50:24 -0500429.. class:: Extension
430
431 .. versionadded:: 0.9
432
Paul Kehrer85894662015-03-22 13:19:31 -0500433 .. attribute:: oid
434
435 :type: :class:`ObjectIdentifier`
436
Paul Kehrer5553d572015-03-23 21:08:01 -0500437 The :ref:`extension OID <extension_oids>`.
Paul Kehrer8cf26422015-03-21 09:50:24 -0500438
439 .. attribute:: critical
440
441 :type: bool
442
Paul Kehrer58b75692015-03-22 23:24:58 -0500443 Determines whether a given extension is critical or not. :rfc:`5280`
444 requires that "A certificate-using system MUST reject the certificate
445 if it encounters a critical extension it does not recognize or a
446 critical extension that contains information that it cannot process".
Paul Kehrer8cf26422015-03-21 09:50:24 -0500447
Paul Kehrer85894662015-03-22 13:19:31 -0500448 .. attribute:: value
449
450 Returns an instance of the extension type corresponding to the OID.
451
Paul Kehrercecbbba2015-03-30 14:58:38 -0500452.. class:: KeyUsage
453
454 .. versionadded:: 0.9
455
456 The key usage extension defines the purpose of the key contained in the
457 certificate. The usage restriction might be employed when a key that could
458 be used for more than one operation is to be restricted. It corresponds to
459 :data:`OID_KEY_USAGE`.
460
461 .. attribute:: digital_signature
462
463 :type: bool
464
Paul Kehrer738407b2015-04-01 22:39:02 -0500465 This purpose is set to true when the subject public key is used for verifying
Paul Kehrercecbbba2015-03-30 14:58:38 -0500466 digital signatures, other than signatures on certificates
467 (``key_cert_sign``) and CRLs (``crl_sign``).
468
469 .. attribute:: content_commitment
470
471 :type: bool
472
Paul Kehrer738407b2015-04-01 22:39:02 -0500473 This purpose is set to true when the subject public key is used for verifying
Paul Kehrercecbbba2015-03-30 14:58:38 -0500474 digital signatures, other than signatures on certificates
475 (``key_cert_sign``) and CRLs (``crl_sign``). It is used to provide a
476 non-repudiation service that protects against the signing entity
477 falsely denying some action. In the case of later conflict, a
478 reliable third party may determine the authenticity of the signed
479 data. This was called ``non_repudiation`` in older revisions of the
480 X.509 specification.
481
482 .. attribute:: key_encipherment
483
484 :type: bool
485
Paul Kehrer738407b2015-04-01 22:39:02 -0500486 This purpose is set to true when the subject public key is used for
487 enciphering private or secret keys.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500488
489 .. attribute:: data_encipherment
490
491 :type: bool
492
Paul Kehrer738407b2015-04-01 22:39:02 -0500493 This purpose is set to true when the subject public key is used for
494 directly enciphering raw user data without the use of an intermediate
495 symmetric cipher.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500496
497 .. attribute:: key_agreement
498
499 :type: bool
500
Paul Kehrer738407b2015-04-01 22:39:02 -0500501 This purpose is set to true when the subject public key is used for key
502 agreement. For example, when a Diffie-Hellman key is to be used for
503 key management, then this purpose is set to true.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500504
505 .. attribute:: key_cert_sign
506
507 :type: bool
508
Paul Kehrer738407b2015-04-01 22:39:02 -0500509 This purpose is set to true when the subject public key is used for
510 verifying signatures on public key certificates. If this purpose is set
511 to true then ``ca`` must be true in the :class:`BasicConstraints`
512 extension.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500513
514 .. attribute:: crl_sign
515
516 :type: bool
517
Paul Kehrer738407b2015-04-01 22:39:02 -0500518 This purpose is set to true when the subject public key is used for
519 verifying signatures on certificate revocation lists.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500520
521 .. attribute:: encipher_only
522
523 :type: bool
524
Paul Kehrer738407b2015-04-01 22:39:02 -0500525 When this purposes is set to true and the ``key_agreement`` purpose is
526 also set, the subject public key may be used only for enciphering data
527 while performing key agreement.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500528
529 :raises ValueError: This is raised if accessed when ``key_agreement``
530 is false.
531
532 .. attribute:: decipher_only
533
534 :type: bool
535
Paul Kehrer738407b2015-04-01 22:39:02 -0500536 When this purposes is set to true and the ``key_agreement`` purpose is
537 also set, the subject public key may be used only for deciphering data
538 while performing key agreement.
Paul Kehrercecbbba2015-03-30 14:58:38 -0500539
540 :raises ValueError: This is raised if accessed when ``key_agreement``
541 is false.
542
543
Paul Kehrer8cf26422015-03-21 09:50:24 -0500544.. class:: BasicConstraints
545
546 .. versionadded:: 0.9
547
Paul Kehrer85894662015-03-22 13:19:31 -0500548 Basic constraints is an X.509 extension type that defines whether a given
Paul Kehrer8cf26422015-03-21 09:50:24 -0500549 certificate is allowed to sign additional certificates and what path
Paul Kehrer85894662015-03-22 13:19:31 -0500550 length restrictions may exist. It corresponds to
551 :data:`OID_BASIC_CONSTRAINTS`.
Paul Kehrer8cf26422015-03-21 09:50:24 -0500552
553 .. attribute:: ca
554
555 :type: bool
556
557 Whether the certificate can sign certificates.
558
559 .. attribute:: path_length
560
Paul Kehrerfd1444c2015-03-21 19:47:05 -0500561 :type: int or None
Paul Kehrer8cf26422015-03-21 09:50:24 -0500562
563 The maximum path length for certificates subordinate to this
564 certificate. This attribute only has meaning if ``ca`` is true.
565 If ``ca`` is true then a path length of None means there's no
566 restriction on the number of subordinate CAs in the certificate chain.
567 If it is zero or greater then that number defines the maximum length.
568 For example, a ``path_length`` of 1 means the certificate can sign a
569 subordinate CA, but the subordinate CA is not allowed to create
Paul Kehrerfd1444c2015-03-21 19:47:05 -0500570 subordinates with ``ca`` set to true.
Paul Kehrer8cf26422015-03-21 09:50:24 -0500571
Paul Kehrerffa2a152015-03-31 08:18:25 -0500572.. class:: ExtendedKeyUsage
573
574 .. versionadded:: 0.9
575
576 This extension indicates one or more purposes for which the certified
577 public key may be used, in addition to or in place of the basic
578 purposes indicated in the key usage extension. The object is
579 iterable to obtain the list of :ref:`extended key usage OIDs <eku_oids>`.
580
Paul Kehrer1eb82a62015-03-31 20:00:33 -0500581.. class:: SubjectKeyIdentifier
582
583 .. versionadded:: 0.9
584
585 The subject key identifier extension provides a means of identifying
586 certificates that contain a particular public key.
587
588 .. attribute:: digest
589
590 :type: bytes
591
592 The binary value of the identifier.
593
Paul Kehrer8cf26422015-03-21 09:50:24 -0500594
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600595Object Identifiers
596~~~~~~~~~~~~~~~~~~
597
Paul Kehrer4bb46492015-02-07 16:59:14 -0600598X.509 elements are frequently identified by :class:`ObjectIdentifier`
599instances. The following common OIDs are available as constants.
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600600
Paul Kehrer56da2a52015-02-11 23:35:07 -0600601Name OIDs
602~~~~~~~~~
603
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600604.. data:: OID_COMMON_NAME
605
Paul Kehrerfb5ac9e2015-02-07 16:29:37 -0600606 Corresponds to the dotted string ``"2.5.4.3"``. Historically the domain
607 name would be encoded here for server certificates. :rfc:`2818` deprecates
608 this practice and names of that type should now be located in a
Paul Kehrer4bb46492015-02-07 16:59:14 -0600609 SubjectAlternativeName extension. This OID is typically seen in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600610
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600611.. data:: OID_COUNTRY_NAME
612
Paul Kehrer4bb46492015-02-07 16:59:14 -0600613 Corresponds to the dotted string ``"2.5.4.6"``. This OID is typically seen
614 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600615
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600616.. data:: OID_LOCALITY_NAME
617
Paul Kehrer4bb46492015-02-07 16:59:14 -0600618 Corresponds to the dotted string ``"2.5.4.7"``. This OID is typically seen
619 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600620
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600621.. data:: OID_STATE_OR_PROVINCE_NAME
622
Paul Kehrer4bb46492015-02-07 16:59:14 -0600623 Corresponds to the dotted string ``"2.5.4.8"``. This OID is typically seen
624 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600625
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600626.. data:: OID_ORGANIZATION_NAME
627
Paul Kehrer4bb46492015-02-07 16:59:14 -0600628 Corresponds to the dotted string ``"2.5.4.10"``. This OID is typically seen
629 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600630
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600631.. data:: OID_ORGANIZATIONAL_UNIT_NAME
632
Paul Kehrer4bb46492015-02-07 16:59:14 -0600633 Corresponds to the dotted string ``"2.5.4.11"``. This OID is typically seen
634 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600635
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600636.. data:: OID_SERIAL_NUMBER
637
Paul Kehrerfb5ac9e2015-02-07 16:29:37 -0600638 Corresponds to the dotted string ``"2.5.4.5"``. This is distinct from the
639 serial number of the certificate itself (which can be obtained with
Paul Kehrer4bb46492015-02-07 16:59:14 -0600640 :func:`Certificate.serial`). This OID is typically seen in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600641
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600642.. data:: OID_SURNAME
643
Paul Kehrer4bb46492015-02-07 16:59:14 -0600644 Corresponds to the dotted string ``"2.5.4.4"``. This OID is typically seen
645 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600646
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600647.. data:: OID_GIVEN_NAME
648
Paul Kehrer4bb46492015-02-07 16:59:14 -0600649 Corresponds to the dotted string ``"2.5.4.42"``. This OID is typically seen
650 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600651
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600652.. data:: OID_TITLE
653
Paul Kehrer4bb46492015-02-07 16:59:14 -0600654 Corresponds to the dotted string ``"2.5.4.12"``. This OID is typically seen
655 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600656
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600657.. data:: OID_GENERATION_QUALIFIER
658
Paul Kehrer4bb46492015-02-07 16:59:14 -0600659 Corresponds to the dotted string ``"2.5.4.44"``. This OID is typically seen
660 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600661
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600662.. data:: OID_DN_QUALIFIER
663
Paul Kehrerfb5ac9e2015-02-07 16:29:37 -0600664 Corresponds to the dotted string ``"2.5.4.46"``. This specifies
665 disambiguating information to add to the relative distinguished name of an
Paul Kehrer4bb46492015-02-07 16:59:14 -0600666 entry. See :rfc:`2256`. This OID is typically seen in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600667
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600668.. data:: OID_PSEUDONYM
669
Paul Kehrer4bb46492015-02-07 16:59:14 -0600670 Corresponds to the dotted string ``"2.5.4.65"``. This OID is typically seen
671 in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600672
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600673.. data:: OID_DOMAIN_COMPONENT
674
Paul Kehrerfb5ac9e2015-02-07 16:29:37 -0600675 Corresponds to the dotted string ``"0.9.2342.19200300.100.1.25"``. A string
Paul Kehrer4bb46492015-02-07 16:59:14 -0600676 holding one component of a domain name. See :rfc:`4519`. This OID is
677 typically seen in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600678
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600679.. data:: OID_EMAIL_ADDRESS
680
Paul Kehrer4bb46492015-02-07 16:59:14 -0600681 Corresponds to the dotted string ``"1.2.840.113549.1.9.1"``. This OID is
682 typically seen in X.509 names.
Paul Kehrer858b9b72015-02-05 09:50:31 -0600683
Paul Kehrer56da2a52015-02-11 23:35:07 -0600684Signature Algorithm OIDs
685~~~~~~~~~~~~~~~~~~~~~~~~
686
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600687.. data:: OID_RSA_WITH_MD5
Paul Kehrer56da2a52015-02-11 23:35:07 -0600688
689 Corresponds to the dotted string ``"1.2.840.113549.1.1.4"``. This is
690 an MD5 digest signed by an RSA key.
691
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600692.. data:: OID_RSA_WITH_SHA1
Paul Kehrer56da2a52015-02-11 23:35:07 -0600693
694 Corresponds to the dotted string ``"1.2.840.113549.1.1.5"``. This is
695 a SHA1 digest signed by an RSA key.
696
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600697.. data:: OID_RSA_WITH_SHA224
Paul Kehrer56da2a52015-02-11 23:35:07 -0600698
699 Corresponds to the dotted string ``"1.2.840.113549.1.1.14"``. This is
700 a SHA224 digest signed by an RSA key.
701
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600702.. data:: OID_RSA_WITH_SHA256
Paul Kehrer56da2a52015-02-11 23:35:07 -0600703
704 Corresponds to the dotted string ``"1.2.840.113549.1.1.11"``. This is
705 a SHA256 digest signed by an RSA key.
706
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600707.. data:: OID_RSA_WITH_SHA384
Paul Kehrer56da2a52015-02-11 23:35:07 -0600708
709 Corresponds to the dotted string ``"1.2.840.113549.1.1.12"``. This is
710 a SHA384 digest signed by an RSA key.
711
Paul Kehrer1a7ba872015-02-19 18:09:05 -0600712.. data:: OID_RSA_WITH_SHA512
Paul Kehrer56da2a52015-02-11 23:35:07 -0600713
714 Corresponds to the dotted string ``"1.2.840.113549.1.1.13"``. This is
715 a SHA512 digest signed by an RSA key.
716
717.. data:: OID_ECDSA_WITH_SHA224
718
719 Corresponds to the dotted string ``"1.2.840.10045.4.3.1"``. This is
720 a SHA224 digest signed by an ECDSA key.
721
722.. data:: OID_ECDSA_WITH_SHA256
723
724 Corresponds to the dotted string ``"1.2.840.10045.4.3.2"``. This is
725 a SHA256 digest signed by an ECDSA key.
726
727.. data:: OID_ECDSA_WITH_SHA384
728
729 Corresponds to the dotted string ``"1.2.840.10045.4.3.3"``. This is
730 a SHA384 digest signed by an ECDSA key.
731
732.. data:: OID_ECDSA_WITH_SHA512
733
734 Corresponds to the dotted string ``"1.2.840.10045.4.3.4"``. This is
735 a SHA512 digest signed by an ECDSA key.
736
737.. data:: OID_DSA_WITH_SHA1
738
739 Corresponds to the dotted string ``"1.2.840.10040.4.3"``. This is
740 a SHA1 digest signed by a DSA key.
741
742.. data:: OID_DSA_WITH_SHA224
743
744 Corresponds to the dotted string ``"2.16.840.1.101.3.4.3.1"``. This is
745 a SHA224 digest signed by a DSA key.
746
747.. data:: OID_DSA_WITH_SHA256
748
Paul Kehrerfbb7ac82015-03-16 19:26:29 -0500749 Corresponds to the dotted string ``"2.16.840.1.101.3.4.3.2"``. This is
Paul Kehrer56da2a52015-02-11 23:35:07 -0600750 a SHA256 digest signed by a DSA key.
751
Paul Kehrerffa2a152015-03-31 08:18:25 -0500752.. _eku_oids:
753
Paul Kehrere1513fa2015-03-30 23:08:17 -0500754Extended Key Usage OIDs
755~~~~~~~~~~~~~~~~~~~~~~~
756
757.. data:: OID_SERVER_AUTH
758
759 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.1"``. This is used to
760 denote that a certificate may be used for TLS web server authentication.
761
762.. data:: OID_CLIENT_AUTH
763
764 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.2"``. This is used to
765 denote that a certificate may be used for TLS web client authentication.
766
767.. data:: OID_CODE_SIGNING
768
769 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.3"``. This is used to
770 denote that a certificate may be used for code signing.
771
772.. data:: OID_EMAIL_PROTECTION
773
774 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.4"``. This is used to
775 denote that a certificate may be used for email protection.
776
777.. data:: OID_TIME_STAMPING
778
779 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.8"``. This is used to
780 denote that a certificate may be used for time stamping.
781
782.. data:: OID_OCSP_SIGNING
783
784 Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.9"``. This is used to
785 denote that a certificate may be used for signing OCSP responses.
786
Paul Kehrer5553d572015-03-23 21:08:01 -0500787.. _extension_oids:
788
Paul Kehrer2bb94642015-03-21 09:54:17 -0500789Extension OIDs
790~~~~~~~~~~~~~~
791
792.. data:: OID_BASIC_CONSTRAINTS
793
794 Corresponds to the dotted string ``"2.5.29.19"``. The identifier for the
Paul Kehrer611d3d32015-03-22 13:31:18 -0500795 :class:`BasicConstraints` extension type.
Paul Kehrer2bb94642015-03-21 09:54:17 -0500796
Paul Kehrercecbbba2015-03-30 14:58:38 -0500797.. data:: OID_KEY_USAGE
798
799 Corresponds to the dotted string ``"2.5.29.15"``. The identifier for the
800 :class:`KeyUsage` extension type.
801
Paul Kehrer56da2a52015-02-11 23:35:07 -0600802
Paul Kehrer912d3fb2015-01-29 11:19:22 -0600803Exceptions
804~~~~~~~~~~
805
Paul Kehrere76cd272014-12-14 19:00:51 -0600806.. class:: InvalidVersion
Paul Kehrera68fd332014-11-27 07:08:40 -1000807
808 This is raised when an X.509 certificate has an invalid version number.
Paul Kehrer016e08a2014-11-26 09:41:18 -1000809
Paul Kehrerd5cccf72014-12-15 17:20:33 -0600810 .. attribute:: parsed_version
811
Paul Kehrerbbffc402014-12-17 13:33:55 -0600812 :type: int
813
814 Returns the raw version that was parsed from the certificate.
Paul Kehrerd5cccf72014-12-15 17:20:33 -0600815
Paul Kehrerfbb7ac82015-03-16 19:26:29 -0500816.. class:: DuplicateExtension
817
818 This is raised when more than one X.509 extension of the same type is
819 found within a certificate.
820
821 .. attribute:: oid
822
823 :type: :class:`ObjectIdentifier`
824
825 Returns the OID.
826
827.. class:: UnsupportedExtension
828
829 This is raised when a certificate contains an unsupported extension type.
830
831 .. attribute:: oid
832
833 :type: :class:`ObjectIdentifier`
834
835 Returns the OID.
836
Paul Kehrerfa56a232015-03-17 13:14:03 -0500837.. class:: ExtensionNotFound
838
839 This is raised when calling :meth:`Extensions.get_extension_for_oid` with
840 an extension OID that is not present in the certificate.
841
842 .. attribute:: oid
843
844 :type: :class:`ObjectIdentifier`
845
846 Returns the OID.
847
Paul Kehrer016e08a2014-11-26 09:41:18 -1000848
849.. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure
Paul Kehrera68fd332014-11-27 07:08:40 -1000850.. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security