summaryrefslogtreecommitdiffstats
path: root/lib/dnssec/signature.h
blob: 1cc6c8f61dc7a948eff126011adddf217b35d895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*  Copyright (C) CZ.NIC, z.s.p.o. <knot-resolver@labs.nic.cz>
 *  SPDX-License-Identifier: GPL-3.0-or-later
 */

#pragma once

#include <libdnssec/key.h>
#include <libknot/rrset.h>

/**
 * Performs referral authentication according to RFC4035 5.2, bullet 2
 * @param ref Referral RRSet. Currently only DS can be used.
 * @param key Already parsed key.
 * @return    0 or error code.  In particular: DNSSEC_INVALID_DS_ALGORITHM
 *            in case *all* DSs in ref use an unimplemented algorithm.
 */
int kr_authenticate_referral(const knot_rrset_t *ref, const dnssec_key_t *key);

/**
 * Check the signature of the supplied RRSet.
 * @param rrsig       A single signature.
 * @param key         Key to be used to validate the signature.
 * @param covered     The covered RRSet.
 * @param trim_labels Number of the leftmost labels to be removed and replaced with '*.'.
 * @return            0 if signature valid, error code else.
 */
int kr_check_signature(const knot_rdata_t *rrsig,
                       const dnssec_key_t *key, const knot_rrset_t *covered,
                       int trim_labels);