Kea: isc::cryptolink::HMAC Class Reference

| Kea 2.2.0

Public Member Functions | Friends | List of all members
isc::cryptolink::HMAC Class Reference

HMAC support. More...

`#include <crypto_hmac.h>`

Inheritance diagram for isc::cryptolink::HMAC:
[legend]

## Public Member Functions
| ~HMAC ()
| Destructor. More...
HashAlgorithm | getHashAlgorithm () const
| Returns the HashAlgorithm of the object. More...
size_t | getOutputLength () const
| Returns the output size of the digest. More...
void | sign (isc::util::OutputBuffer &result, size_t len)
| Calculate the final signature. More...
std::vector< uint8_t > | sign (size_t len)
| Calculate the final signature. More...
void | sign (void *result, size_t len)
| Calculate the final signature. More...
void | update (const void *data, const size_t len)
| Add data to digest. More...
bool | verify (const void *sig, size_t len)
| Verify an existing signature. More...

## Friends
HMAC * | CryptoLink::createHMAC (const void *, size_t, const HashAlgorithm)

## Detailed Description

HMAC support.

This class is used to create and verify HMAC signatures. Instances can be created with CryptoLink::createHMAC()

Definition at line 27 of file crypto_hmac.h.

## Constructor & Destructor Documentation

## ◆ ~HMAC()

isc::cryptolink::HMAC::~HMAC | ( |  | ) |

Destructor.

Definition at line 205 of file botan_hmac.cc.

## Member Function Documentation

## ◆ getHashAlgorithm()

HashAlgorithm isc::cryptolink::HMAC::getHashAlgorithm | ( |  | ) | const

Returns the HashAlgorithm of the object.

Returns
  hash algorithm

Definition at line 210 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::getHashAlgorithm().

Here is the call graph for this function:

## ◆ getOutputLength()

size_t isc::cryptolink::HMAC::getOutputLength | ( |  | ) | const

Returns the output size of the digest.

Returns
  output size of the digest

Definition at line 215 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::getOutputLength().

Here is the call graph for this function:

## ◆ sign() [1/3]

void isc::cryptolink::HMAC::sign | ( | isc::util::OutputBuffer & | result,
|  | size_t | len
| ) |  |

Calculate the final signature.

The result will be appended to the given outputbuffer

Exceptions

  LibraryError | if there was any unexpected exception in the underlying library

Parameters

  result | The OutputBuffer to append the result to
  len | The number of bytes from the result to copy. If this value is smaller than the algorithms output size, the result will be truncated. If this value is larger, only output size bytes will be copied

Definition at line 225 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::sign().

Here is the call graph for this function:

## ◆ sign() [2/3]

std::vector< uint8_t > isc::cryptolink::HMAC::sign | ( | size_t | len | ) |

Calculate the final signature.

The result will be returned as a std::vector<uint8_t>

Exceptions

  LibraryError | if there was any unexpected exception in the underlying library

Parameters

  len | The number of bytes from the result to copy. If this value is smaller than the algorithms output size, the result will be truncated. If this value is larger, only output size bytes will be copied

Returns
  a vector containing the signature

Definition at line 235 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::sign().

Here is the call graph for this function:

## ◆ sign() [3/3]

void isc::cryptolink::HMAC::sign | ( | void * | result,
|  | size_t | len
| ) |  |

Calculate the final signature.

len bytes of data from the result will be copied to *result If len is larger than the output size, only output_size bytes will be copied. If it is smaller, the output will be truncated

Exceptions

  LibraryError | if there was any unexpected exception in the underlying library

At least len bytes of data must be available for writing at result

Definition at line 230 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::sign().

Here is the call graph for this function:

## ◆ update()

void isc::cryptolink::HMAC::update | ( | const void * | data,
|  | const size_t | len
| ) |  |

Add data to digest.

Exceptions

  LibraryError | if there was any unexpected exception in the underlying library

Parameters

  data | The data to add
  len | The size of the data

Definition at line 220 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::update().

Here is the call graph for this function:

## ◆ verify()

bool isc::cryptolink::HMAC::verify | ( | const void * | sig,
|  | size_t | len
| ) |  |

Verify an existing signature.

Exceptions

  LibraryError | if there was any unexpected exception in the underlying library

Parameters

  sig | The signature to verify
  len | The length of the signature. If this is smaller than the output length of the algorithm, only len bytes will be checked. If this is larger than the output length of the algorithm, only output size bytes will be checked

Returns
  true if the signature is correct, false otherwise

Note
  verify() does not destroy its context so it can be called multiple times with different signatures.

Definition at line 240 of file botan_hmac.cc.

References isc::cryptolink::HMACImpl::verify().

Here is the call graph for this function:

## Friends And Related Function Documentation

## ◆ CryptoLink::createHMAC

HMAC * CryptoLink::createHMAC | ( | const void * | ,
|  | size_t | ,
|  | const | HashAlgorithm
| ) |  |
| friend

The documentation for this class was generated from the following files:

- crypto_hmac.h
- botan_hmac.cc
- openssl_hmac.cc