add parsed_version attribute to InvalidVersion
diff --git a/docs/x509.rst b/docs/x509.rst
index 5278d07..e44f16c 100644
--- a/docs/x509.rst
+++ b/docs/x509.rst
@@ -153,6 +153,10 @@
 
     This is raised when an X.509 certificate has an invalid version number.
 
+    .. attribute:: parsed_version
+
+        Returns the version that was parsed from the certificate.
+
 
 .. _`public key infrastructure`: https://en.wikipedia.org/wiki/Public_key_infrastructure
 .. _`TLS`: https://en.wikipedia.org/wiki/Transport_Layer_Security
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 9a1fcc8..0828f3c 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -45,7 +45,7 @@
             return x509.Version.v3
         else:
             raise x509.InvalidVersion(
-                "{0} is not a valid X509 version".format(version)
+                "{0} is not a valid X509 version".format(version), version
             )
 
     @property
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index c79d117..be1298b 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -24,7 +24,9 @@
 
 
 class InvalidVersion(Exception):
-    pass
+    def __init__(self, msg, parsed_version):
+        super(InvalidVersion, self).__init__(msg)
+        self.parsed_version = parsed_version
 
 
 @six.add_metaclass(abc.ABCMeta)
diff --git a/tests/test_x509.py b/tests/test_x509.py
index f8d19a5..5383871 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -140,9 +140,11 @@
             x509.load_pem_x509_certificate,
             backend
         )
-        with pytest.raises(x509.InvalidVersion):
+        with pytest.raises(x509.InvalidVersion) as exc:
             cert.version
 
+        assert exc.value.parsed_version == 7
+
     def test_version_1_cert(self, backend):
         cert = _load_cert(
             os.path.join("x509", "v1_cert.pem"),