return only an int for unsupported general name type, update docs
diff --git a/docs/x509.rst b/docs/x509.rst
index 2e4a0ef..035fa87 100644
--- a/docs/x509.rst
+++ b/docs/x509.rst
@@ -974,9 +974,13 @@
.. attribute:: type
- :type: :term:`text` or int
+ :type: int
+
+ The integer value of the unsupported type. The complete list of
+ types can be found in `RFC 5280 section 4.2.1.6`_.
.. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure
.. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security
.. _`RFC 5280 section 4.2.1.1`: https://tools.ietf.org/html/rfc5280#section-4.2.1.1
+.. _`RFC 5280 section 4.2.1.6`: https://tools.ietf.org/html/rfc5280#section-4.2.1.6
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 07e79fe..cc4a92a 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -69,7 +69,7 @@
"{0} is not a supported type".format(
x509._GENERAL_NAMES.get(gn.type, gn.type)
),
- x509._GENERAL_NAMES.get(gn.type, gn.type)
+ gn.type
)
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index c17beba..1283fca 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -769,4 +769,4 @@
with pytest.raises(x509.UnsupportedGeneralNameType) as exc:
cert.extensions
- assert exc.value.type == "otherName"
+ assert exc.value.type == 0