Kea 3.1.1
gss_tsig_key.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
7#ifndef GSS_TSIG_KEY_H
8#define GSS_TSIG_KEY_H
9
10#include <d2srv/d2_tsig_key.h>
11#include <gss_tsig_api.h>
12#include <boost/shared_ptr.hpp>
13#include <chrono>
14
15namespace isc {
16namespace gss_tsig {
17
26class GssTsigKey : public d2::D2TsigKey {
27public:
32 GssTsigKey(const std::string& key_name,
33 gss_ctx_id_t sec_ctx = GSS_C_NO_CONTEXT);
34
43 GssTsigKey(const std::string& key_name,
44 const std::vector<uint8_t>& import);
45
47 virtual ~GssTsigKey();
48
56 return (*sec_ctx_);
57 }
58
62 std::chrono::system_clock::time_point getInception() const {
63 return (inception_);
64 }
65
69 uint32_t getInception32() const {
70 std::time_t inception = std::chrono::system_clock::to_time_t(inception_);
71 return (static_cast<uint32_t>(inception));
72 }
73
77 void setInception(const std::chrono::system_clock::time_point& inception) {
78 inception_ = inception;
79 }
80
84 std::chrono::system_clock::time_point getExpire() const {
85 return (expire_);
86 }
87
91 uint32_t getExpire32() const {
92 std::time_t expire = std::chrono::system_clock::to_time_t(expire_);
93 return (static_cast<uint32_t>(expire));
94 }
95
99 void setExpire(const std::chrono::system_clock::time_point& expire) {
100 expire_ = expire;
101 }
102
103protected:
105 std::unique_ptr<GssApiSecCtx> sec_ctx_;
106
108 std::chrono::system_clock::time_point inception_;
109
111 std::chrono::system_clock::time_point expire_;
112};
113
115typedef boost::shared_ptr<GssTsigKey> GssTsigKeyPtr;
116
117} // end of namespace isc::gss_tsig
118} // end of namespace isc
119
120#endif // GSS_TSIG_KEY_H
Statistics keeping extension of the DNS TSIGKey class.
Definition d2_tsig_key.h:21
GSS-API security context.
std::chrono::system_clock::time_point getInception() const
Get the key inception.
uint32_t getInception32() const
Get the key inception (32 bits).
std::chrono::system_clock::time_point expire_
The key expire date.
GssApiSecCtx & getSecCtx()
Get the security context.
uint32_t getExpire32() const
Get the key expire (32 bits).
GssTsigKey(const std::string &key_name, gss_ctx_id_t sec_ctx=GSS_C_NO_CONTEXT)
Constructor.
void setExpire(const std::chrono::system_clock::time_point &expire)
Set the key expire.
std::chrono::system_clock::time_point getExpire() const
Get the key expire.
void setInception(const std::chrono::system_clock::time_point &inception)
Set the key inception.
std::unique_ptr< GssApiSecCtx > sec_ctx_
GSS-API security context.
std::chrono::system_clock::time_point inception_
The key inception date.
virtual ~GssTsigKey()
Destructor.
C++ binding for the GSS-API.
boost::shared_ptr< GssTsigKey > GssTsigKeyPtr
Type of pointer to a GSS-TSIG key.
Defines the logger used by the top-level component of kea-lfc.