'Test that the client can authenticate with a public key.'

def test_publickey(self):

    self.authClient.ssh_USERAUTH_FAILURE((NS('publickey') + '\x00'))
    self.assertEqual(self.authClient.transport.packets[(-1)], (userauth.MSG_USERAUTH_REQUEST, (((((NS('foo') + NS('nancy')) + NS('publickey')) + '\x00') + NS('ssh-dss')) + NS(keys.Key.fromString(keydata.publicDSA_openssh).blob()))))
    self.authClient.ssh_USERAUTH_FAILURE((NS('publickey') + '\x00'))
    blob = NS(keys.Key.fromString(keydata.publicRSA_openssh).blob())
    self.assertEqual(self.authClient.transport.packets[(-1)], (userauth.MSG_USERAUTH_REQUEST, (((((NS('foo') + NS('nancy')) + NS('publickey')) + '\x00') + NS('ssh-rsa')) + blob)))
    self.authClient.ssh_USERAUTH_PK_OK((NS('ssh-rsa') + NS(keys.Key.fromString(keydata.publicRSA_openssh).blob())))
    sigData = (((((((NS(self.authClient.transport.sessionID) + chr(userauth.MSG_USERAUTH_REQUEST)) + NS('foo')) + NS('nancy')) + NS('publickey')) + '\x01') + NS('ssh-rsa')) + blob)
    obj = keys.Key.fromString(keydata.privateRSA_openssh)
    self.assertEqual(self.authClient.transport.packets[(-1)], (userauth.MSG_USERAUTH_REQUEST, ((((((NS('foo') + NS('nancy')) + NS('publickey')) + '\x01') + NS('ssh-rsa')) + blob) + NS(obj.sign(sigData)))))
