Kea 2.5.8
crypto_hmac.h
Go to the documentation of this file.
1// Copyright (C) 2011-2017 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#include <util/buffer.h>
8
9#include <boost/noncopyable.hpp>
10
12
13#ifndef ISC_CRYPTO_HMAC_H
14#define ISC_CRYPTO_HMAC_H
15
16namespace isc {
17namespace cryptolink {
18
20class HMACImpl;
21
27class HMAC : private boost::noncopyable {
28private:
45 HMAC(const void* secret, size_t secret_len,
46 const HashAlgorithm hash_algorithm);
47
48 friend HMAC* CryptoLink::createHMAC(const void*, size_t,
49 const HashAlgorithm);
50
51public:
53 ~HMAC();
54
59
63 size_t getOutputLength() const;
64
72 void update(const void* data, const size_t len);
73
86 void sign(isc::util::OutputBuffer& result, size_t len);
87
99 void sign(void* result, size_t len);
100
113 std::vector<uint8_t> sign(size_t len);
114
130 bool verify(const void* sig, size_t len);
131
132private:
133 HMACImpl* impl_;
134};
135
163void signHMAC(const void* data,
164 const size_t data_len,
165 const void* secret,
166 size_t secret_len,
167 const HashAlgorithm hash_algorithm,
169 size_t len = 0);
170
198bool verifyHMAC(const void* data,
199 const size_t data_len,
200 const void* secret,
201 size_t secret_len,
202 const HashAlgorithm hash_algorithm,
203 const void* sig,
204 const size_t sig_len);
205
207void deleteHMAC(HMAC* hmac);
208
209} // namespace cryptolink
210} // namespace isc
211
212#endif // ISC_CRYPTO_HMAC_H
213
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
Definition: buffer.h:347
Defines the logger used by the top-level component of kea-lfc.