AWS IoT Device SDK C++ v2 1.44.2
AWS IoT Device SDK C++ v2
Loading...
Searching...
No Matches
Aws::Crt::Crypto Namespace Reference

Classes

class  ByoHash
class  ByoHMAC
class  Hash
class  HMAC
class  SymmetricCipher

Typedefs

using CreateHashCallback = std::function<std::shared_ptr<ByoHash>(size_t digestSize, Allocator *)>
using CreateHMACCallback

Enumerations

enum class  SymmetricCipherState { Ready = AWS_SYMMETRIC_CIPHER_READY , Finalized = AWS_SYMMETRIC_CIPHER_FINALIZED , Error = AWS_SYMMETRIC_CIPHER_ERROR }

Functions

bool AWS_CRT_CPP_API ComputeSHA256 (Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA256 (const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeMD5 (Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeMD5 (const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA1 (Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA1 (const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA512 (Allocator *allocator, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA512 (const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API DeriveSHA512HMACHKDF (Allocator *allocator, ByteCursor ikm, ByteCursor salt, ByteCursor info, ByteBuf &out, size_t length) noexcept
bool AWS_CRT_CPP_API ComputeSHA256HMAC (Allocator *allocator, const ByteCursor &secret, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API ComputeSHA256HMAC (const ByteCursor &secret, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
bool AWS_CRT_CPP_API GenerateRandomBytes (ByteBuf &output, size_t lengthToGenerate)

Variables

static const size_t SHA1_DIGEST_SIZE = AWS_SHA1_LEN
static const size_t SHA256_DIGEST_SIZE = AWS_SHA256_LEN
static const size_t SHA512_DIGEST_SIZE = AWS_SHA512_LEN
static const size_t MD5_DIGEST_SIZE = AWS_MD5_LEN
static const size_t SHA256_HMAC_DIGEST_SIZE = 32
static const size_t AES_256_CIPHER_BLOCK_SIZE = 16u
static const size_t AES_256_KEY_SIZE_BYTES = 32u

Typedef Documentation

◆ CreateHashCallback

using Aws::Crt::Crypto::CreateHashCallback = std::function<std::shared_ptr<ByoHash>(size_t digestSize, Allocator *)>

◆ CreateHMACCallback

Initial value:
std::function<std::shared_ptr<ByoHMAC>(size_t digestSize, const ByteCursor &secret, Allocator *)>
aws_byte_cursor ByteCursor
Definition Types.h:31
aws_allocator Allocator
Definition Allocator.h:14

Enumeration Type Documentation

◆ SymmetricCipherState

Enumerator
Ready 
Finalized 
Error 

Function Documentation

◆ ComputeMD5() [1/2]

bool Aws::Crt::Crypto::ComputeMD5 ( Allocator * allocator,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a MD5 Hash over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of MD5_DIGEST_SIZE.

◆ ComputeMD5() [2/2]

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

Computes a MD5 Hash using the default allocator over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of MD5_DIGEST_SIZE.

◆ ComputeSHA1() [1/2]

bool Aws::Crt::Crypto::ComputeSHA1 ( Allocator * allocator,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a SHA1 Hash over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA1_DIGEST_SIZE.

◆ ComputeSHA1() [2/2]

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

Computes a SHA1 Hash using the default allocator over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA1_DIGEST_SIZE.

◆ ComputeSHA256() [1/2]

bool Aws::Crt::Crypto::ComputeSHA256 ( Allocator * allocator,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a SHA256 Hash over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA256_DIGEST_SIZE.

◆ ComputeSHA256() [2/2]

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

Computes a SHA256 Hash using the default allocator over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA256_DIGEST_SIZE.

◆ ComputeSHA256HMAC() [1/2]

bool Aws::Crt::Crypto::ComputeSHA256HMAC ( Allocator * allocator,
const ByteCursor & secret,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a SHA256 HMAC with secret over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA256_HMAC_DIGEST_SIZE.

◆ ComputeSHA256HMAC() [2/2]

bool Aws::Crt::Crypto::ComputeSHA256HMAC ( const ByteCursor & secret,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a SHA256 HMAC using the default allocator with secret over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA256_HMAC_DIGEST_SIZE.

◆ ComputeSHA512() [1/2]

bool Aws::Crt::Crypto::ComputeSHA512 ( Allocator * allocator,
const ByteCursor & input,
ByteBuf & output,
size_t truncateTo = 0 )
noexcept

Computes a SHA512 Hash over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA512_DIGEST_SIZE.

◆ ComputeSHA512() [2/2]

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

Computes a SHA512 Hash using the default allocator over input, and writes the digest to output. If truncateTo is non-zero, the digest will be truncated to the value of truncateTo. Returns true on success. If this function fails, Aws::Crt::LastError() will contain the error that occurred. Unless you're using 'truncateTo', output should have a minimum capacity of SHA512_DIGEST_SIZE.

◆ DeriveSHA512HMACHKDF()

bool Aws::Crt::Crypto::DeriveSHA512HMACHKDF ( Allocator * allocator,
ByteCursor ikm,
ByteCursor salt,
ByteCursor info,
ByteBuf & out,
size_t length )
noexcept

Derives an SHA256 HMAC HKDF using the default allocator and writes it to out. If this function fails, Aws::Crt::LastError() will contain the error that occurred.

◆ GenerateRandomBytes()

bool Aws::Crt::Crypto::GenerateRandomBytes ( ByteBuf & output,
size_t lengthToGenerate )

Variable Documentation

◆ AES_256_CIPHER_BLOCK_SIZE

const size_t Aws::Crt::Crypto::AES_256_CIPHER_BLOCK_SIZE = 16u
static

◆ AES_256_KEY_SIZE_BYTES

const size_t Aws::Crt::Crypto::AES_256_KEY_SIZE_BYTES = 32u
static

◆ MD5_DIGEST_SIZE

const size_t Aws::Crt::Crypto::MD5_DIGEST_SIZE = AWS_MD5_LEN
static

◆ SHA1_DIGEST_SIZE

const size_t Aws::Crt::Crypto::SHA1_DIGEST_SIZE = AWS_SHA1_LEN
static

◆ SHA256_DIGEST_SIZE

const size_t Aws::Crt::Crypto::SHA256_DIGEST_SIZE = AWS_SHA256_LEN
static

◆ SHA256_HMAC_DIGEST_SIZE

const size_t Aws::Crt::Crypto::SHA256_HMAC_DIGEST_SIZE = 32
static

◆ SHA512_DIGEST_SIZE

const size_t Aws::Crt::Crypto::SHA512_DIGEST_SIZE = AWS_SHA512_LEN
static