def test_failedPrivateKeyAuthenticationWithSignature(self):
        """
        Test that private key authentication fails when the public key
        is invalid.
        """
        blob = keys.Key.fromString(keydata.publicRSA_openssh).blob()
        obj = keys.Key.fromString(keydata.privateRSA_openssh)
        packet = (NS(b'foo') + NS(b'none') + NS(b'publickey') + b'\xff'
                + NS(b'ssh-rsa') + NS(blob) + NS(obj.sign(blob)))
        self.authServer.transport.sessionID = b'test'
        d = self.authServer.ssh_USERAUTH_REQUEST(packet)
        return d.addCallback(self._checkFailed)

        Test that private key authentication fails when the public key
        is invalid.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_userauth.py