AWS IoT Device SDK C++ v2  1.38.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
 
HMACoperator= (const HMAC &)=delete
 
 HMAC (HMAC &&toMove)
 
HMACoperator= (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
 
size_t DigestSize () const noexcept
 
bool ComputeOneShot (const ByteCursor &input, 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

◆ ComputeOneShot()

bool Aws::Crt::Crypto::HMAC::ComputeOneShot ( const ByteCursor input,
ByteBuf output,
size_t  truncateTo = 0 
)
noexcept

Computes the running HMAC and 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 HMAC digest. Returns true on success. Call LastError() for the reason this call failed.

This is an API a user would use for smaller size inputs. For larger, streaming inputs, use multiple calls to Update() for each buffer, followed by a single call to Digest().

◆ 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.

◆ DigestSize()

size_t Aws::Crt::Crypto::HMAC::DigestSize ( ) const
noexcept

Returns the size of the digest for this hmac algorithm. If this object is not valid, it will return 0 instead.

◆ 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: