'Check whether the credentials themselves are valid, now that we know
if the key matches the user.
@param validKey: A boolean indicating whether or not the public key
matches a key in the user\'s authorized_keys file.
@param credentials: The credentials offered by the user.
@type credentials: L{ISSHPrivateKey} provider
@raise UnauthorizedLogin: (as a failure) if the key does not match the
user in C{credentials}. Also raised if the user provides an invalid
signature.
@raise ValidPublicKey: (as a failure) if the key matches the user but
the credentials do not include a signature. See
L{error.ValidPublicKey} for more information.
@return: The user\'s username, if authentication was successful.'

def _cbRequestAvatarId(self, validKey, credentials):

    if (not validKey):
        return failure.Failure(UnauthorizedLogin('invalid    key'))
    if (not credentials.signature):
        return failure.Failure(error.ValidPublicKey())
    else:
        try:
            pubKey = keys.Key.fromString(credentials.blob)
            if pubKey.verify(credentials.signature, credentials.sigData):
                return credentials.username
        except:
            log.err()
            return failure.Failure(UnauthorizedLogin('error    while    verifying    key'))
    return failure.Failure(UnauthorizedLogin('unable    to    verify    key'))
