Kea 3.3.3
gss_tsig_context.h
Go to the documentation of this file.
1// Copyright (C) 2021-2026 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
11
12#ifndef GSS_TSIG_CONTEXT_H
13#define GSS_TSIG_CONTEXT_H
14
15#include <dns/tsig.h>
17
18#include <boost/shared_ptr.hpp>
19
20namespace isc {
21namespace gss_tsig {
22
52public:
56 explicit GssTsigContext(GssTsigKey& key);
57
59 virtual ~GssTsigContext();
60
71 sign(const uint16_t qid, const void* const data,
72 const size_t data_len) override;
73
78 virtual dns::TSIGError
79 verify(const dns::TSIGRecord* const record, const void* const data,
80 const size_t data_len) override;
81
88 virtual bool lastHadSignature() const override;
89
97 virtual size_t getTSIGLength() const override;
98
104 virtual State getState() const override {
105 return (state_);
106 }
107
113 virtual void setState(State state) {
114 state_ = state;
115 }
116
122 virtual dns::TSIGError getError() const override {
123 return (error_);
124 }
125
131 virtual void setError(dns::TSIGError error) {
132 error_ = error;
133 }
134
135private:
137 State state_;
138
140 GssTsigKey& key_;
141
143 std::vector<uint8_t> previous_digest_;
144
146 dns::TSIGError error_;
147
151 uint64_t previous_timesigned_;
152
157 int last_sig_dist_;
158
161
162protected:
175 void update(const void* const data, size_t len);
176};
177
179typedef boost::shared_ptr<GssTsigContext> GssTsigContextPtr;
180
181} // end of namespace isc::gss_tsig
182} // end of namespace isc
183
184#endif // GSS_TSIG_CONTEXT_H
TSIG session context.
Definition tsig.h:172
State
Internal state of context.
Definition tsig.h:182
TSIG errors.
Definition tsigerror.h:23
TSIG resource record.
Definition tsigrecord.h:51
virtual bool lastHadSignature() const override
Check whether the last verified message was signed.
virtual dns::TSIGError getError() const override
Return the TSIG error as a result of the latest verification.
virtual ~GssTsigContext()
Destructor.
virtual dns::ConstTSIGRecordPtr sign(const uint16_t qid, const void *const data, const size_t data_len) override
Sign a DNS message.
virtual void setState(State state)
Set the current state of the context.
virtual size_t getTSIGLength() const override
Return the expected length of TSIG RR after sign().
void update(const void *const data, size_t len)
Update internal MAC state by more data.
virtual State getState() const override
Return the current state of the context.
virtual void setError(dns::TSIGError error)
Set the TSIG error.
virtual dns::TSIGError verify(const dns::TSIGRecord *const record, const void *const data, const size_t data_len) override
Verify a DNS message.
GssTsigContext(GssTsigKey &key)
Constructor.
GSS-TSIG extension of the D2 TSIG key class.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition buffer.h:355
Defines a State within the State Model.
Definition state_model.h:64
boost::shared_ptr< const TSIGRecord > ConstTSIGRecordPtr
A pointer-like type pointing to an immutable TSIGRecord object.
Definition tsigrecord.h:283
boost::shared_ptr< GssTsigContext > GssTsigContextPtr
Type of pointer to a GSS-TSIG context.
Defines the logger used by the top-level component of kea-lfc.