AWS IoT Device SDK C++ v2: Aws::Crt::Crypto::HMAC Class Reference

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

Public Member Functions | Static Public Member Functions | List of all members
Aws::Crt::Crypto::HMAC Class Referencefinal

`#include <HMAC.h>`

## Public Member Functions
| ~HMAC ()
| HMAC (const HMAC &)=delete
HMAC & | operator= (const HMAC &)=delete
| HMAC (HMAC &&toMove)
HMAC & | operator= (HMAC &&toMove)
| operator bool () const noexcept
int | LastError () const noexcept
bool | Update (const ByteCursor &toHMAC) noexcept
bool | Digest (ByteBuf &output, size_t truncateTo=0) noexcept

## Static Public Member Functions
static HMAC | CreateSHA256HMAC (Allocator *allocator, const ByteCursor &secret) noexcept
static HMAC | CreateSHA256HMAC (const ByteCursor &secret) noexcept

## Detailed Description

Streaming HMAC object. The typical use case is for computing the HMAC of an object that is too large to load into memory. You can call Update() multiple times as you load chunks of data into memory. When you're finished simply call Digest(). After Digest() is called, this object is no longer usable.

## Constructor & Destructor Documentation

## ◆ ~HMAC()

Aws::Crt::Crypto::HMAC::~HMAC | ( |  | ) |

## ◆ HMAC() [1/2]

Aws::Crt::Crypto::HMAC::HMAC | ( | const HMAC & |  | ) |
| delete

## ◆ HMAC() [2/2]

Aws::Crt::Crypto::HMAC::HMAC | ( | HMAC && | toMove | ) |

## Member Function Documentation

## ◆ CreateSHA256HMAC() [1/2]

HMAC Aws::Crt::Crypto::HMAC::CreateSHA256HMAC | ( | Allocator * | allocator,
|  | const ByteCursor & | secret
| ) |  |
| staticnoexcept

Creates an instance of a Streaming SHA256 HMAC.

## ◆ CreateSHA256HMAC() [2/2]

HMAC Aws::Crt::Crypto::HMAC::CreateSHA256HMAC | ( | const ByteCursor & | secret | ) |
| staticnoexcept

Creates an instance of a Streaming SHA256 HMAC using the Default Allocator.

## ◆ Digest()

bool Aws::Crt::Crypto::HMAC::Digest | ( | ByteBuf & | output,
|  | size_t | truncateTo = `0`
| ) |  |
| noexcept

Finishes the running HMAC operation and writes the digest into output. The available capacity of output must be large enough for the digest. See: SHA256_DIGEST_SIZE and MD5_DIGEST_SIZE for size hints. 'truncateTo' is for if you want truncated output (e.g. you only want the first 16 bytes of a SHA256 digest. Returns true on success. Call LastError() for the reason this call failed.

## ◆ LastError()

int Aws::Crt::Crypto::HMAC::LastError | ( |  | ) | const
| inlinenoexcept

Returns the value of the last aws error encountered by operations on this instance.

## ◆ operator bool()

Aws::Crt::Crypto::HMAC::operator bool | ( |  | ) | const
| inlinenoexcept

Returns true if the instance is in a valid state, false otherwise.

## ◆ operator=() [1/2]

HMAC & Aws::Crt::Crypto::HMAC::operator= | ( | const HMAC & |  | ) |
| delete

## ◆ operator=() [2/2]

HMAC & Aws::Crt::Crypto::HMAC::operator= | ( | HMAC && | toMove | ) |

## ◆ Update()

bool Aws::Crt::Crypto::HMAC::Update | ( | const ByteCursor & | toHMAC | ) |
| noexcept

Updates the running HMAC object with data in toHMAC. Returns true on success. Call LastError() for the reason this call failed.

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

- crt/aws-crt-cpp/include/aws/crt/crypto/HMAC.h
- crt/aws-crt-cpp/source/crypto/HMAC.cpp