Kea 3.3.3
managed_key.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
7#ifndef MANAGED_KEY_H
8#define MANAGED_KEY_H
9
10#include <cc/cfg_to_element.h>
13
14#include <cstdint>
15#include <mutex>
16
17namespace isc {
18namespace gss_tsig {
19
26public:
39
41 static std::string statusToText(Status status);
42
46 ManagedKey(const std::string& name);
47
49 virtual ~ManagedKey() = default;
50
54 std::string getKeyNameStr() const {
55 return (getKeyName().toText());
56 }
57
61 std::string getParentID() const {
62 return (parent_id_);
63 }
64
68 void setParentID(const std::string& parent_id) {
69 parent_id_ = parent_id;
70 }
71
75 Status getStatus() const {
76 return (status_);
77 }
78
82 void setStatus(Status status) {
83 status_ = status;
84 }
85
90 return (tkey_status_);
91 }
92
97 tkey_status_ = tkey_status;
98 }
99
104 return (tkey_ex_);
105 }
106
110 void operator()(TKeyExchange::Status tkey_status);
111
115 static std::string genName(const std::string& server);
116
130
137
138private:
140 std::string parent_id_;
141
143 Status status_;
144
146 TKeyExchange::Status tkey_status_;
147
149 TKeyExchangePtr tkey_ex_;
150
151public:
153 boost::scoped_ptr<std::mutex> mutex_;
154};
155
157typedef boost::shared_ptr<ManagedKey> ManagedKeyPtr;
158
159} // end of namespace isc::gss_tsig
160} // end of namespace isc
161
162#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:54
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:61
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.
@ EXPIRED
Expired (no longer usable).
Definition managed_key.h:36
@ IN_ERROR
Setup failed.
Definition managed_key.h:37
@ NOT_READY
Not yet ready (not yet usable).
Definition managed_key.h:34
void setTKeyStatus(TKeyExchange::Status tkey_status)
Set the TKEY exchange status.
Definition managed_key.h:96
TKeyExchangePtr & getTKeyExchange()
Get the TKEY exchange.
void setStatus(Status status)
Set the key status.
Definition managed_key.h:82
virtual ~ManagedKey()=default
Destructor.
void setParentID(const std::string &parent_id)
Set the DNS server (parent) ID.
Definition managed_key.h:68
TKeyExchange::Status getTKeyStatus() const
Get the TKEY exchange status.
Definition managed_key.h:89
static std::string statusToText(Status status)
Convert a status to its textual form.
Status getStatus() const
Get the key status.
Definition managed_key.h:75
ManagedKey(const std::string &name)
Constructor.
void operator()(TKeyExchange::Status tkey_status)
The TKEY exchange completion handler.
Callback for the TKeyExchange class.
Status
A status code of the TKeyExchange.
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
boost::shared_ptr< TSIGContext > TSIGContextPtr
Definition tsig.h:436
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.