Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 1 | X.509 |
| 2 | ===== |
| 3 | |
Paul Kehrer | a9d78c1 | 2014-11-26 10:59:03 -1000 | [diff] [blame] | 4 | .. currentmodule:: cryptography.x509 |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 5 | |
| 6 | X.509 is an ITU-T standard for a `public key infrastructure`_. X.509v3 is |
Paul Kehrer | a68fd33 | 2014-11-27 07:08:40 -1000 | [diff] [blame] | 7 | defined in :rfc:`5280` (which obsoletes :rfc:`2459` and :rfc:`3280`). X.509 |
| 8 | certificates are commonly used in protocols like `TLS`_. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 9 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 10 | |
| 11 | Loading Certificates |
| 12 | ~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 13 | |
| 14 | .. function:: load_pem_x509_certificate(data, backend) |
| 15 | |
| 16 | .. versionadded:: 0.7 |
| 17 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 18 | Deserialize a certificate from PEM encoded data. PEM certificates are |
| 19 | base64 decoded and have delimiters that look like |
| 20 | ``-----BEGIN CERTIFICATE-----``. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 21 | |
| 22 | :param bytes data: The PEM encoded certificate data. |
| 23 | |
| 24 | :param backend: A backend supporting the |
| 25 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 26 | interface. |
| 27 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 28 | :returns: An instance of :class:`~cryptography.x509.Certificate`. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 29 | |
| 30 | .. function:: load_der_x509_certificate(data, backend) |
| 31 | |
| 32 | .. versionadded:: 0.7 |
| 33 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 34 | Deserialize a certificate from DER encoded data. DER is a binary format |
Paul Kehrer | 92aac38 | 2014-12-15 16:25:28 -0600 | [diff] [blame] | 35 | and is commonly found in files with the ``.cer`` extension (although file |
| 36 | extensions are not a guarantee of encoding type). |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 37 | |
| 38 | :param bytes data: The DER encoded certificate data. |
| 39 | |
| 40 | :param backend: A backend supporting the |
| 41 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 42 | interface. |
| 43 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 44 | :returns: An instance of :class:`~cryptography.x509.Certificate`. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 45 | |
| 46 | .. testsetup:: |
| 47 | |
| 48 | pem_data = b""" |
| 49 | -----BEGIN CERTIFICATE----- |
| 50 | MIIDfDCCAmSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJVUzEf |
| 51 | MB0GA1UEChMWVGVzdCBDZXJ0aWZpY2F0ZXMgMjAxMTEVMBMGA1UEAxMMVHJ1c3Qg |
| 52 | QW5jaG9yMB4XDTEwMDEwMTA4MzAwMFoXDTMwMTIzMTA4MzAwMFowQDELMAkGA1UE |
| 53 | BhMCVVMxHzAdBgNVBAoTFlRlc3QgQ2VydGlmaWNhdGVzIDIwMTExEDAOBgNVBAMT |
| 54 | B0dvb2QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCQWJpHYo37 |
| 55 | Xfb7oJSPe+WvfTlzIG21WQ7MyMbGtK/m8mejCzR6c+f/pJhEH/OcDSMsXq8h5kXa |
| 56 | BGqWK+vSwD/Pzp5OYGptXmGPcthDtAwlrafkGOS4GqIJ8+k9XGKs+vQUXJKsOk47 |
| 57 | RuzD6PZupq4s16xaLVqYbUC26UcY08GpnoLNHJZS/EmXw1ZZ3d4YZjNlpIpWFNHn |
| 58 | UGmdiGKXUPX/9H0fVjIAaQwjnGAbpgyCumWgzIwPpX+ElFOUr3z7BoVnFKhIXze+ |
| 59 | VmQGSWxZxvWDUN90Ul0tLEpLgk3OVxUB4VUGuf15OJOpgo1xibINPmWt14Vda2N9 |
| 60 | yrNKloJGZNqLAgMBAAGjfDB6MB8GA1UdIwQYMBaAFOR9X9FclYYILAWuvnW2ZafZ |
| 61 | XahmMB0GA1UdDgQWBBRYAYQkG7wrUpRKPaUQchRR9a86yTAOBgNVHQ8BAf8EBAMC |
| 62 | AQYwFwYDVR0gBBAwDjAMBgpghkgBZQMCATABMA8GA1UdEwEB/wQFMAMBAf8wDQYJ |
| 63 | KoZIhvcNAQELBQADggEBADWHlxbmdTXNwBL/llwhQqwnazK7CC2WsXBBqgNPWj7m |
| 64 | tvQ+aLG8/50Qc2Sun7o2VnwF9D18UUe8Gj3uPUYH+oSI1vDdyKcjmMbKRU4rk0eo |
| 65 | 3UHNDXwqIVc9CQS9smyV+x1HCwL4TTrq+LXLKx/qVij0Yqk+UJfAtrg2jnYKXsCu |
| 66 | FMBQQnWCGrwa1g1TphRp/RmYHnMynYFmZrXtzFz+U9XEA7C+gPq4kqDI/iVfIT1s |
| 67 | 6lBtdB50lrDVwl2oYfAvW/6sC2se2QleZidUmrziVNP4oEeXINokU6T6p//HM1FG |
| 68 | QYw2jOvpKcKtWCSAnegEbgsGYzATKjmPJPJ0npHFqzM= |
| 69 | -----END CERTIFICATE----- |
| 70 | """.strip() |
| 71 | |
| 72 | .. doctest:: |
| 73 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 74 | >>> from cryptography import x509 |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 75 | >>> from cryptography.hazmat.backends import default_backend |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 76 | >>> cert = x509.load_pem_x509_certificate(pem_data, default_backend()) |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 77 | >>> cert.serial |
| 78 | 2 |
| 79 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 80 | X.509 Certificate Object |
| 81 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 82 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 83 | .. class:: Certificate |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 84 | |
| 85 | .. versionadded:: 0.7 |
| 86 | |
| 87 | .. attribute:: version |
| 88 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 89 | :type: :class:`~cryptography.x509.Version` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 90 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 91 | The certificate version as an enumeration. Version 3 certificates are |
| 92 | the latest version and also the only type you should see in practice. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 93 | |
Alex Gaynor | 89c4dc8 | 2014-12-16 16:49:33 -0800 | [diff] [blame] | 94 | :raises cryptography.x509.InvalidVersion: If the version in the |
Alex Gaynor | 6d7ab4c | 2014-12-16 16:50:33 -0800 | [diff] [blame] | 95 | certificate is not a known |
| 96 | :class:`X.509 version <cryptography.x509.Version>`. |
Paul Kehrer | 92aac38 | 2014-12-15 16:25:28 -0600 | [diff] [blame] | 97 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 98 | .. doctest:: |
| 99 | |
| 100 | >>> cert.version |
| 101 | <Version.v3: 2> |
| 102 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 103 | .. method:: fingerprint(algorithm) |
| 104 | |
| 105 | :param algorithm: The |
Paul Kehrer | 601278a | 2015-02-12 12:51:00 -0600 | [diff] [blame] | 106 | :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 107 | that will be used to generate the fingerprint. |
| 108 | |
| 109 | :return bytes: The fingerprint using the supplied hash algorithm as |
| 110 | bytes. |
| 111 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 112 | .. doctest:: |
| 113 | |
| 114 | >>> from cryptography.hazmat.primitives import hashes |
| 115 | >>> cert.fingerprint(hashes.SHA256()) |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 116 | '\x86\xd2\x187Gc\xfc\xe7}[+E9\x8d\xb4\x8f\x10\xe5S\xda\x18u\xbe}a\x03\x08[\xac\xa04?' |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 117 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 118 | .. attribute:: serial |
| 119 | |
| 120 | :type: int |
| 121 | |
| 122 | The serial as a Python integer. |
| 123 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 124 | .. doctest:: |
| 125 | |
| 126 | >>> cert.serial |
| 127 | 2 |
| 128 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 129 | .. method:: public_key() |
| 130 | |
| 131 | :type: |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 132 | :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` or |
Paul Kehrer | 45efdbc | 2015-02-12 10:58:22 -0600 | [diff] [blame] | 133 | :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` or |
| 134 | :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 135 | |
| 136 | The public key associated with the certificate. |
| 137 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 138 | .. doctest:: |
| 139 | |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 140 | >>> from cryptography.hazmat.primitives.asymmetric import rsa |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 141 | >>> public_key = cert.public_key() |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 142 | >>> isinstance(public_key, rsa.RSAPublicKey) |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 143 | True |
| 144 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 145 | .. attribute:: not_valid_before |
| 146 | |
| 147 | :type: :class:`datetime.datetime` |
| 148 | |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 149 | A naïve datetime representing the beginning of the validity period for |
| 150 | the certificate in UTC. This value is inclusive. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 151 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 152 | .. doctest:: |
| 153 | |
| 154 | >>> cert.not_valid_before |
| 155 | datetime.datetime(2010, 1, 1, 8, 30) |
| 156 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 157 | .. attribute:: not_valid_after |
| 158 | |
| 159 | :type: :class:`datetime.datetime` |
| 160 | |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 161 | A naïve datetime representing the end of the validity period for the |
| 162 | certificate in UTC. This value is inclusive. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 163 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 164 | .. doctest:: |
| 165 | |
| 166 | >>> cert.not_valid_after |
| 167 | datetime.datetime(2030, 12, 31, 8, 30) |
| 168 | |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 169 | .. attribute:: issuer |
| 170 | |
| 171 | .. versionadded:: 0.8 |
| 172 | |
| 173 | :type: :class:`Name` |
| 174 | |
| 175 | The :class:`Name` of the issuer. |
| 176 | |
| 177 | .. attribute:: subject |
| 178 | |
| 179 | .. versionadded:: 0.8 |
| 180 | |
| 181 | :type: :class:`Name` |
| 182 | |
| 183 | The :class:`Name` of the subject. |
| 184 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 185 | .. attribute:: signature_hash_algorithm |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 186 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 187 | :type: :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 188 | |
Paul Kehrer | e612ec7 | 2015-02-16 14:33:35 -0600 | [diff] [blame] | 189 | Returns the |
Paul Kehrer | 71d40c6 | 2015-02-19 08:21:04 -0600 | [diff] [blame] | 190 | :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` which |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 191 | was used in signing this certificate. |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 192 | |
| 193 | .. doctest:: |
| 194 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 195 | >>> from cryptography.hazmat.primitives import hashes |
| 196 | >>> isinstance(cert.signature_hash_algorithm, hashes.SHA256) |
| 197 | True |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 198 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 199 | .. attribute:: extensions |
| 200 | |
| 201 | :type: :class:`Extensions` |
| 202 | |
| 203 | The extensions encoded in the certificate. |
| 204 | |
| 205 | :raises cryptography.x509.DuplicateExtension: If more than one |
| 206 | extension of the same type is found within the certificate. |
| 207 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 208 | .. doctest:: |
| 209 | |
| 210 | >>> for ext in cert.extensions: |
| 211 | ... print(ext) |
| 212 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> |
| 213 | |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 214 | .. class:: Name |
| 215 | |
| 216 | .. versionadded:: 0.8 |
| 217 | |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 218 | An X509 Name is an ordered list of attributes. The object is iterable to |
Paul Kehrer | d21596e | 2015-02-14 09:17:26 -0600 | [diff] [blame] | 219 | get every attribute or you can use :meth:`Name.get_attributes_for_oid` to |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 220 | obtain the specific type you want. Names are sometimes represented as a |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 221 | slash or comma delimited string (e.g. ``/CN=mydomain.com/O=My Org/C=US`` or |
| 222 | ``CN=mydomain.com, O=My Org, C=US``). |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 223 | |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 224 | .. doctest:: |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 225 | |
Paul Kehrer | 8b21a4a | 2015-02-14 07:56:36 -0600 | [diff] [blame] | 226 | >>> len(cert.subject) |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 227 | 3 |
Paul Kehrer | 8b21a4a | 2015-02-14 07:56:36 -0600 | [diff] [blame] | 228 | >>> for attribute in cert.subject: |
| 229 | ... print(attribute) |
| 230 | <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.6, name=countryName)>, value=u'US')> |
| 231 | <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, value=u'Test Certificates 2011')> |
| 232 | <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')> |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 233 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 234 | .. method:: get_attributes_for_oid(oid) |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 235 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 236 | :param oid: An :class:`ObjectIdentifier` instance. |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 237 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 238 | :returns: A list of :class:`NameAttribute` instances that match the |
| 239 | OID provided. If nothing matches an empty list will be returned. |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 240 | |
| 241 | .. doctest:: |
| 242 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 243 | >>> cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME) |
| 244 | [<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName)>, value=u'Good CA')>] |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 245 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 246 | .. class:: Version |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 247 | |
| 248 | .. versionadded:: 0.7 |
| 249 | |
| 250 | An enumeration for X.509 versions. |
| 251 | |
| 252 | .. attribute:: v1 |
| 253 | |
| 254 | For version 1 X.509 certificates. |
| 255 | |
| 256 | .. attribute:: v3 |
| 257 | |
| 258 | For version 3 X.509 certificates. |
| 259 | |
Paul Kehrer | 806bfb2 | 2015-02-02 17:05:24 -0600 | [diff] [blame] | 260 | .. class:: NameAttribute |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 261 | |
| 262 | .. versionadded:: 0.8 |
| 263 | |
Paul Kehrer | 834d22f | 2015-02-06 11:01:07 -0600 | [diff] [blame] | 264 | An X.509 name consists of a list of NameAttribute instances. |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 265 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 266 | .. attribute:: oid |
| 267 | |
| 268 | :type: :class:`ObjectIdentifier` |
| 269 | |
| 270 | The attribute OID. |
| 271 | |
| 272 | .. attribute:: value |
| 273 | |
Paul Kehrer | d5852cb | 2015-01-30 08:25:23 -0600 | [diff] [blame] | 274 | :type: :term:`text` |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 275 | |
| 276 | The value of the attribute. |
| 277 | |
| 278 | .. class:: ObjectIdentifier |
| 279 | |
| 280 | .. versionadded:: 0.8 |
| 281 | |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 282 | Object identifiers (frequently seen abbreviated as OID) identify the type |
Paul Kehrer | 806bfb2 | 2015-02-02 17:05:24 -0600 | [diff] [blame] | 283 | of a value (see: :class:`NameAttribute`). |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 284 | |
Paul Kehrer | d44f9a6 | 2015-02-04 14:47:34 -0600 | [diff] [blame] | 285 | .. attribute:: dotted_string |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 286 | |
| 287 | :type: :class:`str` |
| 288 | |
Paul Kehrer | fedf4f4 | 2015-02-06 11:22:07 -0600 | [diff] [blame] | 289 | The dotted string value of the OID (e.g. ``"2.5.4.3"``) |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 290 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 291 | X.509 Extensions |
| 292 | ~~~~~~~~~~~~~~~~ |
| 293 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 294 | .. class:: Extensions |
| 295 | |
| 296 | .. versionadded:: 0.9 |
| 297 | |
| 298 | An X.509 Extensions instance is an ordered list of extensions. The object |
| 299 | is iterable to get every extension. |
| 300 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 301 | .. method:: get_extension_for_oid(oid) |
| 302 | |
| 303 | :param oid: An :class:`ObjectIdentifier` instance. |
| 304 | |
| 305 | :returns: An instance of the extension class. |
| 306 | |
| 307 | :raises cryptography.x509.ExtensionNotFound: If the certificate does |
| 308 | not have the extension requested. |
| 309 | |
| 310 | :raises cryptography.x509.UnsupportedExtension: If the certificate |
| 311 | contains an extension that is not supported. |
| 312 | |
| 313 | .. doctest:: |
| 314 | |
| 315 | >>> cert.extensions.get_extension_for_oid(x509.OID_BASIC_CONSTRAINTS) |
| 316 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> |
| 317 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 318 | .. class:: Extension |
| 319 | |
| 320 | .. versionadded:: 0.9 |
| 321 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 322 | .. attribute:: oid |
| 323 | |
| 324 | :type: :class:`ObjectIdentifier` |
| 325 | |
Paul Kehrer | 5553d57 | 2015-03-23 21:08:01 -0500 | [diff] [blame] | 326 | The :ref:`extension OID <extension_oids>`. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 327 | |
| 328 | .. attribute:: critical |
| 329 | |
| 330 | :type: bool |
| 331 | |
Paul Kehrer | 58b7569 | 2015-03-22 23:24:58 -0500 | [diff] [blame] | 332 | Determines whether a given extension is critical or not. :rfc:`5280` |
| 333 | requires that "A certificate-using system MUST reject the certificate |
| 334 | if it encounters a critical extension it does not recognize or a |
| 335 | critical extension that contains information that it cannot process". |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 336 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 337 | .. attribute:: value |
| 338 | |
| 339 | Returns an instance of the extension type corresponding to the OID. |
| 340 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 341 | .. class:: BasicConstraints |
| 342 | |
| 343 | .. versionadded:: 0.9 |
| 344 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 345 | Basic constraints is an X.509 extension type that defines whether a given |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 346 | certificate is allowed to sign additional certificates and what path |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 347 | length restrictions may exist. It corresponds to |
| 348 | :data:`OID_BASIC_CONSTRAINTS`. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 349 | |
| 350 | .. attribute:: ca |
| 351 | |
| 352 | :type: bool |
| 353 | |
| 354 | Whether the certificate can sign certificates. |
| 355 | |
| 356 | .. attribute:: path_length |
| 357 | |
Paul Kehrer | fd1444c | 2015-03-21 19:47:05 -0500 | [diff] [blame] | 358 | :type: int or None |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 359 | |
| 360 | The maximum path length for certificates subordinate to this |
| 361 | certificate. This attribute only has meaning if ``ca`` is true. |
| 362 | If ``ca`` is true then a path length of None means there's no |
| 363 | restriction on the number of subordinate CAs in the certificate chain. |
| 364 | If it is zero or greater then that number defines the maximum length. |
| 365 | For example, a ``path_length`` of 1 means the certificate can sign a |
| 366 | subordinate CA, but the subordinate CA is not allowed to create |
Paul Kehrer | fd1444c | 2015-03-21 19:47:05 -0500 | [diff] [blame] | 367 | subordinates with ``ca`` set to true. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 368 | |
| 369 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 370 | Object Identifiers |
| 371 | ~~~~~~~~~~~~~~~~~~ |
| 372 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 373 | X.509 elements are frequently identified by :class:`ObjectIdentifier` |
| 374 | instances. The following common OIDs are available as constants. |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 375 | |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 376 | Name OIDs |
| 377 | ~~~~~~~~~ |
| 378 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 379 | .. data:: OID_COMMON_NAME |
| 380 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 381 | Corresponds to the dotted string ``"2.5.4.3"``. Historically the domain |
| 382 | name would be encoded here for server certificates. :rfc:`2818` deprecates |
| 383 | this practice and names of that type should now be located in a |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 384 | SubjectAlternativeName extension. This OID is typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 385 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 386 | .. data:: OID_COUNTRY_NAME |
| 387 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 388 | Corresponds to the dotted string ``"2.5.4.6"``. This OID is typically seen |
| 389 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 390 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 391 | .. data:: OID_LOCALITY_NAME |
| 392 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 393 | Corresponds to the dotted string ``"2.5.4.7"``. This OID is typically seen |
| 394 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 395 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 396 | .. data:: OID_STATE_OR_PROVINCE_NAME |
| 397 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 398 | Corresponds to the dotted string ``"2.5.4.8"``. This OID is typically seen |
| 399 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 400 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 401 | .. data:: OID_ORGANIZATION_NAME |
| 402 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 403 | Corresponds to the dotted string ``"2.5.4.10"``. This OID is typically seen |
| 404 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 405 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 406 | .. data:: OID_ORGANIZATIONAL_UNIT_NAME |
| 407 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 408 | Corresponds to the dotted string ``"2.5.4.11"``. This OID is typically seen |
| 409 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 410 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 411 | .. data:: OID_SERIAL_NUMBER |
| 412 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 413 | Corresponds to the dotted string ``"2.5.4.5"``. This is distinct from the |
| 414 | serial number of the certificate itself (which can be obtained with |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 415 | :func:`Certificate.serial`). This OID is typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 416 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 417 | .. data:: OID_SURNAME |
| 418 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 419 | Corresponds to the dotted string ``"2.5.4.4"``. This OID is typically seen |
| 420 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 421 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 422 | .. data:: OID_GIVEN_NAME |
| 423 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 424 | Corresponds to the dotted string ``"2.5.4.42"``. This OID is typically seen |
| 425 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 426 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 427 | .. data:: OID_TITLE |
| 428 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 429 | Corresponds to the dotted string ``"2.5.4.12"``. This OID is typically seen |
| 430 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 431 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 432 | .. data:: OID_GENERATION_QUALIFIER |
| 433 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 434 | Corresponds to the dotted string ``"2.5.4.44"``. This OID is typically seen |
| 435 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 436 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 437 | .. data:: OID_DN_QUALIFIER |
| 438 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 439 | Corresponds to the dotted string ``"2.5.4.46"``. This specifies |
| 440 | disambiguating information to add to the relative distinguished name of an |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 441 | entry. See :rfc:`2256`. This OID is typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 442 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 443 | .. data:: OID_PSEUDONYM |
| 444 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 445 | Corresponds to the dotted string ``"2.5.4.65"``. This OID is typically seen |
| 446 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 447 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 448 | .. data:: OID_DOMAIN_COMPONENT |
| 449 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 450 | Corresponds to the dotted string ``"0.9.2342.19200300.100.1.25"``. A string |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 451 | holding one component of a domain name. See :rfc:`4519`. This OID is |
| 452 | typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 453 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 454 | .. data:: OID_EMAIL_ADDRESS |
| 455 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 456 | Corresponds to the dotted string ``"1.2.840.113549.1.9.1"``. This OID is |
| 457 | typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 458 | |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 459 | Signature Algorithm OIDs |
| 460 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 461 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 462 | .. data:: OID_RSA_WITH_MD5 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 463 | |
| 464 | Corresponds to the dotted string ``"1.2.840.113549.1.1.4"``. This is |
| 465 | an MD5 digest signed by an RSA key. |
| 466 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 467 | .. data:: OID_RSA_WITH_SHA1 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 468 | |
| 469 | Corresponds to the dotted string ``"1.2.840.113549.1.1.5"``. This is |
| 470 | a SHA1 digest signed by an RSA key. |
| 471 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 472 | .. data:: OID_RSA_WITH_SHA224 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 473 | |
| 474 | Corresponds to the dotted string ``"1.2.840.113549.1.1.14"``. This is |
| 475 | a SHA224 digest signed by an RSA key. |
| 476 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 477 | .. data:: OID_RSA_WITH_SHA256 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 478 | |
| 479 | Corresponds to the dotted string ``"1.2.840.113549.1.1.11"``. This is |
| 480 | a SHA256 digest signed by an RSA key. |
| 481 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 482 | .. data:: OID_RSA_WITH_SHA384 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 483 | |
| 484 | Corresponds to the dotted string ``"1.2.840.113549.1.1.12"``. This is |
| 485 | a SHA384 digest signed by an RSA key. |
| 486 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 487 | .. data:: OID_RSA_WITH_SHA512 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 488 | |
| 489 | Corresponds to the dotted string ``"1.2.840.113549.1.1.13"``. This is |
| 490 | a SHA512 digest signed by an RSA key. |
| 491 | |
| 492 | .. data:: OID_ECDSA_WITH_SHA224 |
| 493 | |
| 494 | Corresponds to the dotted string ``"1.2.840.10045.4.3.1"``. This is |
| 495 | a SHA224 digest signed by an ECDSA key. |
| 496 | |
| 497 | .. data:: OID_ECDSA_WITH_SHA256 |
| 498 | |
| 499 | Corresponds to the dotted string ``"1.2.840.10045.4.3.2"``. This is |
| 500 | a SHA256 digest signed by an ECDSA key. |
| 501 | |
| 502 | .. data:: OID_ECDSA_WITH_SHA384 |
| 503 | |
| 504 | Corresponds to the dotted string ``"1.2.840.10045.4.3.3"``. This is |
| 505 | a SHA384 digest signed by an ECDSA key. |
| 506 | |
| 507 | .. data:: OID_ECDSA_WITH_SHA512 |
| 508 | |
| 509 | Corresponds to the dotted string ``"1.2.840.10045.4.3.4"``. This is |
| 510 | a SHA512 digest signed by an ECDSA key. |
| 511 | |
| 512 | .. data:: OID_DSA_WITH_SHA1 |
| 513 | |
| 514 | Corresponds to the dotted string ``"1.2.840.10040.4.3"``. This is |
| 515 | a SHA1 digest signed by a DSA key. |
| 516 | |
| 517 | .. data:: OID_DSA_WITH_SHA224 |
| 518 | |
| 519 | Corresponds to the dotted string ``"2.16.840.1.101.3.4.3.1"``. This is |
| 520 | a SHA224 digest signed by a DSA key. |
| 521 | |
| 522 | .. data:: OID_DSA_WITH_SHA256 |
| 523 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 524 | Corresponds to the dotted string ``"2.16.840.1.101.3.4.3.2"``. This is |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 525 | a SHA256 digest signed by a DSA key. |
| 526 | |
Paul Kehrer | 5553d57 | 2015-03-23 21:08:01 -0500 | [diff] [blame] | 527 | .. _extension_oids: |
| 528 | |
Paul Kehrer | 2bb9464 | 2015-03-21 09:54:17 -0500 | [diff] [blame] | 529 | Extension OIDs |
| 530 | ~~~~~~~~~~~~~~ |
| 531 | |
| 532 | .. data:: OID_BASIC_CONSTRAINTS |
| 533 | |
| 534 | Corresponds to the dotted string ``"2.5.29.19"``. The identifier for the |
Paul Kehrer | 611d3d3 | 2015-03-22 13:31:18 -0500 | [diff] [blame] | 535 | :class:`BasicConstraints` extension type. |
Paul Kehrer | 2bb9464 | 2015-03-21 09:54:17 -0500 | [diff] [blame] | 536 | |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 537 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 538 | Exceptions |
| 539 | ~~~~~~~~~~ |
| 540 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 541 | .. class:: InvalidVersion |
Paul Kehrer | a68fd33 | 2014-11-27 07:08:40 -1000 | [diff] [blame] | 542 | |
| 543 | This is raised when an X.509 certificate has an invalid version number. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 544 | |
Paul Kehrer | d5cccf7 | 2014-12-15 17:20:33 -0600 | [diff] [blame] | 545 | .. attribute:: parsed_version |
| 546 | |
Paul Kehrer | bbffc40 | 2014-12-17 13:33:55 -0600 | [diff] [blame] | 547 | :type: int |
| 548 | |
| 549 | Returns the raw version that was parsed from the certificate. |
Paul Kehrer | d5cccf7 | 2014-12-15 17:20:33 -0600 | [diff] [blame] | 550 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 551 | .. class:: DuplicateExtension |
| 552 | |
| 553 | This is raised when more than one X.509 extension of the same type is |
| 554 | found within a certificate. |
| 555 | |
| 556 | .. attribute:: oid |
| 557 | |
| 558 | :type: :class:`ObjectIdentifier` |
| 559 | |
| 560 | Returns the OID. |
| 561 | |
| 562 | .. class:: UnsupportedExtension |
| 563 | |
| 564 | This is raised when a certificate contains an unsupported extension type. |
| 565 | |
| 566 | .. attribute:: oid |
| 567 | |
| 568 | :type: :class:`ObjectIdentifier` |
| 569 | |
| 570 | Returns the OID. |
| 571 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 572 | .. class:: ExtensionNotFound |
| 573 | |
| 574 | This is raised when calling :meth:`Extensions.get_extension_for_oid` with |
| 575 | an extension OID that is not present in the certificate. |
| 576 | |
| 577 | .. attribute:: oid |
| 578 | |
| 579 | :type: :class:`ObjectIdentifier` |
| 580 | |
| 581 | Returns the OID. |
| 582 | |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 583 | |
| 584 | .. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure |
Paul Kehrer | a68fd33 | 2014-11-27 07:08:40 -1000 | [diff] [blame] | 585 | .. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security |