8#include <aws/core/Core_EXPORTS.h>
9#include <aws/core/utils/Array.h>
10#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
36 m_initializationVector(ivSize > 0 ? GenerateIV(ivSize, ivGenerationInCtrMode) : 0),
46 m_initializationVector(initializationVector),
56 m_key(std::move(key)),
57 m_initializationVector(std::move(initializationVector)),
58 m_tag(std::move(tag)),
72 m_key(std::move(toMove.m_key)),
73 m_initializationVector(std::move(toMove.m_initializationVector)),
74 m_tag(std::move(toMove.m_tag)),
75 m_failure(toMove.m_failure)
86 m_key = std::move(toMove.m_key);
87 m_initializationVector = std::move(toMove.m_initializationVector);
88 m_tag = std::move(toMove.m_tag);
89 m_failure = toMove.m_failure;
100 virtual operator bool()
const {
return Good(); }
139 bool Fail()
const {
return m_failure; }
140 virtual bool Good()
const {
return !Fail(); }
virtual std::shared_ptr< SymmetricCipher > CreateImplementation(const CryptoBuffer &key) const =0
virtual std::shared_ptr< SymmetricCipher > CreateImplementation(const CryptoBuffer &key, const CryptoBuffer &iv, const CryptoBuffer &tag=CryptoBuffer(0), const CryptoBuffer &aad=CryptoBuffer(0)) const =0
virtual std::shared_ptr< SymmetricCipher > CreateImplementation(const CryptoBuffer &key, const CryptoBuffer *) const
virtual std::shared_ptr< SymmetricCipher > CreateImplementation(CryptoBuffer &&key, CryptoBuffer &&iv, CryptoBuffer &&tag=CryptoBuffer(0), CryptoBuffer &&aad=CryptoBuffer(0)) const =0
virtual ~SymmetricCipherFactory()
virtual void InitStaticState()
virtual void CleanupStaticState()
SymmetricCipher(const SymmetricCipher &other)=delete
virtual CryptoBuffer EncryptBuffer(const CryptoBuffer &unEncryptedData)=0
SymmetricCipher(const CryptoBuffer &key, const CryptoBuffer &initializationVector, const CryptoBuffer &tag=CryptoBuffer(0))
SymmetricCipher(CryptoBuffer &&key, CryptoBuffer &&initializationVector, CryptoBuffer &&tag=CryptoBuffer(0))
virtual bool Good() const
CryptoBuffer m_initializationVector
SymmetricCipher(const CryptoBuffer &key, size_t ivSize, bool ivGenerationInCtrMode=false)
virtual CryptoBuffer FinalizeEncryption()=0
virtual CryptoBuffer DecryptBuffer(const CryptoBuffer &encryptedData)=0
const CryptoBuffer & GetTag() const
virtual CryptoBuffer FinalizeDecryption()=0
static CryptoBuffer GenerateKey(size_t keyLengthBytes=SYMMETRIC_KEY_LENGTH)
SymmetricCipher & operator=(const SymmetricCipher &other)=delete
SymmetricCipher(SymmetricCipher &&toMove)
static CryptoBuffer GenerateIV(size_t ivLengthBytes, bool ctrMode=false)
virtual ~SymmetricCipher()=default
SymmetricCipher & operator=(SymmetricCipher &&toMove)
const CryptoBuffer & GetIV() const
static const size_t SYMMETRIC_KEY_LENGTH
static const size_t MIN_IV_LENGTH
AWS_CORE_API CryptoBuffer IncrementCTRCounter(const CryptoBuffer &counter, uint32_t numberOfBlocks)