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 | |
Paul Kehrer | d26c4db | 2015-03-15 15:36:24 -0500 | [diff] [blame] | 6 | .. 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 Kehrer | d3dafbd | 2015-03-15 16:24:18 -0500 | [diff] [blame] | 29 | 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 | |
Paul Kehrer | 93ae805 | 2015-05-02 23:18:09 -0500 | [diff] [blame] | 53 | cryptography_cert_pem = b""" |
| 54 | -----BEGIN CERTIFICATE----- |
| 55 | MIIFvTCCBKWgAwIBAgICPyAwDQYJKoZIhvcNAQELBQAwRzELMAkGA1UEBhMCVVMx |
| 56 | FjAUBgNVBAoTDUdlb1RydXN0IEluYy4xIDAeBgNVBAMTF1JhcGlkU1NMIFNIQTI1 |
| 57 | NiBDQSAtIEczMB4XDTE0MTAxNTEyMDkzMloXDTE4MTExNjAxMTUwM1owgZcxEzAR |
| 58 | BgNVBAsTCkdUNDg3NDI5NjUxMTAvBgNVBAsTKFNlZSB3d3cucmFwaWRzc2wuY29t |
| 59 | L3Jlc291cmNlcy9jcHMgKGMpMTQxLzAtBgNVBAsTJkRvbWFpbiBDb250cm9sIFZh |
| 60 | bGlkYXRlZCAtIFJhcGlkU1NMKFIpMRwwGgYDVQQDExN3d3cuY3J5cHRvZ3JhcGh5 |
| 61 | LmlvMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAom/FebKJIot7Sp3s |
| 62 | itG1sicpe3thCssjI+g1JDAS7I3GLVNmbms1DOdIIqwf01gZkzzXBN2+9sOnyRaR |
| 63 | PPfCe1jTr3dk2y6rPE559vPa1nZQkhlzlhMhlPyjaT+S7g4Tio4qV2sCBZU01DZJ |
| 64 | CaksfohN+5BNVWoJzTbOcrHOEJ+M8B484KlBCiSxqf9cyNQKru4W3bHaCVNVJ8eu |
| 65 | 6i6KyhzLa0L7yK3LXwwXVs583C0/vwFhccGWsFODqD/9xHUzsBIshE8HKjdjDi7Y |
| 66 | 3BFQzVUQFjBB50NSZfAA/jcdt1blxJouc7z9T8Oklh+V5DDBowgAsrT4b6Z2Fq6/ |
| 67 | r7D1GqivLK/ypUQmxq2WXWAUBb/Q6xHgxASxI4Br+CByIUQJsm8L2jzc7k+mF4hW |
| 68 | ltAIUkbo8fGiVnat0505YJgxWEDKOLc4Gda6d/7GVd5AvKrz242bUqeaWo6e4MTx |
| 69 | diku2Ma3rhdcr044Qvfh9hGyjqNjvhWY/I+VRWgihU7JrYvgwFdJqsQ5eiKT4OHi |
| 70 | gsejvWwkZzDtiQ+aQTrzM1FsY2swJBJsLSX4ofohlVRlIJCn/ME+XErj553431Lu |
| 71 | YQ5SzMd3nXzN78Vj6qzTfMUUY72UoT1/AcFiUMobgIqrrmwuNxfrkbVE2b6Bga74 |
| 72 | FsJX63prvrJ41kuHK/16RQBM7fcCAwEAAaOCAWAwggFcMB8GA1UdIwQYMBaAFMOc |
| 73 | 8/zTRgg0u85Gf6B8W/PiCMtZMFcGCCsGAQUFBwEBBEswSTAfBggrBgEFBQcwAYYT |
| 74 | aHR0cDovL2d2LnN5bWNkLmNvbTAmBggrBgEFBQcwAoYaaHR0cDovL2d2LnN5bWNi |
| 75 | LmNvbS9ndi5jcnQwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMB |
| 76 | BggrBgEFBQcDAjAvBgNVHREEKDAmghN3d3cuY3J5cHRvZ3JhcGh5Lmlvgg9jcnlw |
| 77 | dG9ncmFwaHkuaW8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL2d2LnN5bWNiLmNv |
| 78 | bS9ndi5jcmwwDAYDVR0TAQH/BAIwADBFBgNVHSAEPjA8MDoGCmCGSAGG+EUBBzYw |
| 79 | LDAqBggrBgEFBQcCARYeaHR0cHM6Ly93d3cucmFwaWRzc2wuY29tL2xlZ2FsMA0G |
| 80 | CSqGSIb3DQEBCwUAA4IBAQAzIYO2jx7h17FBT74tJ2zbV9OKqGb7QF8y3wUtP4xc |
| 81 | dH80vprI/Cfji8s86kr77aAvAqjDjaVjHn7UzebhSUivvRPmfzRgyWBacomnXTSt |
| 82 | Xlt2dp2nDQuwGyK2vB7dMfKnQAkxwq1sYUXznB8i0IhhCAoXp01QGPKq51YoIlnF |
| 83 | 7DRMk6iEaL1SJbkIrLsCQyZFDf0xtfW9DqXugMMLoxeCsBhZJQzNyS2ryirrv9LH |
| 84 | aK3+6IZjrcyy9bkpz/gzJucyhU+75c4My/mnRCrtItRbCQuiI5pd5poDowm+HH9i |
| 85 | GVI9+0lAFwxOUnOnwsoI40iOoxjLMGB+CgFLKCGUcWxP |
| 86 | -----END CERTIFICATE----- |
| 87 | """.strip() |
| 88 | |
Paul Kehrer | d3dafbd | 2015-03-15 16:24:18 -0500 | [diff] [blame] | 89 | X.509 is an ITU-T standard for a `public key infrastructure`_. X.509v3 is |
| 90 | defined in :rfc:`5280` (which obsoletes :rfc:`2459` and :rfc:`3280`). X.509 |
| 91 | certificates are commonly used in protocols like `TLS`_. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 92 | |
| 93 | Loading Certificates |
| 94 | ~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 95 | |
| 96 | .. function:: load_pem_x509_certificate(data, backend) |
| 97 | |
| 98 | .. versionadded:: 0.7 |
| 99 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 100 | Deserialize a certificate from PEM encoded data. PEM certificates are |
| 101 | base64 decoded and have delimiters that look like |
| 102 | ``-----BEGIN CERTIFICATE-----``. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 103 | |
| 104 | :param bytes data: The PEM encoded certificate data. |
| 105 | |
| 106 | :param backend: A backend supporting the |
| 107 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 108 | interface. |
| 109 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 110 | :returns: An instance of :class:`~cryptography.x509.Certificate`. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 111 | |
| 112 | .. function:: load_der_x509_certificate(data, backend) |
| 113 | |
| 114 | .. versionadded:: 0.7 |
| 115 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 116 | Deserialize a certificate from DER encoded data. DER is a binary format |
Paul Kehrer | 92aac38 | 2014-12-15 16:25:28 -0600 | [diff] [blame] | 117 | and is commonly found in files with the ``.cer`` extension (although file |
| 118 | extensions are not a guarantee of encoding type). |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 119 | |
| 120 | :param bytes data: The DER encoded certificate data. |
| 121 | |
| 122 | :param backend: A backend supporting the |
| 123 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 124 | interface. |
| 125 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 126 | :returns: An instance of :class:`~cryptography.x509.Certificate`. |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 127 | |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 128 | .. doctest:: |
| 129 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 130 | >>> from cryptography import x509 |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 131 | >>> from cryptography.hazmat.backends import default_backend |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 132 | >>> cert = x509.load_pem_x509_certificate(pem_data, default_backend()) |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 133 | >>> cert.serial |
| 134 | 2 |
| 135 | |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 136 | Loading Certificate Signing Requests |
| 137 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 138 | |
Paul Kehrer | 31e3988 | 2015-03-11 11:37:04 -0500 | [diff] [blame] | 139 | .. function:: load_pem_x509_csr(data, backend) |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 140 | |
| 141 | .. versionadded:: 0.9 |
| 142 | |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 143 | Deserialize a certificate signing request (CSR) from PEM encoded data. PEM |
Paul Kehrer | 5aadb9c | 2015-03-11 20:48:42 -0500 | [diff] [blame] | 144 | requests are base64 decoded and have delimiters that look like |
Paul Kehrer | d3dafbd | 2015-03-15 16:24:18 -0500 | [diff] [blame] | 145 | ``-----BEGIN CERTIFICATE REQUEST-----``. This format is also known as |
| 146 | PKCS#10. |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 147 | |
| 148 | :param bytes data: The PEM encoded request data. |
| 149 | |
| 150 | :param backend: A backend supporting the |
| 151 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 152 | interface. |
| 153 | |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 154 | :returns: An instance of |
| 155 | :class:`~cryptography.x509.CertificateSigningRequest`. |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 156 | |
Paul Kehrer | 1effb6e | 2015-03-30 15:05:59 -0500 | [diff] [blame] | 157 | .. function:: load_der_x509_csr(data, backend) |
| 158 | |
| 159 | .. versionadded:: 0.9 |
| 160 | |
| 161 | Deserialize a certificate signing request (CSR) from DER encoded data. DER |
| 162 | is a binary format and is not commonly used with CSRs. |
| 163 | |
| 164 | :param bytes data: The DER encoded request data. |
| 165 | |
| 166 | :param backend: A backend supporting the |
| 167 | :class:`~cryptography.hazmat.backends.interfaces.X509Backend` |
| 168 | interface. |
| 169 | |
| 170 | :returns: An instance of |
| 171 | :class:`~cryptography.x509.CertificateSigningRequest`. |
| 172 | |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 173 | .. doctest:: |
| 174 | |
| 175 | >>> from cryptography import x509 |
| 176 | >>> from cryptography.hazmat.backends import default_backend |
| 177 | >>> from cryptography.hazmat.primitives import hashes |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 178 | >>> csr = x509.load_pem_x509_csr(pem_req_data, default_backend()) |
| 179 | >>> isinstance(csr.signature_hash_algorithm, hashes.SHA1) |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 180 | True |
| 181 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 182 | X.509 Certificate Object |
| 183 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 184 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 185 | .. class:: Certificate |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 186 | |
| 187 | .. versionadded:: 0.7 |
| 188 | |
| 189 | .. attribute:: version |
| 190 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 191 | :type: :class:`~cryptography.x509.Version` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 192 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 193 | The certificate version as an enumeration. Version 3 certificates are |
| 194 | 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] | 195 | |
Alex Gaynor | 89c4dc8 | 2014-12-16 16:49:33 -0800 | [diff] [blame] | 196 | :raises cryptography.x509.InvalidVersion: If the version in the |
Alex Gaynor | 6d7ab4c | 2014-12-16 16:50:33 -0800 | [diff] [blame] | 197 | certificate is not a known |
| 198 | :class:`X.509 version <cryptography.x509.Version>`. |
Paul Kehrer | 92aac38 | 2014-12-15 16:25:28 -0600 | [diff] [blame] | 199 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 200 | .. doctest:: |
| 201 | |
| 202 | >>> cert.version |
| 203 | <Version.v3: 2> |
| 204 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 205 | .. method:: fingerprint(algorithm) |
| 206 | |
| 207 | :param algorithm: The |
Paul Kehrer | 601278a | 2015-02-12 12:51:00 -0600 | [diff] [blame] | 208 | :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 209 | that will be used to generate the fingerprint. |
| 210 | |
| 211 | :return bytes: The fingerprint using the supplied hash algorithm as |
| 212 | bytes. |
| 213 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 214 | .. doctest:: |
| 215 | |
| 216 | >>> from cryptography.hazmat.primitives import hashes |
| 217 | >>> cert.fingerprint(hashes.SHA256()) |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 218 | '\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] | 219 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 220 | .. attribute:: serial |
| 221 | |
| 222 | :type: int |
| 223 | |
| 224 | The serial as a Python integer. |
| 225 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 226 | .. doctest:: |
| 227 | |
| 228 | >>> cert.serial |
| 229 | 2 |
| 230 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 231 | .. method:: public_key() |
| 232 | |
| 233 | :type: |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 234 | :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` or |
Paul Kehrer | 45efdbc | 2015-02-12 10:58:22 -0600 | [diff] [blame] | 235 | :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` or |
| 236 | :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey` |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 237 | |
| 238 | The public key associated with the certificate. |
| 239 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 240 | .. doctest:: |
| 241 | |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 242 | >>> from cryptography.hazmat.primitives.asymmetric import rsa |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 243 | >>> public_key = cert.public_key() |
Alex Stapleton | f79c231 | 2014-12-30 12:50:14 +0000 | [diff] [blame] | 244 | >>> isinstance(public_key, rsa.RSAPublicKey) |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 245 | True |
| 246 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 247 | .. attribute:: not_valid_before |
| 248 | |
| 249 | :type: :class:`datetime.datetime` |
| 250 | |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 251 | A naïve datetime representing the beginning of the validity period for |
| 252 | the certificate in UTC. This value is inclusive. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 253 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 254 | .. doctest:: |
| 255 | |
| 256 | >>> cert.not_valid_before |
| 257 | datetime.datetime(2010, 1, 1, 8, 30) |
| 258 | |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 259 | .. attribute:: not_valid_after |
| 260 | |
| 261 | :type: :class:`datetime.datetime` |
| 262 | |
Paul Kehrer | 78a8150 | 2014-12-16 14:47:52 -0600 | [diff] [blame] | 263 | A naïve datetime representing the end of the validity period for the |
| 264 | certificate in UTC. This value is inclusive. |
Paul Kehrer | b2de948 | 2014-12-11 14:54:48 -0600 | [diff] [blame] | 265 | |
Paul Kehrer | cc8a26e | 2014-12-16 12:40:16 -0600 | [diff] [blame] | 266 | .. doctest:: |
| 267 | |
| 268 | >>> cert.not_valid_after |
| 269 | datetime.datetime(2030, 12, 31, 8, 30) |
| 270 | |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 271 | .. attribute:: issuer |
| 272 | |
| 273 | .. versionadded:: 0.8 |
| 274 | |
| 275 | :type: :class:`Name` |
| 276 | |
| 277 | The :class:`Name` of the issuer. |
| 278 | |
| 279 | .. attribute:: subject |
| 280 | |
| 281 | .. versionadded:: 0.8 |
| 282 | |
| 283 | :type: :class:`Name` |
| 284 | |
| 285 | The :class:`Name` of the subject. |
| 286 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 287 | .. attribute:: signature_hash_algorithm |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 288 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 289 | :type: :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 290 | |
Paul Kehrer | e612ec7 | 2015-02-16 14:33:35 -0600 | [diff] [blame] | 291 | Returns the |
Paul Kehrer | 71d40c6 | 2015-02-19 08:21:04 -0600 | [diff] [blame] | 292 | :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` which |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 293 | was used in signing this certificate. |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 294 | |
| 295 | .. doctest:: |
| 296 | |
Paul Kehrer | 8802a5b | 2015-02-13 12:06:57 -0600 | [diff] [blame] | 297 | >>> from cryptography.hazmat.primitives import hashes |
| 298 | >>> isinstance(cert.signature_hash_algorithm, hashes.SHA256) |
| 299 | True |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 300 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 301 | .. attribute:: extensions |
| 302 | |
| 303 | :type: :class:`Extensions` |
| 304 | |
| 305 | The extensions encoded in the certificate. |
| 306 | |
| 307 | :raises cryptography.x509.DuplicateExtension: If more than one |
| 308 | extension of the same type is found within the certificate. |
| 309 | |
Paul Kehrer | d8fc0be | 2015-04-21 08:31:10 -0500 | [diff] [blame] | 310 | :raises cryptography.x509.UnsupportedExtension: If the certificate |
| 311 | contains an extension that is not supported. |
| 312 | |
Paul Kehrer | bed0735 | 2015-04-21 08:31:10 -0500 | [diff] [blame] | 313 | :raises cryptography.x509.UnsupportedGeneralNameType: If an extension |
| 314 | contains a general name that is not supported. |
| 315 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 316 | .. doctest:: |
| 317 | |
| 318 | >>> for ext in cert.extensions: |
| 319 | ... print(ext) |
Paul Kehrer | d774de9 | 2015-05-03 10:52:25 -0500 | [diff] [blame] | 320 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.35, name=authorityKeyIdentifier)>, critical=False, value=<AuthorityKeyIdentifier(key_identifier='\xe4}_\xd1\\\x95\x86\x08,\x05\xae\xbeu\xb6e\xa7\xd9]\xa8f', authority_cert_issuer=None, authority_cert_serial_number=None)>)> |
Paul Kehrer | cbfb101 | 2015-04-10 20:57:20 -0400 | [diff] [blame] | 321 | <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 Kehrer | b511ba8 | 2015-04-15 11:22:48 -0400 | [diff] [blame] | 322 | <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 Kehrer | 2008d9c | 2015-05-12 22:19:56 -0500 | [diff] [blame] | 323 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.32, name=certificatePolicies)>, critical=False, value=<CertificatePolicies([<PolicyInformation(policy_identifier=<ObjectIdentifier(oid=2.16.840.1.101.3.2.1.48.1, name=Unknown OID)>, policy_qualifiers=None)>])>)> |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 324 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> |
| 325 | |
Paul Kehrer | 5aadb9c | 2015-03-11 20:48:42 -0500 | [diff] [blame] | 326 | X.509 CSR (Certificate Signing Request) Object |
| 327 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 328 | |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 329 | .. class:: CertificateSigningRequest |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 330 | |
| 331 | .. versionadded:: 0.9 |
| 332 | |
| 333 | .. method:: public_key() |
| 334 | |
| 335 | :type: |
| 336 | :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey` or |
| 337 | :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` or |
| 338 | :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey` |
| 339 | |
| 340 | The public key associated with the request. |
| 341 | |
| 342 | .. doctest:: |
| 343 | |
| 344 | >>> from cryptography.hazmat.primitives.asymmetric import rsa |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 345 | >>> public_key = csr.public_key() |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 346 | >>> isinstance(public_key, rsa.RSAPublicKey) |
| 347 | True |
| 348 | |
| 349 | .. attribute:: subject |
| 350 | |
| 351 | :type: :class:`Name` |
| 352 | |
| 353 | The :class:`Name` of the subject. |
| 354 | |
| 355 | .. attribute:: signature_hash_algorithm |
| 356 | |
| 357 | :type: :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` |
| 358 | |
| 359 | Returns the |
| 360 | :class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm` which |
| 361 | was used in signing this request. |
| 362 | |
| 363 | .. doctest:: |
| 364 | |
| 365 | >>> from cryptography.hazmat.primitives import hashes |
Paul Kehrer | a1a1f23 | 2015-03-15 15:34:35 -0500 | [diff] [blame] | 366 | >>> isinstance(csr.signature_hash_algorithm, hashes.SHA1) |
Paul Kehrer | dc480ad | 2015-02-23 12:14:54 -0600 | [diff] [blame] | 367 | True |
| 368 | |
Andre Caron | 476c5df | 2015-05-18 10:23:28 -0400 | [diff] [blame] | 369 | .. method:: public_bytes(encoding) |
| 370 | |
| 371 | :param encoding: The |
| 372 | :class:`~cryptography.hazmat.primitives.serialization.Encoding` |
| 373 | that will be used to serialize the certificate request. |
| 374 | |
| 375 | :return bytes: The data that can be written to a file or sent |
| 376 | over the network to be signed by the certificate |
| 377 | authority. |
| 378 | |
| 379 | |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 380 | .. class:: Name |
| 381 | |
| 382 | .. versionadded:: 0.8 |
| 383 | |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 384 | 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] | 385 | 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] | 386 | obtain the specific type you want. Names are sometimes represented as a |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 387 | slash or comma delimited string (e.g. ``/CN=mydomain.com/O=My Org/C=US`` or |
| 388 | ``CN=mydomain.com, O=My Org, C=US``). |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 389 | |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 390 | .. doctest:: |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 391 | |
Paul Kehrer | 8b21a4a | 2015-02-14 07:56:36 -0600 | [diff] [blame] | 392 | >>> len(cert.subject) |
Paul Kehrer | 53d8d49 | 2015-02-13 18:47:30 -0600 | [diff] [blame] | 393 | 3 |
Paul Kehrer | 8b21a4a | 2015-02-14 07:56:36 -0600 | [diff] [blame] | 394 | >>> for attribute in cert.subject: |
| 395 | ... print(attribute) |
| 396 | <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.6, name=countryName)>, value=u'US')> |
| 397 | <NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.10, name=organizationName)>, value=u'Test Certificates 2011')> |
| 398 | <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] | 399 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 400 | .. method:: get_attributes_for_oid(oid) |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 401 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 402 | :param oid: An :class:`ObjectIdentifier` instance. |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 403 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 404 | :returns: A list of :class:`NameAttribute` instances that match the |
| 405 | OID provided. If nothing matches an empty list will be returned. |
Paul Kehrer | 719d536 | 2015-01-01 20:03:52 -0600 | [diff] [blame] | 406 | |
| 407 | .. doctest:: |
| 408 | |
Paul Kehrer | e901d64 | 2015-02-11 18:50:58 -0600 | [diff] [blame] | 409 | >>> cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME) |
| 410 | [<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] | 411 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 412 | .. class:: Version |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 413 | |
| 414 | .. versionadded:: 0.7 |
| 415 | |
| 416 | An enumeration for X.509 versions. |
| 417 | |
| 418 | .. attribute:: v1 |
| 419 | |
| 420 | For version 1 X.509 certificates. |
| 421 | |
| 422 | .. attribute:: v3 |
| 423 | |
| 424 | For version 3 X.509 certificates. |
| 425 | |
Paul Kehrer | 806bfb2 | 2015-02-02 17:05:24 -0600 | [diff] [blame] | 426 | .. class:: NameAttribute |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 427 | |
| 428 | .. versionadded:: 0.8 |
| 429 | |
Paul Kehrer | 834d22f | 2015-02-06 11:01:07 -0600 | [diff] [blame] | 430 | An X.509 name consists of a list of NameAttribute instances. |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 431 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 432 | .. attribute:: oid |
| 433 | |
| 434 | :type: :class:`ObjectIdentifier` |
| 435 | |
| 436 | The attribute OID. |
| 437 | |
| 438 | .. attribute:: value |
| 439 | |
Paul Kehrer | d5852cb | 2015-01-30 08:25:23 -0600 | [diff] [blame] | 440 | :type: :term:`text` |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 441 | |
| 442 | The value of the attribute. |
| 443 | |
| 444 | .. class:: ObjectIdentifier |
| 445 | |
| 446 | .. versionadded:: 0.8 |
| 447 | |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 448 | Object identifiers (frequently seen abbreviated as OID) identify the type |
Paul Kehrer | 806bfb2 | 2015-02-02 17:05:24 -0600 | [diff] [blame] | 449 | of a value (see: :class:`NameAttribute`). |
Paul Kehrer | 5b0a8d6 | 2015-01-30 20:05:55 -0600 | [diff] [blame] | 450 | |
Paul Kehrer | d44f9a6 | 2015-02-04 14:47:34 -0600 | [diff] [blame] | 451 | .. attribute:: dotted_string |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 452 | |
| 453 | :type: :class:`str` |
| 454 | |
Paul Kehrer | fedf4f4 | 2015-02-06 11:22:07 -0600 | [diff] [blame] | 455 | 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] | 456 | |
Paul Kehrer | 31bdf79 | 2015-03-25 14:11:00 -0500 | [diff] [blame] | 457 | .. _general_name_classes: |
| 458 | |
| 459 | General Name Classes |
| 460 | ~~~~~~~~~~~~~~~~~~~~ |
| 461 | |
| 462 | .. class:: GeneralName |
| 463 | |
| 464 | .. versionadded:: 0.9 |
| 465 | |
| 466 | This is the generic interface that all the following classes are registered |
| 467 | against. |
| 468 | |
| 469 | .. class:: RFC822Name |
| 470 | |
| 471 | .. versionadded:: 0.9 |
| 472 | |
| 473 | This corresponds to an email address. For example, ``user@example.com``. |
| 474 | |
| 475 | .. attribute:: value |
| 476 | |
| 477 | :type: :term:`text` |
| 478 | |
| 479 | .. class:: DNSName |
| 480 | |
| 481 | .. versionadded:: 0.9 |
| 482 | |
| 483 | This corresponds to a domain name. For example, ``cryptography.io``. |
| 484 | |
| 485 | .. attribute:: value |
| 486 | |
| 487 | :type: :term:`text` |
| 488 | |
| 489 | .. class:: DirectoryName |
| 490 | |
| 491 | .. versionadded:: 0.9 |
| 492 | |
| 493 | This corresponds to a directory name. |
| 494 | |
| 495 | .. attribute:: value |
| 496 | |
| 497 | :type: :class:`Name` |
| 498 | |
| 499 | .. class:: UniformResourceIdentifier |
| 500 | |
| 501 | .. versionadded:: 0.9 |
| 502 | |
| 503 | This corresponds to a uniform resource identifier. For example, |
Paul Kehrer | b8ef82e | 2015-04-22 16:04:24 -0500 | [diff] [blame] | 504 | ``https://cryptography.io``. The URI is parsed and IDNA decoded (see |
| 505 | :rfc:`5895`). |
| 506 | |
| 507 | .. note:: |
| 508 | |
| 509 | URIs that do not contain ``://`` in them will not be decoded. |
Paul Kehrer | 31bdf79 | 2015-03-25 14:11:00 -0500 | [diff] [blame] | 510 | |
| 511 | .. attribute:: value |
| 512 | |
| 513 | :type: :term:`text` |
| 514 | |
| 515 | .. class:: IPAddress |
| 516 | |
| 517 | .. versionadded:: 0.9 |
| 518 | |
| 519 | This corresponds to an IP address. |
| 520 | |
| 521 | .. attribute:: value |
| 522 | |
Paul Kehrer | eb17793 | 2015-05-17 18:33:33 -0700 | [diff] [blame] | 523 | :type: :class:`~ipaddress.IPv4Address`, |
| 524 | :class:`~ipaddress.IPv6Address`, :class:`~ipaddress.IPv4Network`, |
| 525 | or :class:`~ipaddress.IPv6Network`. |
Paul Kehrer | 31bdf79 | 2015-03-25 14:11:00 -0500 | [diff] [blame] | 526 | |
| 527 | .. class:: RegisteredID |
| 528 | |
| 529 | .. versionadded:: 0.9 |
| 530 | |
| 531 | This corresponds to a registered ID. |
| 532 | |
| 533 | .. attribute:: value |
| 534 | |
| 535 | :type: :class:`ObjectIdentifier` |
| 536 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 537 | X.509 Extensions |
| 538 | ~~~~~~~~~~~~~~~~ |
| 539 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 540 | .. class:: Extensions |
| 541 | |
| 542 | .. versionadded:: 0.9 |
| 543 | |
| 544 | An X.509 Extensions instance is an ordered list of extensions. The object |
| 545 | is iterable to get every extension. |
| 546 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 547 | .. method:: get_extension_for_oid(oid) |
| 548 | |
| 549 | :param oid: An :class:`ObjectIdentifier` instance. |
| 550 | |
| 551 | :returns: An instance of the extension class. |
| 552 | |
| 553 | :raises cryptography.x509.ExtensionNotFound: If the certificate does |
| 554 | not have the extension requested. |
| 555 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 556 | .. doctest:: |
| 557 | |
| 558 | >>> cert.extensions.get_extension_for_oid(x509.OID_BASIC_CONSTRAINTS) |
| 559 | <Extension(oid=<ObjectIdentifier(oid=2.5.29.19, name=basicConstraints)>, critical=True, value=<BasicConstraints(ca=True, path_length=None)>)> |
| 560 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 561 | .. class:: Extension |
| 562 | |
| 563 | .. versionadded:: 0.9 |
| 564 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 565 | .. attribute:: oid |
| 566 | |
| 567 | :type: :class:`ObjectIdentifier` |
| 568 | |
Paul Kehrer | 5553d57 | 2015-03-23 21:08:01 -0500 | [diff] [blame] | 569 | The :ref:`extension OID <extension_oids>`. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 570 | |
| 571 | .. attribute:: critical |
| 572 | |
| 573 | :type: bool |
| 574 | |
Paul Kehrer | 58b7569 | 2015-03-22 23:24:58 -0500 | [diff] [blame] | 575 | Determines whether a given extension is critical or not. :rfc:`5280` |
| 576 | requires that "A certificate-using system MUST reject the certificate |
| 577 | if it encounters a critical extension it does not recognize or a |
| 578 | critical extension that contains information that it cannot process". |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 579 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 580 | .. attribute:: value |
| 581 | |
| 582 | Returns an instance of the extension type corresponding to the OID. |
| 583 | |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 584 | .. class:: KeyUsage |
| 585 | |
| 586 | .. versionadded:: 0.9 |
| 587 | |
| 588 | The key usage extension defines the purpose of the key contained in the |
| 589 | certificate. The usage restriction might be employed when a key that could |
| 590 | be used for more than one operation is to be restricted. It corresponds to |
| 591 | :data:`OID_KEY_USAGE`. |
| 592 | |
| 593 | .. attribute:: digital_signature |
| 594 | |
| 595 | :type: bool |
| 596 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 597 | This purpose is set to true when the subject public key is used for verifying |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 598 | digital signatures, other than signatures on certificates |
| 599 | (``key_cert_sign``) and CRLs (``crl_sign``). |
| 600 | |
| 601 | .. attribute:: content_commitment |
| 602 | |
| 603 | :type: bool |
| 604 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 605 | This purpose is set to true when the subject public key is used for verifying |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 606 | digital signatures, other than signatures on certificates |
| 607 | (``key_cert_sign``) and CRLs (``crl_sign``). It is used to provide a |
| 608 | non-repudiation service that protects against the signing entity |
| 609 | falsely denying some action. In the case of later conflict, a |
| 610 | reliable third party may determine the authenticity of the signed |
| 611 | data. This was called ``non_repudiation`` in older revisions of the |
| 612 | X.509 specification. |
| 613 | |
| 614 | .. attribute:: key_encipherment |
| 615 | |
| 616 | :type: bool |
| 617 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 618 | This purpose is set to true when the subject public key is used for |
| 619 | enciphering private or secret keys. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 620 | |
| 621 | .. attribute:: data_encipherment |
| 622 | |
| 623 | :type: bool |
| 624 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 625 | This purpose is set to true when the subject public key is used for |
| 626 | directly enciphering raw user data without the use of an intermediate |
| 627 | symmetric cipher. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 628 | |
| 629 | .. attribute:: key_agreement |
| 630 | |
| 631 | :type: bool |
| 632 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 633 | This purpose is set to true when the subject public key is used for key |
| 634 | agreement. For example, when a Diffie-Hellman key is to be used for |
| 635 | key management, then this purpose is set to true. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 636 | |
| 637 | .. attribute:: key_cert_sign |
| 638 | |
| 639 | :type: bool |
| 640 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 641 | This purpose is set to true when the subject public key is used for |
| 642 | verifying signatures on public key certificates. If this purpose is set |
| 643 | to true then ``ca`` must be true in the :class:`BasicConstraints` |
| 644 | extension. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 645 | |
| 646 | .. attribute:: crl_sign |
| 647 | |
| 648 | :type: bool |
| 649 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 650 | This purpose is set to true when the subject public key is used for |
| 651 | verifying signatures on certificate revocation lists. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 652 | |
| 653 | .. attribute:: encipher_only |
| 654 | |
| 655 | :type: bool |
| 656 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 657 | When this purposes is set to true and the ``key_agreement`` purpose is |
| 658 | also set, the subject public key may be used only for enciphering data |
| 659 | while performing key agreement. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 660 | |
| 661 | :raises ValueError: This is raised if accessed when ``key_agreement`` |
| 662 | is false. |
| 663 | |
| 664 | .. attribute:: decipher_only |
| 665 | |
| 666 | :type: bool |
| 667 | |
Paul Kehrer | 738407b | 2015-04-01 22:39:02 -0500 | [diff] [blame] | 668 | When this purposes is set to true and the ``key_agreement`` purpose is |
| 669 | also set, the subject public key may be used only for deciphering data |
| 670 | while performing key agreement. |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 671 | |
| 672 | :raises ValueError: This is raised if accessed when ``key_agreement`` |
| 673 | is false. |
| 674 | |
| 675 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 676 | .. class:: BasicConstraints |
| 677 | |
| 678 | .. versionadded:: 0.9 |
| 679 | |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 680 | 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] | 681 | certificate is allowed to sign additional certificates and what path |
Paul Kehrer | 8589466 | 2015-03-22 13:19:31 -0500 | [diff] [blame] | 682 | length restrictions may exist. It corresponds to |
| 683 | :data:`OID_BASIC_CONSTRAINTS`. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 684 | |
| 685 | .. attribute:: ca |
| 686 | |
| 687 | :type: bool |
| 688 | |
| 689 | Whether the certificate can sign certificates. |
| 690 | |
| 691 | .. attribute:: path_length |
| 692 | |
Paul Kehrer | fd1444c | 2015-03-21 19:47:05 -0500 | [diff] [blame] | 693 | :type: int or None |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 694 | |
| 695 | The maximum path length for certificates subordinate to this |
| 696 | certificate. This attribute only has meaning if ``ca`` is true. |
| 697 | If ``ca`` is true then a path length of None means there's no |
| 698 | restriction on the number of subordinate CAs in the certificate chain. |
Alex Gaynor | 99c5f15 | 2015-05-03 10:01:04 -0400 | [diff] [blame] | 699 | If it is zero or greater then it defines the maximum length for a |
| 700 | subordinate CA's certificate chain. For example, a ``path_length`` of 1 |
| 701 | means the certificate can sign a subordinate CA, but the subordinate CA |
| 702 | is not allowed to create subordinates with ``ca`` set to true. |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 703 | |
Paul Kehrer | ffa2a15 | 2015-03-31 08:18:25 -0500 | [diff] [blame] | 704 | .. class:: ExtendedKeyUsage |
| 705 | |
| 706 | .. versionadded:: 0.9 |
| 707 | |
| 708 | This extension indicates one or more purposes for which the certified |
| 709 | public key may be used, in addition to or in place of the basic |
| 710 | purposes indicated in the key usage extension. The object is |
| 711 | iterable to obtain the list of :ref:`extended key usage OIDs <eku_oids>`. |
| 712 | |
Paul Kehrer | 4a1038e | 2015-05-18 10:28:31 -0700 | [diff] [blame] | 713 | .. class:: OCSPNoCheck |
| 714 | |
| 715 | .. versionadded:: 0.10 |
| 716 | |
| 717 | This presence of this extension indicates that an OCSP client can trust a |
| 718 | responder for the lifetime of the responder's certificate. CAs issuing |
| 719 | such a certificate should realize that a compromise of the responder's key |
| 720 | is as serious as the compromise of a CA key used to sign CRLs, at least for |
| 721 | the validity period of this certificate. CA's may choose to issue this type |
| 722 | of certificate with a very short lifetime and renew it frequently. This |
| 723 | extension is only relevant when the certificate is an authorized OCSP |
| 724 | responder. |
| 725 | |
Paul Kehrer | 2eb4ed9 | 2015-04-11 15:33:45 -0400 | [diff] [blame] | 726 | .. class:: AuthorityKeyIdentifier |
| 727 | |
| 728 | .. versionadded:: 0.9 |
| 729 | |
| 730 | The authority key identifier extension provides a means of identifying the |
| 731 | public key corresponding to the private key used to sign a certificate. |
Paul Kehrer | 8c8cd72 | 2015-04-19 09:15:04 -0500 | [diff] [blame] | 732 | This extension is typically used to assist in determining the appropriate |
| 733 | certificate chain. For more information about generation and use of this |
| 734 | extension see `RFC 5280 section 4.2.1.1`_. |
Paul Kehrer | 2eb4ed9 | 2015-04-11 15:33:45 -0400 | [diff] [blame] | 735 | |
| 736 | .. attribute:: key_identifier |
| 737 | |
| 738 | :type: bytes |
| 739 | |
Paul Kehrer | 9104b1d | 2015-04-18 09:23:44 -0500 | [diff] [blame] | 740 | A value derived from the public key used to verify the certificate's |
Paul Kehrer | 8c8cd72 | 2015-04-19 09:15:04 -0500 | [diff] [blame] | 741 | signature. |
Paul Kehrer | 9104b1d | 2015-04-18 09:23:44 -0500 | [diff] [blame] | 742 | |
Paul Kehrer | 2eb4ed9 | 2015-04-11 15:33:45 -0400 | [diff] [blame] | 743 | .. attribute:: authority_cert_issuer |
| 744 | |
| 745 | :type: :class:`Name` or None |
| 746 | |
Paul Kehrer | 9104b1d | 2015-04-18 09:23:44 -0500 | [diff] [blame] | 747 | The :class:`Name` of the issuer's issuer. |
| 748 | |
Paul Kehrer | 2eb4ed9 | 2015-04-11 15:33:45 -0400 | [diff] [blame] | 749 | .. attribute:: authority_cert_serial_number |
| 750 | |
| 751 | :type: int or None |
| 752 | |
Paul Kehrer | 9104b1d | 2015-04-18 09:23:44 -0500 | [diff] [blame] | 753 | The serial number of the issuer's issuer. |
| 754 | |
Paul Kehrer | 1eb82a6 | 2015-03-31 20:00:33 -0500 | [diff] [blame] | 755 | .. class:: SubjectKeyIdentifier |
| 756 | |
| 757 | .. versionadded:: 0.9 |
| 758 | |
| 759 | The subject key identifier extension provides a means of identifying |
| 760 | certificates that contain a particular public key. |
| 761 | |
| 762 | .. attribute:: digest |
| 763 | |
| 764 | :type: bytes |
| 765 | |
| 766 | The binary value of the identifier. |
| 767 | |
Paul Kehrer | 31bdf79 | 2015-03-25 14:11:00 -0500 | [diff] [blame] | 768 | .. class:: SubjectAlternativeName |
| 769 | |
| 770 | .. versionadded:: 0.9 |
| 771 | |
| 772 | Subject alternative name is an X.509 extension that provides a list of |
| 773 | :ref:`general name <general_name_classes>` instances that provide a set |
| 774 | of identities for which the certificate is valid. The object is iterable to |
| 775 | get every element. |
| 776 | |
| 777 | .. method:: get_values_for_type(type) |
| 778 | |
| 779 | :param type: A :class:`GeneralName` provider. This is one of the |
| 780 | :ref:`general name classes <general_name_classes>`. |
| 781 | |
| 782 | :returns: A list of values extracted from the matched general names. |
| 783 | |
Paul Kehrer | 93ae805 | 2015-05-02 23:18:09 -0500 | [diff] [blame] | 784 | .. doctest:: |
| 785 | |
| 786 | >>> from cryptography import x509 |
| 787 | >>> from cryptography.hazmat.backends import default_backend |
| 788 | >>> from cryptography.hazmat.primitives import hashes |
| 789 | >>> cert = x509.load_pem_x509_certificate(cryptography_cert_pem, default_backend()) |
Paul Kehrer | d0cd507 | 2015-05-02 23:27:00 -0500 | [diff] [blame] | 790 | >>> # Get the subjectAltName extension from the certificate |
Paul Kehrer | 93ae805 | 2015-05-02 23:18:09 -0500 | [diff] [blame] | 791 | >>> ext = cert.extensions.get_extension_for_oid(x509.OID_SUBJECT_ALTERNATIVE_NAME) |
Paul Kehrer | d0cd507 | 2015-05-02 23:27:00 -0500 | [diff] [blame] | 792 | >>> # Get the dNSName entries from the SAN extension |
| 793 | >>> ext.value.get_values_for_type(x509.DNSName) |
Paul Kehrer | 93ae805 | 2015-05-02 23:18:09 -0500 | [diff] [blame] | 794 | [u'www.cryptography.io', u'cryptography.io'] |
| 795 | |
Paul Kehrer | 8cf2642 | 2015-03-21 09:50:24 -0500 | [diff] [blame] | 796 | |
Paul Kehrer | 3e6d558 | 2015-05-02 21:57:56 -0500 | [diff] [blame] | 797 | .. class:: AuthorityInformationAccess |
| 798 | |
| 799 | .. versionadded:: 0.9 |
| 800 | |
| 801 | The authority information access extension indicates how to access |
| 802 | information and services for the issuer of the certificate in which |
| 803 | the extension appears. Information and services may include online |
| 804 | validation services (such as OCSP) and issuer data. It is an iterable, |
| 805 | containing one or more :class:`AccessDescription` instances. |
| 806 | |
| 807 | |
| 808 | .. class:: AccessDescription |
| 809 | |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 810 | .. versionadded:: 0.9 |
| 811 | |
Paul Kehrer | 3e6d558 | 2015-05-02 21:57:56 -0500 | [diff] [blame] | 812 | .. attribute:: access_method |
| 813 | |
| 814 | :type: :class:`ObjectIdentifier` |
| 815 | |
Paul Kehrer | f506bca | 2015-05-02 22:31:47 -0500 | [diff] [blame] | 816 | The access method defines what the ``access_location`` means. It must |
| 817 | be either :data:`OID_OCSP` or :data:`OID_CA_ISSUERS`. If it is |
| 818 | :data:`OID_OCSP` the access location will be where to obtain OCSP |
| 819 | information for the certificate. If it is :data:`OID_CA_ISSUERS` the |
| 820 | access location will provide additional information about the issuing |
| 821 | certificate. |
Paul Kehrer | 3e6d558 | 2015-05-02 21:57:56 -0500 | [diff] [blame] | 822 | |
| 823 | .. attribute:: access_location |
| 824 | |
| 825 | :type: :class:`GeneralName` |
| 826 | |
Paul Kehrer | f506bca | 2015-05-02 22:31:47 -0500 | [diff] [blame] | 827 | Where to access the information defined by the access method. |
| 828 | |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 829 | .. class:: CRLDistributionPoints |
| 830 | |
| 831 | .. versionadded:: 0.9 |
| 832 | |
| 833 | The CRL distribution points extension identifies how CRL information is |
| 834 | obtained. It is an iterable, containing one or more |
| 835 | :class:`DistributionPoint` instances. |
| 836 | |
| 837 | .. class:: DistributionPoint |
| 838 | |
| 839 | .. versionadded:: 0.9 |
| 840 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 841 | .. attribute:: full_name |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 842 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 843 | :type: list of :class:`GeneralName` instances or None |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 844 | |
Paul Kehrer | f2c072b | 2015-05-09 17:04:28 -0500 | [diff] [blame] | 845 | This field describes methods to retrieve the CRL. At most one of |
| 846 | ``full_name`` or ``relative_name`` will be non-None. |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 847 | |
| 848 | .. attribute:: relative_name |
| 849 | |
| 850 | :type: :class:`Name` or None |
| 851 | |
| 852 | This field describes methods to retrieve the CRL relative to the CRL |
Paul Kehrer | f2c072b | 2015-05-09 17:04:28 -0500 | [diff] [blame] | 853 | issuer. At most one of ``full_name`` or ``relative_name`` will be |
| 854 | non-None. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 855 | |
| 856 | .. attribute:: crl_issuer |
| 857 | |
| 858 | :type: list of :class:`GeneralName` instances or None |
| 859 | |
| 860 | Information about the issuer of the CRL. |
| 861 | |
| 862 | .. attribute:: reasons |
| 863 | |
Paul Kehrer | 3fd0260 | 2015-05-09 19:46:13 -0500 | [diff] [blame] | 864 | :type: frozenset of :class:`ReasonFlags` or None |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 865 | |
| 866 | The reasons a given distribution point may be used for when performing |
| 867 | revocation checks. |
| 868 | |
| 869 | .. class:: ReasonFlags |
| 870 | |
| 871 | .. versionadded:: 0.9 |
| 872 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 873 | An enumeration for CRL reasons. |
| 874 | |
| 875 | .. attribute:: unspecified |
| 876 | |
| 877 | It is unspecified why the certificate was revoked. This reason cannot |
| 878 | be used as a reason flag in a :class:`DistributionPoint`. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 879 | |
| 880 | .. attribute:: key_compromise |
| 881 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 882 | This reason indicates that the private key was compromised. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 883 | |
| 884 | .. attribute:: ca_compromise |
| 885 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 886 | This reason indicates that the CA issuing the certificate was |
| 887 | compromised. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 888 | |
| 889 | .. attribute:: affiliation_changed |
| 890 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 891 | This reason indicates that the subject's name or other information has |
| 892 | changed. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 893 | |
| 894 | .. attribute:: superseded |
| 895 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 896 | This reason indicates that a certificate has been superseded. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 897 | |
| 898 | .. attribute:: cessation_of_operation |
| 899 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 900 | This reason indicates that the certificate is no longer required. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 901 | |
| 902 | .. attribute:: certificate_hold |
| 903 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 904 | This reason indicates that the certificate is on hold. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 905 | |
| 906 | .. attribute:: privilege_withdrawn |
| 907 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 908 | This reason indicates that the privilege granted by this certificate |
| 909 | have been withdrawn. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 910 | |
| 911 | .. attribute:: aa_compromise |
| 912 | |
Paul Kehrer | 4e8dacd | 2015-05-09 10:38:23 -0500 | [diff] [blame] | 913 | When an attribute authority has been compromised. |
| 914 | |
| 915 | .. attribute:: remove_from_crl |
| 916 | |
| 917 | This reason indicates that the certificate was on hold and should be |
| 918 | removed from the CRL. This reason cannot be used as a reason flag |
| 919 | in a :class:`DistributionPoint`. |
Paul Kehrer | 5a48552 | 2015-05-06 00:29:12 -0500 | [diff] [blame] | 920 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 921 | .. class:: CertificatePolicies |
| 922 | |
| 923 | .. versionadded:: 0.9 |
| 924 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 925 | The certificate policies extension is an iterable, containing one or more |
| 926 | :class:`PolicyInformation` instances. |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 927 | |
| 928 | Certificate Policies Classes |
| 929 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 930 | |
| 931 | These classes may be present within a :class:`CertificatePolicies` instance. |
| 932 | |
| 933 | .. class:: PolicyInformation |
| 934 | |
| 935 | .. versionadded:: 0.9 |
| 936 | |
| 937 | Contains a policy identifier and an optional list of qualifiers. |
| 938 | |
| 939 | .. attribute:: policy_identifier |
| 940 | |
| 941 | :type: :class:`ObjectIdentifier` |
| 942 | |
| 943 | .. attribute:: policy_qualifiers |
| 944 | |
| 945 | :type: list |
| 946 | |
Paul Kehrer | ba35b3b | 2015-05-10 13:07:59 -0500 | [diff] [blame] | 947 | A list consisting of :term:`text` and/or :class:`UserNotice` objects. |
Paul Kehrer | 3f8ddeb | 2015-05-11 00:25:36 -0500 | [diff] [blame] | 948 | If the value is text it is a pointer to the practice statement |
| 949 | published by the certificate authority. If it is a user notice it is |
| 950 | meant for display to the relying party when the certificate is |
| 951 | used. |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 952 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 953 | .. class:: UserNotice |
| 954 | |
| 955 | .. versionadded:: 0.9 |
| 956 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 957 | User notices are intended for display to a relying party when a certificate |
| 958 | is used. In practice, few if any UIs expose this data and it is a rarely |
| 959 | encoded component. |
| 960 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 961 | .. attribute:: notice_reference |
| 962 | |
| 963 | :type: :class:`NoticeReference` or None |
| 964 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 965 | The notice reference field names an organization and identifies, |
| 966 | by number, a particular statement prepared by that organization. |
| 967 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 968 | .. attribute:: explicit_text |
| 969 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 970 | This field includes an arbitrary textual statement directly in the |
| 971 | certificate. |
| 972 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 973 | :type: :term:`text` |
| 974 | |
| 975 | .. class:: NoticeReference |
| 976 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 977 | Notice reference can name an organization and provide information about |
| 978 | notices related to the certificate. For example, it might identify the |
| 979 | organization name and notice number 1. Application software could |
| 980 | have a notice file containing the current set of notices for the named |
| 981 | organization; the application would then extract the notice text from the |
| 982 | file and display it. In practice this is rarely seen. |
| 983 | |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 984 | .. versionadded:: 0.9 |
| 985 | |
| 986 | .. attribute:: organization |
| 987 | |
Paul Kehrer | 66c6170 | 2015-05-12 16:39:18 -0500 | [diff] [blame] | 988 | :type: :term:`text` |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 989 | |
Paul Kehrer | 3f8ddeb | 2015-05-11 00:25:36 -0500 | [diff] [blame] | 990 | .. attribute:: notice_numbers |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 991 | |
Paul Kehrer | 66c6170 | 2015-05-12 16:39:18 -0500 | [diff] [blame] | 992 | :type: list |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 993 | |
Paul Kehrer | 66c6170 | 2015-05-12 16:39:18 -0500 | [diff] [blame] | 994 | A list of integers. |
Paul Kehrer | 0d21092 | 2015-04-28 17:31:07 -0500 | [diff] [blame] | 995 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 996 | Object Identifiers |
| 997 | ~~~~~~~~~~~~~~~~~~ |
| 998 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 999 | X.509 elements are frequently identified by :class:`ObjectIdentifier` |
| 1000 | instances. The following common OIDs are available as constants. |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1001 | |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1002 | Name OIDs |
| 1003 | ~~~~~~~~~ |
| 1004 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1005 | .. data:: OID_COMMON_NAME |
| 1006 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 1007 | Corresponds to the dotted string ``"2.5.4.3"``. Historically the domain |
| 1008 | name would be encoded here for server certificates. :rfc:`2818` deprecates |
| 1009 | 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] | 1010 | SubjectAlternativeName extension. This OID is typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1011 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1012 | .. data:: OID_COUNTRY_NAME |
| 1013 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1014 | Corresponds to the dotted string ``"2.5.4.6"``. This OID is typically seen |
| 1015 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1016 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1017 | .. data:: OID_LOCALITY_NAME |
| 1018 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1019 | Corresponds to the dotted string ``"2.5.4.7"``. This OID is typically seen |
| 1020 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1021 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1022 | .. data:: OID_STATE_OR_PROVINCE_NAME |
| 1023 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1024 | Corresponds to the dotted string ``"2.5.4.8"``. This OID is typically seen |
| 1025 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1026 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1027 | .. data:: OID_ORGANIZATION_NAME |
| 1028 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1029 | Corresponds to the dotted string ``"2.5.4.10"``. This OID is typically seen |
| 1030 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1031 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1032 | .. data:: OID_ORGANIZATIONAL_UNIT_NAME |
| 1033 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1034 | Corresponds to the dotted string ``"2.5.4.11"``. This OID is typically seen |
| 1035 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1036 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1037 | .. data:: OID_SERIAL_NUMBER |
| 1038 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 1039 | Corresponds to the dotted string ``"2.5.4.5"``. This is distinct from the |
| 1040 | serial number of the certificate itself (which can be obtained with |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1041 | :func:`Certificate.serial`). This OID is typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1042 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1043 | .. data:: OID_SURNAME |
| 1044 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1045 | Corresponds to the dotted string ``"2.5.4.4"``. This OID is typically seen |
| 1046 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1047 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1048 | .. data:: OID_GIVEN_NAME |
| 1049 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1050 | Corresponds to the dotted string ``"2.5.4.42"``. This OID is typically seen |
| 1051 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1052 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1053 | .. data:: OID_TITLE |
| 1054 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1055 | Corresponds to the dotted string ``"2.5.4.12"``. This OID is typically seen |
| 1056 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1057 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1058 | .. data:: OID_GENERATION_QUALIFIER |
| 1059 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1060 | Corresponds to the dotted string ``"2.5.4.44"``. This OID is typically seen |
| 1061 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1062 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1063 | .. data:: OID_DN_QUALIFIER |
| 1064 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 1065 | Corresponds to the dotted string ``"2.5.4.46"``. This specifies |
| 1066 | disambiguating information to add to the relative distinguished name of an |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1067 | 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] | 1068 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1069 | .. data:: OID_PSEUDONYM |
| 1070 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1071 | Corresponds to the dotted string ``"2.5.4.65"``. This OID is typically seen |
| 1072 | in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1073 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1074 | .. data:: OID_DOMAIN_COMPONENT |
| 1075 | |
Paul Kehrer | fb5ac9e | 2015-02-07 16:29:37 -0600 | [diff] [blame] | 1076 | 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] | 1077 | holding one component of a domain name. See :rfc:`4519`. This OID is |
| 1078 | typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1079 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1080 | .. data:: OID_EMAIL_ADDRESS |
| 1081 | |
Paul Kehrer | 4bb4649 | 2015-02-07 16:59:14 -0600 | [diff] [blame] | 1082 | Corresponds to the dotted string ``"1.2.840.113549.1.9.1"``. This OID is |
| 1083 | typically seen in X.509 names. |
Paul Kehrer | 858b9b7 | 2015-02-05 09:50:31 -0600 | [diff] [blame] | 1084 | |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1085 | Signature Algorithm OIDs |
| 1086 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1087 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1088 | .. data:: OID_RSA_WITH_MD5 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1089 | |
| 1090 | Corresponds to the dotted string ``"1.2.840.113549.1.1.4"``. This is |
| 1091 | an MD5 digest signed by an RSA key. |
| 1092 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1093 | .. data:: OID_RSA_WITH_SHA1 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1094 | |
| 1095 | Corresponds to the dotted string ``"1.2.840.113549.1.1.5"``. This is |
| 1096 | a SHA1 digest signed by an RSA key. |
| 1097 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1098 | .. data:: OID_RSA_WITH_SHA224 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1099 | |
| 1100 | Corresponds to the dotted string ``"1.2.840.113549.1.1.14"``. This is |
| 1101 | a SHA224 digest signed by an RSA key. |
| 1102 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1103 | .. data:: OID_RSA_WITH_SHA256 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1104 | |
| 1105 | Corresponds to the dotted string ``"1.2.840.113549.1.1.11"``. This is |
| 1106 | a SHA256 digest signed by an RSA key. |
| 1107 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1108 | .. data:: OID_RSA_WITH_SHA384 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1109 | |
| 1110 | Corresponds to the dotted string ``"1.2.840.113549.1.1.12"``. This is |
| 1111 | a SHA384 digest signed by an RSA key. |
| 1112 | |
Paul Kehrer | 1a7ba87 | 2015-02-19 18:09:05 -0600 | [diff] [blame] | 1113 | .. data:: OID_RSA_WITH_SHA512 |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1114 | |
| 1115 | Corresponds to the dotted string ``"1.2.840.113549.1.1.13"``. This is |
| 1116 | a SHA512 digest signed by an RSA key. |
| 1117 | |
| 1118 | .. data:: OID_ECDSA_WITH_SHA224 |
| 1119 | |
| 1120 | Corresponds to the dotted string ``"1.2.840.10045.4.3.1"``. This is |
| 1121 | a SHA224 digest signed by an ECDSA key. |
| 1122 | |
| 1123 | .. data:: OID_ECDSA_WITH_SHA256 |
| 1124 | |
| 1125 | Corresponds to the dotted string ``"1.2.840.10045.4.3.2"``. This is |
| 1126 | a SHA256 digest signed by an ECDSA key. |
| 1127 | |
| 1128 | .. data:: OID_ECDSA_WITH_SHA384 |
| 1129 | |
| 1130 | Corresponds to the dotted string ``"1.2.840.10045.4.3.3"``. This is |
| 1131 | a SHA384 digest signed by an ECDSA key. |
| 1132 | |
| 1133 | .. data:: OID_ECDSA_WITH_SHA512 |
| 1134 | |
| 1135 | Corresponds to the dotted string ``"1.2.840.10045.4.3.4"``. This is |
| 1136 | a SHA512 digest signed by an ECDSA key. |
| 1137 | |
| 1138 | .. data:: OID_DSA_WITH_SHA1 |
| 1139 | |
| 1140 | Corresponds to the dotted string ``"1.2.840.10040.4.3"``. This is |
| 1141 | a SHA1 digest signed by a DSA key. |
| 1142 | |
| 1143 | .. data:: OID_DSA_WITH_SHA224 |
| 1144 | |
| 1145 | Corresponds to the dotted string ``"2.16.840.1.101.3.4.3.1"``. This is |
| 1146 | a SHA224 digest signed by a DSA key. |
| 1147 | |
| 1148 | .. data:: OID_DSA_WITH_SHA256 |
| 1149 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 1150 | 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] | 1151 | a SHA256 digest signed by a DSA key. |
| 1152 | |
Paul Kehrer | ffa2a15 | 2015-03-31 08:18:25 -0500 | [diff] [blame] | 1153 | .. _eku_oids: |
| 1154 | |
Paul Kehrer | e1513fa | 2015-03-30 23:08:17 -0500 | [diff] [blame] | 1155 | Extended Key Usage OIDs |
| 1156 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 1157 | |
| 1158 | .. data:: OID_SERVER_AUTH |
| 1159 | |
| 1160 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.1"``. This is used to |
| 1161 | denote that a certificate may be used for TLS web server authentication. |
| 1162 | |
| 1163 | .. data:: OID_CLIENT_AUTH |
| 1164 | |
| 1165 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.2"``. This is used to |
| 1166 | denote that a certificate may be used for TLS web client authentication. |
| 1167 | |
| 1168 | .. data:: OID_CODE_SIGNING |
| 1169 | |
| 1170 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.3"``. This is used to |
| 1171 | denote that a certificate may be used for code signing. |
| 1172 | |
| 1173 | .. data:: OID_EMAIL_PROTECTION |
| 1174 | |
| 1175 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.4"``. This is used to |
| 1176 | denote that a certificate may be used for email protection. |
| 1177 | |
| 1178 | .. data:: OID_TIME_STAMPING |
| 1179 | |
| 1180 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.8"``. This is used to |
| 1181 | denote that a certificate may be used for time stamping. |
| 1182 | |
| 1183 | .. data:: OID_OCSP_SIGNING |
| 1184 | |
| 1185 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.3.9"``. This is used to |
| 1186 | denote that a certificate may be used for signing OCSP responses. |
| 1187 | |
Paul Kehrer | 3e6d558 | 2015-05-02 21:57:56 -0500 | [diff] [blame] | 1188 | Authority Information Access OIDs |
| 1189 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1190 | |
| 1191 | .. data:: OID_OCSP |
| 1192 | |
| 1193 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.48.1"``. Used as the |
| 1194 | identifier for OCSP data in :class:`AccessDescription` objects. |
| 1195 | |
| 1196 | .. data:: OID_CA_ISSUERS |
| 1197 | |
| 1198 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.48.2"``. Used as the |
| 1199 | identifier for CA issuer data in :class:`AccessDescription` objects. |
| 1200 | |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 1201 | Policy Qualifier OIDs |
| 1202 | ~~~~~~~~~~~~~~~~~~~~~ |
| 1203 | |
| 1204 | .. data:: OID_CPS_QUALIFIER |
| 1205 | |
Paul Kehrer | ba35b3b | 2015-05-10 13:07:59 -0500 | [diff] [blame] | 1206 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.2.1"``. |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 1207 | |
| 1208 | .. data:: OID_CPS_USER_NOTICE |
| 1209 | |
Paul Kehrer | ba35b3b | 2015-05-10 13:07:59 -0500 | [diff] [blame] | 1210 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.2.2"``. |
Paul Kehrer | 2e87974 | 2015-05-02 23:09:56 -0500 | [diff] [blame] | 1211 | |
Paul Kehrer | 5553d57 | 2015-03-23 21:08:01 -0500 | [diff] [blame] | 1212 | .. _extension_oids: |
| 1213 | |
Paul Kehrer | 2bb9464 | 2015-03-21 09:54:17 -0500 | [diff] [blame] | 1214 | Extension OIDs |
| 1215 | ~~~~~~~~~~~~~~ |
| 1216 | |
| 1217 | .. data:: OID_BASIC_CONSTRAINTS |
| 1218 | |
| 1219 | 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] | 1220 | :class:`BasicConstraints` extension type. |
Paul Kehrer | 2bb9464 | 2015-03-21 09:54:17 -0500 | [diff] [blame] | 1221 | |
Paul Kehrer | cecbbba | 2015-03-30 14:58:38 -0500 | [diff] [blame] | 1222 | .. data:: OID_KEY_USAGE |
| 1223 | |
| 1224 | Corresponds to the dotted string ``"2.5.29.15"``. The identifier for the |
| 1225 | :class:`KeyUsage` extension type. |
| 1226 | |
Paul Kehrer | d4f632e | 2015-05-12 08:25:42 -0500 | [diff] [blame] | 1227 | .. data:: OID_SUBJECT_ALTERNATIVE_NAME |
| 1228 | |
| 1229 | Corresponds to the dotted string ``"2.5.29.17"``. The identifier for the |
| 1230 | :class:`SubjectAlternativeName` extension type. |
| 1231 | |
| 1232 | .. data:: OID_SUBJECT_KEY_IDENTIFIER |
| 1233 | |
| 1234 | Corresponds to the dotted string ``"2.5.29.14"``. The identifier for the |
| 1235 | :class:`SubjectKeyIdentifier` extension type. |
| 1236 | |
| 1237 | .. data:: OID_CRL_DISTRIBUTION_POINTS |
| 1238 | |
| 1239 | Corresponds to the dotted string ``"2.5.29.31"``. The identifier for the |
| 1240 | :class:`CRLDistributionPoints` extension type. |
| 1241 | |
| 1242 | .. data:: OID_CERTIFICATE_POLICIES |
| 1243 | |
| 1244 | Corresponds to the dotted string ``"2.5.29.32"``. The identifier for the |
| 1245 | :class:`CertificatePolicies` extension type. |
| 1246 | |
| 1247 | .. data:: OID_AUTHORITY_KEY_IDENTIFIER |
| 1248 | |
| 1249 | Corresponds to the dotted string ``"2.5.29.35"``. The identifier for the |
| 1250 | :class:`AuthorityKeyIdentifier` extension type. |
| 1251 | |
| 1252 | .. data:: OID_EXTENDED_KEY_USAGE |
| 1253 | |
| 1254 | Corresponds to the dotted string ``"2.5.29.37"``. The identifier for the |
| 1255 | :class:`ExtendedKeyUsage` extension type. |
| 1256 | |
| 1257 | .. data:: OID_AUTHORITY_INFORMATION_ACCESS |
| 1258 | |
| 1259 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.1.1"``. The identifier |
| 1260 | for the :class:`AuthorityInformationAccess` extension type. |
Paul Kehrer | 56da2a5 | 2015-02-11 23:35:07 -0600 | [diff] [blame] | 1261 | |
Paul Kehrer | 4a1038e | 2015-05-18 10:28:31 -0700 | [diff] [blame] | 1262 | .. data:: OID_OCSP_NO_CHECK |
| 1263 | |
| 1264 | Corresponds to the dotted string ``"1.3.6.1.5.5.7.48.1.5"``. The identifier |
| 1265 | for the :class:`OCSPNoCheck` extension type. |
| 1266 | |
Paul Kehrer | 912d3fb | 2015-01-29 11:19:22 -0600 | [diff] [blame] | 1267 | Exceptions |
| 1268 | ~~~~~~~~~~ |
| 1269 | |
Paul Kehrer | e76cd27 | 2014-12-14 19:00:51 -0600 | [diff] [blame] | 1270 | .. class:: InvalidVersion |
Paul Kehrer | a68fd33 | 2014-11-27 07:08:40 -1000 | [diff] [blame] | 1271 | |
| 1272 | 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] | 1273 | |
Paul Kehrer | d5cccf7 | 2014-12-15 17:20:33 -0600 | [diff] [blame] | 1274 | .. attribute:: parsed_version |
| 1275 | |
Paul Kehrer | bbffc40 | 2014-12-17 13:33:55 -0600 | [diff] [blame] | 1276 | :type: int |
| 1277 | |
| 1278 | Returns the raw version that was parsed from the certificate. |
Paul Kehrer | d5cccf7 | 2014-12-15 17:20:33 -0600 | [diff] [blame] | 1279 | |
Paul Kehrer | fbb7ac8 | 2015-03-16 19:26:29 -0500 | [diff] [blame] | 1280 | .. class:: DuplicateExtension |
| 1281 | |
| 1282 | This is raised when more than one X.509 extension of the same type is |
| 1283 | found within a certificate. |
| 1284 | |
| 1285 | .. attribute:: oid |
| 1286 | |
| 1287 | :type: :class:`ObjectIdentifier` |
| 1288 | |
| 1289 | Returns the OID. |
| 1290 | |
| 1291 | .. class:: UnsupportedExtension |
| 1292 | |
| 1293 | This is raised when a certificate contains an unsupported extension type. |
| 1294 | |
| 1295 | .. attribute:: oid |
| 1296 | |
| 1297 | :type: :class:`ObjectIdentifier` |
| 1298 | |
| 1299 | Returns the OID. |
| 1300 | |
Paul Kehrer | fa56a23 | 2015-03-17 13:14:03 -0500 | [diff] [blame] | 1301 | .. class:: ExtensionNotFound |
| 1302 | |
| 1303 | This is raised when calling :meth:`Extensions.get_extension_for_oid` with |
| 1304 | an extension OID that is not present in the certificate. |
| 1305 | |
| 1306 | .. attribute:: oid |
| 1307 | |
| 1308 | :type: :class:`ObjectIdentifier` |
| 1309 | |
| 1310 | Returns the OID. |
| 1311 | |
Paul Kehrer | 9089c91 | 2015-04-20 22:15:20 -0500 | [diff] [blame] | 1312 | .. class:: UnsupportedGeneralNameType |
| 1313 | |
| 1314 | This is raised when a certificate contains an unsupported general name |
| 1315 | type in an extension. |
| 1316 | |
Paul Kehrer | bed0735 | 2015-04-21 08:31:10 -0500 | [diff] [blame] | 1317 | .. attribute:: type |
| 1318 | |
Paul Kehrer | 0a621bf | 2015-04-22 09:22:56 -0500 | [diff] [blame] | 1319 | :type: int |
| 1320 | |
| 1321 | The integer value of the unsupported type. The complete list of |
| 1322 | types can be found in `RFC 5280 section 4.2.1.6`_. |
Paul Kehrer | bed0735 | 2015-04-21 08:31:10 -0500 | [diff] [blame] | 1323 | |
Paul Kehrer | 016e08a | 2014-11-26 09:41:18 -1000 | [diff] [blame] | 1324 | |
| 1325 | .. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure |
Paul Kehrer | a68fd33 | 2014-11-27 07:08:40 -1000 | [diff] [blame] | 1326 | .. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security |
Paul Kehrer | c7c9a43 | 2015-04-19 09:20:13 -0500 | [diff] [blame] | 1327 | .. _`RFC 5280 section 4.2.1.1`: https://tools.ietf.org/html/rfc5280#section-4.2.1.1 |
Paul Kehrer | 0a621bf | 2015-04-22 09:22:56 -0500 | [diff] [blame] | 1328 | .. _`RFC 5280 section 4.2.1.6`: https://tools.ietf.org/html/rfc5280#section-4.2.1.6 |