AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Static Public Member Functions | List of all members
alexaClientSDK::acsdkCrypto::OpenSslDigest Class Reference

Digest implementation based on OpenSSL. More...

#include <OpenSslDigest.h>

Inheritance diagram for alexaClientSDK::acsdkCrypto::OpenSslDigest:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkCrypto::OpenSslDigest:
Collaboration graph
[legend]

Public Member Functions

DigestInterface methods.
 ~OpenSslDigest () noexcept override
 
bool process (const DataBlock &data_in) noexcept override
 Updates digest with a data block. More...
 
bool process (DataBlock::const_iterator begin, DataBlock::const_iterator end) noexcept override
 Updates digest with a data block range. More...
 
bool processByte (unsigned char value) noexcept override
 Updates digest with a byte value. More...
 
bool processUInt8 (uint8_t value) noexcept override
 Updates digest with uint8_t value. More...
 
bool processUInt16 (uint16_t value) noexcept override
 Updates digest with uint16_t integer value. More...
 
bool processUInt32 (uint32_t value) noexcept override
 Updates digest with uint32_t integer value. More...
 
bool processUInt64 (uint64_t value) noexcept override
 Updates digest with uint64_t integer value. More...
 
bool processString (const std::string &value) noexcept override
 Updates digest with string value. More...
 
bool finalize (DataBlock &digest) noexcept override
 Finishes digest computation and produces the result. More...
 
bool reset () noexcept override
 Resets the digest. More...
 
- Public Member Functions inherited from alexaClientSDK::acsdkCryptoInterfaces::DigestInterface
virtual ~DigestInterface () noexcept=default
 Default destructor. More...
 

Static Public Member Functions

static std::unique_ptr< OpenSslDigestcreate (DigestType type) noexcept
 Creates a new digest instance. More...
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::acsdkCryptoInterfaces::DigestInterface
typedef std::vector< unsigned char > DataBlock
 Data block type. This type represents a byte array. More...
 

Detailed Description

Digest implementation based on OpenSSL.

Constructor & Destructor Documentation

◆ ~OpenSslDigest()

alexaClientSDK::acsdkCrypto::OpenSslDigest::~OpenSslDigest ( )
overridenoexcept

Member Function Documentation

◆ create()

std::unique_ptr< OpenSslDigest > alexaClientSDK::acsdkCrypto::OpenSslDigest::create ( DigestType  type)
staticnoexcept

Creates a new digest instance.

Parameters
[in]typeDigest type.
Returns
Digest reference or nullptr on error.

◆ finalize()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::finalize ( DataBlock dataOut)
overridevirtualnoexcept

Finishes digest computation and produces the result.

This method finishes digest computation and produces the result. The object is reset if this call succeeds and can be reused for computing new digest.

Parameters
[out]dataOutComputed digest. The size of output depends on the selected digest algorithm. The method appends data to dataOut container.
Returns
True if operation has succeeded. This object state is reset and ready to start computing a new digest. If operation fails, the state of the object and contents of dataOut container are undefined. The user can call reset() to reuse the object in this case.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ process() [1/2]

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::process ( const DataBlock dataIn)
overridevirtualnoexcept

Updates digest with a data block.

Updates digest value with a data from a data block.

This call is logical equivalent to a following code:

for (b: dataIn) processUInt8(b);
Parameters
[in]dataInData for digest.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ process() [2/2]

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::process ( DataBlock::const_iterator  begin,
DataBlock::const_iterator  end 
)
overridevirtualnoexcept

Updates digest with a data block range.

Updates digest value with a data from a data block range.

This call is logical equivalent to a following code:

for (auto it = begin; it != end; ++it) processUInt8(*it);
Parameters
[in]beginBegin of data block. This parameter must be equal or less than end. If the parameter is greater than dataInEnd the implementation does nothing and returns false.
[in]endRange end. This parameter must be equal or greater than begin. If the parameter is smaller than begin the implementation does nothing and returns false.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processByte()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processByte ( unsigned char  value)
overridevirtualnoexcept

Updates digest with a byte value.

Updates digest value with a single byte value.

Parameters
[in]valuebyte value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processString()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processString ( const std::string &  value)
overridevirtualnoexcept

Updates digest with string value.

Updates digest with bytes from a string object. The input is treated as a byte array without terminating null character.

This method is equivalent to the following:

for (auto ch: value) processByte(ch);
Parameters
[in]valueString value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processUInt16()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt16 ( uint16_t  value)
overridevirtualnoexcept

Updates digest with uint16_t integer value.

Updates digest value with uint16_t data. This method uses big endian (network byte order) encoding for presenting input value as a byte array.

This method is equivalent to the following:

processUInt8(value >> 8) && processUInt8(value);
Parameters
[in]valueInteger value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processUInt32()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt32 ( uint32_t  value)
overridevirtualnoexcept

Updates digest with uint32_t integer value.

Updates digest value with uint32_t data. This method uses big endian (network byte order) encoding for presenting input value as a byte array.

This method is equivalent to the following:

processUInt16(value >> 16) && processUInt16(value);
Parameters
[in]valueInteger value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processUInt64()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt64 ( uint64_t  value)
overridevirtualnoexcept

Updates digest with uint64_t integer value.

Updates digest value with uint64_t data. This method uses big endian (network byte order) encoding for presenting input value as a byte array.

This method is equivalent to the following:

processUInt32((uint32_t)(value >> 32)) && processUInt32((uint32_t)value);
Parameters
[in]valueInteger value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ processUInt8()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt8 ( uint8_t  value)
overridevirtualnoexcept

Updates digest with uint8_t value.

Updates digest value with a 8-bit value.

Parameters
[in]valueInteger value.
Returns
True if operation has succeeded. If operation fails, the state of object is undefined, and user must call reset() to reuse the object.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.

◆ reset()

bool alexaClientSDK::acsdkCrypto::OpenSslDigest::reset ( )
overridevirtualnoexcept

Resets the digest.

This method resets object state and prepares it for reuse.

Returns
True if operation has succeeded. If operation fails, the state of the object is undefined and the object must not used.

Implements alexaClientSDK::acsdkCryptoInterfaces::DigestInterface.


The documentation for this class was generated from the following files:
alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt8
bool processUInt8(uint8_t value) noexcept override
Updates digest with uint8_t value.
Definition: OpenSslDigest.cpp:86
alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt32
bool processUInt32(uint32_t value) noexcept override
Updates digest with uint32_t integer value.
Definition: OpenSslDigest.cpp:96
alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt16
bool processUInt16(uint16_t value) noexcept override
Updates digest with uint16_t integer value.
Definition: OpenSslDigest.cpp:91
alexaClientSDK::acsdkCrypto::OpenSslDigest::processByte
bool processByte(unsigned char value) noexcept override
Updates digest with a byte value.
Definition: OpenSslDigest.cpp:81

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0