AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
CryptoCodecInterface.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 ACSDK_CRYPTOINTERFACES_CRYPTOCODECINTERFACE_H_
17 #define ACSDK_CRYPTOINTERFACES_CRYPTOCODECINTERFACE_H_
18 
19 #include <vector>
20 
21 namespace alexaClientSDK {
22 namespace cryptoInterfaces {
23 
157 public:
160  typedef std::vector<unsigned char> DataBlock;
161 
164  typedef std::vector<unsigned char> Key;
165 
169  typedef std::vector<unsigned char> IV;
170 
173  typedef std::vector<unsigned char> Tag;
174 
176  virtual ~CryptoCodecInterface() noexcept = default;
177 
194  virtual bool init(const Key& key, const IV& iv) noexcept = 0;
195 
220  virtual bool processAAD(const DataBlock& dataIn) noexcept = 0;
221 
248  virtual bool processAAD(DataBlock::const_iterator dataInBegin, DataBlock::const_iterator dataInEnd) noexcept = 0;
249 
272  virtual bool process(const DataBlock& dataIn, DataBlock& dataOut) noexcept = 0;
273 
298  virtual bool process(
299  DataBlock::const_iterator dataInBegin,
300  DataBlock::const_iterator dataInEnd,
301  DataBlock& dataOut) noexcept = 0;
302 
326  virtual bool finalize(DataBlock& dataOut) noexcept = 0;
327 
344  virtual bool getTag(Tag& tag) noexcept = 0;
345 
362  virtual bool setTag(const Tag& tag) noexcept = 0;
363 };
364 
365 } // namespace cryptoInterfaces
366 } // namespace alexaClientSDK
367 
368 #endif // ACSDK_CRYPTOINTERFACES_CRYPTOCODECINTERFACE_H_
std::vector< unsigned char > Key
Key type. This type contains key bytes.
Definition: CryptoCodecInterface.h:164
virtual bool process(const DataBlock &dataIn, DataBlock &dataOut) noexcept=0
Encrypt or decrypt a data block.
std::vector< unsigned char > Tag
Tag vector type. Tag is used with AEAD mode of operation like with Galois/Counter mode...
Definition: CryptoCodecInterface.h:173
virtual bool setTag(const Tag &tag) noexcept=0
Sets tag for authenticated decryption.
virtual bool init(const Key &key, const IV &iv) noexcept=0
Initialize the codec.
virtual bool finalize(DataBlock &dataOut) noexcept=0
Complete data processing.
virtual bool getTag(Tag &tag) noexcept=0
Provides tag from authenticated encryption.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual bool processAAD(const DataBlock &dataIn) noexcept=0
Process AAD data block.
Crypto codec (cipher) interface.
Definition: CryptoCodecInterface.h:156
const
Definition: upload.py:398
std::vector< unsigned char > IV
Initialization vector type. Initialization vector contains data to initialize codec state before encr...
Definition: CryptoCodecInterface.h:169
std::vector< unsigned char > DataBlock
Data block type. This type represents a byte array.
Definition: CryptoCodecInterface.h:160
default
Definition: upload.py:394
virtual ~CryptoCodecInterface() noexcept=default
Default destructor.
static const std::string key
The database key to be used by the protocol given the METADATA object.
Definition: SharedAVSSettingProtocolTest.cpp:58

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