AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
OpenSslDigest.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKCRYPTO_PRIVATE_OPENSSLDIGEST_H_
17 #define ACSDKCRYPTO_PRIVATE_OPENSSLDIGEST_H_
18 
19 #include <memory>
20 
21 #include <openssl/evp.h>
22 
25 
26 namespace alexaClientSDK {
27 namespace acsdkCrypto {
28 
31 
38 public:
46  static std::unique_ptr<OpenSslDigest> create(DigestType type) noexcept;
47 
50  ~OpenSslDigest() noexcept override;
51  bool process(const DataBlock& data_in) noexcept override;
52  bool process(DataBlock::const_iterator begin, DataBlock::const_iterator end) noexcept override;
53  bool processByte(unsigned char value) noexcept override;
54  bool processUInt8(uint8_t value) noexcept override;
55  bool processUInt16(uint16_t value) noexcept override;
56  bool processUInt32(uint32_t value) noexcept override;
57  bool processUInt64(uint64_t value) noexcept override;
58  bool processString(const std::string& value) noexcept override;
59  bool finalize(DataBlock& digest) noexcept override;
60  bool reset() noexcept override;
62 private:
64  OpenSslDigest() noexcept;
65 
73  bool init(DigestType type) noexcept;
74 
76  const EVP_MD* m_md;
77 
79  EVP_MD_CTX* m_ctx;
80 };
81 
82 } // namespace acsdkCrypto
83 } // namespace alexaClientSDK
84 
85 #endif // ACSDKCRYPTO_PRIVATE_OPENSSLDIGEST_H_
alexaClientSDK::acsdkCrypto::OpenSslDigest
Digest implementation based on OpenSSL.
Definition: OpenSslDigest.h:37
DigestInterface.h
alexaClientSDK::acsdkCrypto::OpenSslDigest::~OpenSslDigest
~OpenSslDigest() noexcept override
Definition: OpenSslDigest.cpp:57
alexaClientSDK::acsdkCrypto::OpenSslDigest::reset
bool reset() noexcept override
Resets the digest.
Definition: OpenSslDigest.cpp:129
alexaClientSDK::acsdkCrypto::OpenSslDigest::finalize
bool finalize(DataBlock &digest) noexcept override
Finishes digest computation and produces the result.
Definition: OpenSslDigest.cpp:120
alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt8
bool processUInt8(uint8_t value) noexcept override
Updates digest with uint8_t value.
Definition: OpenSslDigest.cpp:86
alexaClientSDK::acsdkCryptoInterfaces::DigestInterface
Digest computation interface.
Definition: DigestInterface.h:52
alexaClientSDK::acsdkCryptoInterfaces::DigestType
DigestType
Enumeration of all supported digest algorithms.
Definition: DigestType.h:31
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::acsdkCryptoInterfaces::DigestInterface::DataBlock
std::vector< unsigned char > DataBlock
Data block type. This type represents a byte array.
Definition: DigestInterface.h:56
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::create
static std::unique_ptr< OpenSslDigest > create(DigestType type) noexcept
Creates a new digest instance.
Definition: OpenSslDigest.cpp:37
alexaClientSDK::acsdkCrypto::OpenSslDigest::process
bool process(const DataBlock &data_in) noexcept override
Updates digest with a data block.
Definition: OpenSslDigest.cpp:71
alexaClientSDK::acsdkCrypto::OpenSslDigest::processUInt64
bool processUInt64(uint64_t value) noexcept override
Updates digest with uint64_t integer value.
Definition: OpenSslDigest.cpp:104
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
DigestType.h
alexaClientSDK::acsdkCrypto::OpenSslDigest::processString
bool processString(const std::string &value) noexcept override
Updates digest with string value.
Definition: OpenSslDigest.cpp:116

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