Kea: gss_tsig_key.h Source File

| Kea 3.2.0-git

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
26 class 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
55 GssApiSecCtx& getSecCtx() {
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
115 typedef 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
isc::d2::D2TsigKey
Statistics keeping extension of the DNS TSIGKey class.
Definition d2_tsig_key.h:21
isc::gss_tsig::GssApiSecCtx
GSS-API security context.
Definition gss_tsig_api.h:290
isc::gss_tsig::GssTsigKey::getInception
std::chrono::system_clock::time_point getInception() const
Get the key inception.
Definition gss_tsig_key.h:62
isc::gss_tsig::GssTsigKey::getInception32
uint32_t getInception32() const
Get the key inception (32 bits).
Definition gss_tsig_key.h:69
isc::gss_tsig::GssTsigKey::expire_
std::chrono::system_clock::time_point expire_
The key expire date.
Definition gss_tsig_key.h:111
isc::gss_tsig::GssTsigKey::getSecCtx
GssApiSecCtx & getSecCtx()
Get the security context.
Definition gss_tsig_key.h:55
isc::gss_tsig::GssTsigKey::getExpire32
uint32_t getExpire32() const
Get the key expire (32 bits).
Definition gss_tsig_key.h:91
isc::gss_tsig::GssTsigKey::GssTsigKey
GssTsigKey(const std::string &key_name, gss_ctx_id_t sec_ctx=GSS_C_NO_CONTEXT)
Constructor.
Definition gss_tsig_key.cc:18
isc::gss_tsig::GssTsigKey::setExpire
void setExpire(const std::chrono::system_clock::time_point &expire)
Set the key expire.
Definition gss_tsig_key.h:99
isc::gss_tsig::GssTsigKey::getExpire
std::chrono::system_clock::time_point getExpire() const
Get the key expire.
Definition gss_tsig_key.h:84
isc::gss_tsig::GssTsigKey::setInception
void setInception(const std::chrono::system_clock::time_point &inception)
Set the key inception.
Definition gss_tsig_key.h:77
isc::gss_tsig::GssTsigKey::sec_ctx_
std::unique_ptr< GssApiSecCtx > sec_ctx_
GSS-API security context.
Definition gss_tsig_key.h:105
isc::gss_tsig::GssTsigKey::inception_
std::chrono::system_clock::time_point inception_
The key inception date.
Definition gss_tsig_key.h:108
isc::gss_tsig::GssTsigKey::~GssTsigKey
virtual ~GssTsigKey()
Destructor.
Definition gss_tsig_key.cc:26
d2_tsig_key.h
gss_tsig_api.h
C++ binding for the GSS-API.
isc::gss_tsig
Definition gss_tsig_api.cc:19
isc::gss_tsig::GssTsigKeyPtr
boost::shared_ptr< GssTsigKey > GssTsigKeyPtr
Type of pointer to a GSS-TSIG key.
Definition gss_tsig_key.h:115
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18