'CURVE ZAP authentication'

def _authenticate_curve(self, domain, client_key):

    allowed = False
    reason = ''
    if self.allow_any:
        allowed = True
        reason = 'OK'
        self.log.debug('ALLOWED    (CURVE    allow    any    client)')
    else:
        if (not domain):
            domain = '*'
        if (domain in self.certs):
            z85_client_key = z85.encode(client_key)
            if self.certs[domain].get(z85_client_key):
                allowed = True
                reason = 'OK'
            else:
                reason = 'Unknown    key'
            status = ('ALLOWED' if allowed else 'DENIED')
            self.log.debug('%s    (CURVE)    domain=%s    client_key=%s', status, domain, z85_client_key)
        else:
            reason = 'Unknown    domain'
    return (allowed, reason)
