Kea 3.1.1
managed_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 MANAGED_KEY_H
8#define MANAGED_KEY_H
9
10#include <cc/cfg_to_element.h>
11#include <gss_tsig_key.h>
12#include <tkey_exchange.h>
13#include <list>
14#include <mutex>
15
16namespace isc {
17namespace gss_tsig {
18
25public:
38
40 static std::string statusToText(Status status);
41
45 ManagedKey(const std::string& name);
46
48 virtual ~ManagedKey() = default;
49
53 std::string getKeyNameStr() const {
54 return (getKeyName().toText());
55 }
56
60 std::string getParentID() const {
61 return (parent_id_);
62 }
63
67 void setParentID(const std::string& parent_id) {
68 parent_id_ = parent_id;
69 }
70
74 Status getStatus() const {
75 return (status_);
76 }
77
81 void setStatus(Status status) {
82 status_ = status;
83 }
84
89 return (tkey_status_);
90 }
91
96 tkey_status_ = tkey_status;
97 }
98
103 return (tkey_ex_);
104 }
105
109 void operator()(TKeyExchange::Status tkey_status);
110
114 static std::string genName(const std::string& server);
115
129
136
137private:
139 std::string parent_id_;
140
142 Status status_;
143
145 TKeyExchange::Status tkey_status_;
146
148 TKeyExchangePtr tkey_ex_;
149
150public:
152 boost::scoped_ptr<std::mutex> mutex_;
153};
154
156typedef boost::shared_ptr<ManagedKey> ManagedKeyPtr;
157
158} // end of namespace isc::gss_tsig
159} // end of namespace isc
160
161#endif // MANAGED_KEY_H
const Name & getKeyName() const
Getter Methods.
Definition tsigkey.cc:204
std::string toText() const
Converts the TSIGKey to a string value.
Definition tsigkey.cc:234
GssTsigKey(const std::string &key_name, gss_ctx_id_t sec_ctx=GSS_C_NO_CONTEXT)
Constructor.
std::string getKeyNameStr() const
Get the key name as a string.
Definition managed_key.h:53
static std::string genName(const std::string &server)
Create a random name from a suffix.
std::string getParentID() const
Get the DNS server (parent) ID.
Definition managed_key.h:60
virtual dns::TSIGContextPtr createContext()
Create GssTsigContext context.
isc::data::ElementPtr toElement() const
Unparse a key object.
boost::scoped_ptr< std::mutex > mutex_
Mutex for protecting key state.
void setTKeyStatus(TKeyExchange::Status tkey_status)
Set the TKEY exchange status.
Definition managed_key.h:95
TKeyExchangePtr & getTKeyExchange()
Get the TKEY exchange.
void setStatus(Status status)
Set the key status.
Definition managed_key.h:81
virtual ~ManagedKey()=default
Destructor.
void setParentID(const std::string &parent_id)
Set the DNS server (parent) ID.
Definition managed_key.h:67
TKeyExchange::Status getTKeyStatus() const
Get the TKEY exchange status.
Definition managed_key.h:88
static std::string statusToText(Status status)
Convert a status to its textual form.
Status getStatus() const
Get the key status.
Definition managed_key.h:74
ManagedKey(const std::string &name)
Constructor.
void operator()(TKeyExchange::Status tkey_status)
The TKEY exchange completion handler.
@ EXPIRED
Expired (no longer usable).
Definition managed_key.h:35
@ IN_ERROR
Setup failed.
Definition managed_key.h:36
@ NOT_READY
Not yet ready (not yet usable).
Definition managed_key.h:33
Callback for the TKeyExchange class.
Status
A status code of the TKeyExchange.
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< TSIGContext > TSIGContextPtr
Definition tsig.h:435
boost::shared_ptr< TKeyExchange > TKeyExchangePtr
boost::shared_ptr< ManagedKey > ManagedKeyPtr
Type of pointer to a Managed GSS-TSIG key.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.