Kea 1.5.0
tsigkey.h
Go to the documentation of this file.
1// Copyright (C) 2010-2015 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 TSIGKEY_H
8#define TSIGKEY_H 1
9
11
12namespace isc {
13namespace dns {
14
15class Name;
16
56class TSIGKey {
57public:
61
62
111 TSIGKey(const Name& key_name, const Name& algorithm_name,
112 const void* secret, size_t secret_len, size_t digestbits = 0);
113
136 explicit TSIGKey(const std::string& str);
137
143 TSIGKey(const TSIGKey& source);
144
154 TSIGKey& operator=(const TSIGKey& source);
155
157 ~TSIGKey();
159
164
165
166 const Name& getKeyName() const;
167
169 const Name& getAlgorithmName() const;
170
173
175 size_t getDigestbits() const;
176
178 size_t getSecretLength() const;
179
190 const void* getSecret() const;
192
203 std::string toText() const;
204
211
212 static const Name& HMACMD5_NAME();
213 static const Name& HMACMD5_SHORT_NAME();
214 static const Name& HMACSHA1_NAME();
215 static const Name& HMACSHA256_NAME();
216 static const Name& HMACSHA224_NAME();
217 static const Name& HMACSHA384_NAME();
218 static const Name& HMACSHA512_NAME();
220
221private:
222 struct TSIGKeyImpl;
223 const TSIGKeyImpl* impl_;
224};
225
246public:
248 enum Result {
250 EXIST = 1,
251 NOTFOUND = 2
252 };
253
269 struct FindResult {
270 FindResult(Result param_code, const TSIGKey* param_key) :
271 code(param_code), key(param_key)
272 {}
274 const TSIGKey* const key;
275 };
276
290
291private:
292 TSIGKeyRing(const TSIGKeyRing& source);
293 TSIGKeyRing& operator=(const TSIGKeyRing& source);
294public:
298 TSIGKeyRing();
299
301 ~TSIGKeyRing();
303
307 unsigned int size() const;
308
322 Result add(const TSIGKey& key);
323
333 Result remove(const Name& key_name);
334
354 FindResult find(const Name& key_name) const;
355
377 FindResult find(const Name& key_name, const Name& algorithm_name) const;
378
379private:
380 struct TSIGKeyRingImpl;
381 TSIGKeyRingImpl* impl_;
382};
383}
384}
385
386#endif // TSIGKEY_H
387
388// Local Variables:
389// mode: c++
390// End:
The Name class encapsulates DNS names.
Definition: name.h:223
A simple repository of a set of TSIGKey objects.
Definition: tsigkey.h:245
~TSIGKeyRing()
The destructor.
Definition: tsigkey.cc:312
unsigned int size() const
Return the number of keys stored in the TSIGKeyRing.
Definition: tsigkey.cc:317
Result remove(const Name &key_name)
Remove a TSIGKey for the given name from the TSIGKeyRing.
Definition: tsigkey.cc:333
TSIGKeyRing()
The default constructor.
Definition: tsigkey.cc:309
Result add(const TSIGKey &key)
Add a TSIGKey to the TSIGKeyRing.
Definition: tsigkey.cc:322
FindResult find(const Name &key_name) const
Find a TSIGKey for the given name in the TSIGKeyRing.
Definition: tsigkey.cc:338
Result
Result codes of various public methods of TSIGKeyRing.
Definition: tsigkey.h:248
@ EXIST
A key is already stored in TSIGKeyRing.
Definition: tsigkey.h:250
@ NOTFOUND
The specified key is not found in TSIGKeyRing.
Definition: tsigkey.h:251
@ SUCCESS
The operation is successful.
Definition: tsigkey.h:249
TSIG key.
Definition: tsigkey.h:56
static const Name & HMACMD5_NAME()
HMAC-MD5 (RFC2845)
Definition: tsigkey.cc:262
static const Name & HMACSHA224_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:286
const Name & getAlgorithmName() const
Return the algorithm name.
Definition: tsigkey.cc:219
~TSIGKey()
The destructor.
Definition: tsigkey.cc:209
size_t getDigestbits() const
Return the minimum truncated length.
Definition: tsigkey.cc:229
static const Name & HMACSHA256_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:280
TSIGKey & operator=(const TSIGKey &source)
Assignment operator.
Definition: tsigkey.cc:197
isc::cryptolink::HashAlgorithm getAlgorithm() const
Return the hash algorithm name in the form of cryptolink::HashAlgorithm.
Definition: tsigkey.cc:224
static const Name & HMACSHA1_NAME()
HMAC-SHA1 (RFC4635)
Definition: tsigkey.cc:274
const Name & getKeyName() const
Return the key name.
Definition: tsigkey.cc:214
static const Name & HMACMD5_SHORT_NAME()
Definition: tsigkey.cc:268
static const Name & HMACSHA512_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:298
static const Name & HMACSHA384_NAME()
HMAC-SHA256 (RFC4635)
Definition: tsigkey.cc:292
std::string toText() const
Converts the TSIGKey to a string value.
Definition: tsigkey.cc:244
size_t getSecretLength() const
Return the length of the TSIG secret in bytes.
Definition: tsigkey.cc:239
const void * getSecret() const
Return the value of the TSIG secret.
Definition: tsigkey.cc:234
Defines the logger used by the top-level component of kea-dhcp-ddns.
A helper structure to represent the search result of TSIGKeyRing::find().
Definition: tsigkey.h:269
FindResult(Result param_code, const TSIGKey *param_key)
Definition: tsigkey.h:270
const TSIGKey *const key
Definition: tsigkey.h:274