'Checks the public key against all authorized keys (if any) for the
user.
@param pubKey: the key in the credentials (just to prevent it from
having to be calculated again)
@type pubKey:
@param credentials: the credentials offered by the user
@type credentials: L{ISSHPrivateKey} provider
@raise UnauthorizedLogin: If the key is not authorized, or if there
was any error obtaining a list of authorized keys for the user.
@return: C{pubKey} if the key is authorized
@rtype: L{twisted.conch.ssh.keys.Key}'

def _checkKey(self, pubKey, credentials):

    if any(((key == pubKey) for key in self._keydb.getAuthorizedKeys(credentials.username))):
        return pubKey
    raise UnauthorizedLogin('Key    not    authorized')
