2 * tsig.h -- defines for TSIG [RFC2845]
4 * Copyright (c) 2005-2008, NLnet Labs. All rights reserved.
6 * See LICENSE for the license.
15 * Defines functions for TSIG usage
20 * Contains credentials for TSIG
22 typedef struct ldns_tsig_credentials_struct
27 /* XXX More eventually. */
28 } ldns_tsig_credentials;
30 char *ldns_tsig_algorithm(ldns_tsig_credentials *);
31 char *ldns_tsig_keyname(ldns_tsig_credentials *);
32 char *ldns_tsig_keydata(ldns_tsig_credentials *);
33 char *ldns_tsig_keyname_clone(ldns_tsig_credentials *);
34 char *ldns_tsig_keydata_clone(ldns_tsig_credentials *);
37 * verifies the tsig rr for the given packet and key.
38 * The wire must be given too because tsig does not sign normalized packets.
40 * \return true if tsig is correct, false if not, or if tsig is not set
42 bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac);
45 * creates a tsig rr for the given packet and key.
46 * \param[in] pkt the packet to sign
47 * \param[in] key_name the name of the shared key
48 * \param[in] key_data the key in base 64 format
49 * \param[in] fudge seconds of error permitted in time signed
50 * \param[in] algorithm_name the name of the algorithm used
51 * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers)
52 * \return status (OK if success)
54 ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac);
56 #endif /* LDNS_TSIG_H */