Kea 3.1.1
gss_tsig_context.h
Go to the documentation of this file.
1// Copyright (C) 2021-2025 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>
16#include <gss_tsig_key.h>
17#include <boost/shared_ptr.hpp>
18
19namespace isc {
20namespace gss_tsig {
21
51public:
55 explicit GssTsigContext(GssTsigKey& key);
56
58 virtual ~GssTsigContext();
59
70 sign(const uint16_t qid, const void* const data,
71 const size_t data_len) override;
72
77 virtual dns::TSIGError
78 verify(const dns::TSIGRecord* const record, const void* const data,
79 const size_t data_len) override;
80
87 virtual bool lastHadSignature() const override;
88
96 virtual size_t getTSIGLength() const override;
97
103 virtual State getState() const override {
104 return (state_);
105 }
106
112 virtual void setState(State state) {
113 state_ = state;
114 }
115
121 virtual dns::TSIGError getError() const override {
122 return (error_);
123 }
124
130 virtual void setError(dns::TSIGError error) {
131 error_ = error;
132 }
133
134private:
136 State state_;
137
139 GssTsigKey& key_;
140
142 std::vector<uint8_t> previous_digest_;
143
145 dns::TSIGError error_;
146
150 uint64_t previous_timesigned_;
151
156 int last_sig_dist_;
157
160
161protected:
174 void update(const void* const data, size_t len);
175};
176
178typedef boost::shared_ptr<GssTsigContext> GssTsigContextPtr;
179
180} // end of namespace isc::gss_tsig
181} // end of namespace isc
182
183#endif // GSS_TSIG_CONTEXT_H
TSIG session context.
Definition tsig.h:171
State
Internal state of context.
Definition tsig.h:181
TSIG errors.
Definition tsigerror.h:22
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
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:346
Defines a State within the State Model.
Definition state_model.h:61
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.