test the negative path through PKeyType.check
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index 6c0ee31..a22ad12 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -207,6 +207,7 @@
 11n8RkgFIQA0AhuKSIg3CbuartRsJnWOLwgLTzsrKYL4yRog1RJrtw==
 -----END RSA PRIVATE KEY-----
 """)
+
 encryptedPrivateKeyPEMPassphrase = b("foobar")
 
 # Some PKCS#7 stuff.  Generated with the openssl command line:
@@ -250,6 +251,21 @@
 -----END X509 CRL-----
 """)
 
+
+# A broken RSA private key which can be used to test the error path through
+# PKey.check.
+inconsistentPrivateKeyPEM = b("""-----BEGIN RSA PRIVATE KEY-----
+MIIBPAIBAAJBAKy+e3dulvXzV7zoTZWc5TzgApr8DmeQHTYC8ydfzH7EECe4R1Xh
+5kwIzOuuFfn178FBiS84gngaNcrFi0Z5fAkCAwEaAQJBAIqm/bz4NA1H++Vx5Ewx
+OcKp3w19QSaZAwlGRtsUxrP7436QjnREM3Bm8ygU11BjkPVmtrKm6AayQfCHqJoT
+zIECIQDW0BoMoL0HOYM/mrTLhaykYAVqgIeJsPjvkEhTFXWBuQIhAM3deFAvWNu4
+nklUQ37XsCT2c9tmNt1LAT+slG2JOTTRAiAuXDtC/m3NYVwyHfFm+zKHRzHkClk2
+HjubeEgjpj32AQIhAJqMGTaZVOwevTXvvHwNeH+vRWsAYU/gbx+OQB+7VOcBAiEA
+oolb6NMg/R3enNPvS1O4UU1H8wpaF77L4yiSWlE0p4w=
+-----END RSA PRIVATE KEY-----
+""")
+
+
 class X509ExtTests(TestCase):
     """
     Tests for L{OpenSSL.crypto.X509Extension}.
@@ -512,11 +528,13 @@
     def test_pregeneration(self):
         """
         L{PKeyType.bits} and L{PKeyType.type} return C{0} before the key is
+        generated.  L{PKeyType.check} raises L{TypeError} before the key is
         generated.
         """
         key = PKey()
         self.assertEqual(key.type(), 0)
         self.assertEqual(key.bits(), 0)
+        self.assertRaises(TypeError, key.check)
 
 
     def test_failedGeneration(self):
@@ -595,6 +613,13 @@
              self.assertEqual(key.bits(), bits)
 
 
+    def test_inconsistentKey(self):
+        """
+        L{PKeyType.check} returns C{False} if the key is not consistent.
+        """
+        key = load_privatekey(FILETYPE_PEM, inconsistentPrivateKeyPEM)
+        self.assertFalse(key.check())
+
 
 class X509NameTests(TestCase):
     """