AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
KeyStoreInterface.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_KEYSTOREINTERFACE_H_
17 #define ACSDK_CRYPTOINTERFACES_KEYSTOREINTERFACE_H_
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "AlgorithmType.h"
24 
25 namespace alexaClientSDK {
26 namespace cryptoInterfaces {
27 
48 public:
50  typedef std::vector<unsigned char> DataBlock;
51 
53  typedef std::vector<unsigned char> IV;
54 
56  typedef std::vector<unsigned char> KeyChecksum;
57 
60  typedef std::vector<unsigned char> Tag;
61 
63  virtual ~KeyStoreInterface() noexcept = default;
64 
83  virtual bool encrypt(
84  const std::string& keyAlias,
86  const IV& iv,
87  const DataBlock& plaintext,
88  KeyChecksum& checksum,
89  DataBlock& ciphertext) noexcept = 0;
90 
118  virtual bool encryptAE(
119  const std::string& keyAlias,
120  AlgorithmType type,
121  const IV& iv,
122  const DataBlock& aad,
123  const DataBlock& plaintext,
124  KeyChecksum& checksum,
125  DataBlock& ciphertext,
126  Tag& tag) noexcept = 0;
127 
147  virtual bool decrypt(
148  const std::string& keyAlias,
149  AlgorithmType type,
150  const KeyChecksum& checksum,
151  const IV& iv,
152  const DataBlock& ciphertext,
153  DataBlock& plaintext) noexcept = 0;
154 
182  virtual bool decryptAD(
183  const std::string& keyAlias,
184  AlgorithmType type,
185  const KeyChecksum& checksum,
186  const IV& iv,
187  const DataBlock& aad,
188  const DataBlock& ciphertext,
189  const Tag& tag,
190  DataBlock& plaintext) noexcept = 0;
191 
205  virtual bool getDefaultKeyAlias(std::string& keyAlias) noexcept = 0;
206 };
207 
208 } // namespace cryptoInterfaces
209 } // namespace alexaClientSDK
210 
211 #endif // ACSDK_CRYPTOINTERFACES_KEYSTOREINTERFACE_H_
virtual bool encryptAE(const std::string &keyAlias, AlgorithmType type, const IV &iv, const DataBlock &aad, const DataBlock &plaintext, KeyChecksum &checksum, DataBlock &ciphertext, Tag &tag) noexcept=0
Encrypts data block using authenticated encryption algorithm.
std::vector< unsigned char > Tag
Data type for tag. Tag (known as Message Authentication Code) is used with AEAD mode of operation lik...
Definition: KeyStoreInterface.h:60
Definition: CapabilityConfiguration.h:190
std::vector< unsigned char > KeyChecksum
Data type for key checksum.
Definition: KeyStoreInterface.h:56
virtual bool getDefaultKeyAlias(std::string &keyAlias) noexcept=0
Returns default key alias.
virtual ~KeyStoreInterface() noexcept=default
Default destructor.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Key Store Interface.
Definition: KeyStoreInterface.h:47
virtual bool decryptAD(const std::string &keyAlias, AlgorithmType type, const KeyChecksum &checksum, const IV &iv, const DataBlock &aad, const DataBlock &ciphertext, const Tag &tag, DataBlock &plaintext) noexcept=0
Decrypts data block using authenticated decryption algorithm.
type
Definition: upload.py:443
const
Definition: upload.py:398
virtual bool decrypt(const std::string &keyAlias, AlgorithmType type, const KeyChecksum &checksum, const IV &iv, const DataBlock &ciphertext, DataBlock &plaintext) noexcept=0
Decrypts data block.
AlgorithmType
Enumeration of all supported encryption protocols.
Definition: AlgorithmType.h:31
std::vector< unsigned char > DataBlock
Data type for data block (encrypted or unencrypted).
Definition: KeyStoreInterface.h:50
std::vector< unsigned char > IV
Data type for initialization vector data.
Definition: KeyStoreInterface.h:53
default
Definition: upload.py:394
virtual bool encrypt(const std::string &keyAlias, AlgorithmType type, const IV &iv, const DataBlock &plaintext, KeyChecksum &checksum, DataBlock &ciphertext) noexcept=0
Encrypts data block.

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