AWS SDK for C++  1.9.103
AWS SDK for C++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Aws::Utils::Crypto::OpenSSLCipher Class Referenceabstract

#include <CryptoImpl.h>

+ Inheritance diagram for Aws::Utils::Crypto::OpenSSLCipher:

Public Member Functions

 OpenSSLCipher (const CryptoBuffer &key, size_t ivSize, bool ctrMode=false)
 
 OpenSSLCipher (CryptoBuffer &&key, CryptoBuffer &&initializationVector, CryptoBuffer &&tag=CryptoBuffer(0))
 
 OpenSSLCipher (const CryptoBuffer &key, const CryptoBuffer &initializationVector, const CryptoBuffer &tag=CryptoBuffer(0))
 
 OpenSSLCipher (const OpenSSLCipher &other)=delete
 
OpenSSLCipheroperator= (const OpenSSLCipher &other)=delete
 
 OpenSSLCipher (OpenSSLCipher &&toMove)
 
OpenSSLCipheroperator= (OpenSSLCipher &&toMove)=default
 
virtual ~OpenSSLCipher ()
 
CryptoBuffer EncryptBuffer (const CryptoBuffer &unEncryptedData) override
 
CryptoBuffer FinalizeEncryption () override
 
CryptoBuffer DecryptBuffer (const CryptoBuffer &encryptedData) override
 
CryptoBuffer FinalizeDecryption () override
 
void Reset () override
 
- Public Member Functions inherited from Aws::Utils::Crypto::SymmetricCipher
 SymmetricCipher (const CryptoBuffer &key, size_t ivSize, bool ivGenerationInCtrMode=false)
 
 SymmetricCipher (const CryptoBuffer &key, const CryptoBuffer &initializationVector, const CryptoBuffer &tag=CryptoBuffer(0))
 
 SymmetricCipher (CryptoBuffer &&key, CryptoBuffer &&initializationVector, CryptoBuffer &&tag=CryptoBuffer(0))
 
 SymmetricCipher (const SymmetricCipher &other)=delete
 
SymmetricCipheroperator= (const SymmetricCipher &other)=delete
 
 SymmetricCipher (SymmetricCipher &&toMove)
 
SymmetricCipheroperator= (SymmetricCipher &&toMove)
 
virtual ~SymmetricCipher ()=default
 
virtual operator bool () const
 
const CryptoBufferGetIV () const
 
const CryptoBufferGetTag () const
 
bool Fail () const
 
bool Good () const
 

Protected Member Functions

virtual size_t GetBlockSizeBytes () const =0
 
virtual size_t GetKeyLengthBits () const =0
 
bool CheckKeyAndIVLength (size_t expectedKeyLength, size_t expectedIVLength)
 
- Protected Member Functions inherited from Aws::Utils::Crypto::SymmetricCipher
 SymmetricCipher ()
 

Protected Attributes

EVP_CIPHER_CTX * m_encryptor_ctx
 
EVP_CIPHER_CTX * m_decryptor_ctx
 
- Protected Attributes inherited from Aws::Utils::Crypto::SymmetricCipher
CryptoBuffer m_key
 
CryptoBuffer m_initializationVector
 
CryptoBuffer m_tag
 
bool m_failure
 

Additional Inherited Members

- Static Public Member Functions inherited from Aws::Utils::Crypto::SymmetricCipher
static CryptoBuffer GenerateIV (size_t ivLengthBytes, bool ctrMode=false)
 
static CryptoBuffer GenerateKey (size_t keyLengthBytes=SYMMETRIC_KEY_LENGTH)
 

Detailed Description

OpenSSL implementation for SymmetricCipher

Definition at line 109 of file CryptoImpl.h.

Constructor & Destructor Documentation

◆ OpenSSLCipher() [1/5]

Aws::Utils::Crypto::OpenSSLCipher::OpenSSLCipher ( const CryptoBuffer key,
size_t  ivSize,
bool  ctrMode = false 
)

Creates new OpenSSL based cipher for key, and autogenerates a secure IV of size ivSize

◆ OpenSSLCipher() [2/5]

Aws::Utils::Crypto::OpenSSLCipher::OpenSSLCipher ( CryptoBuffer &&  key,
CryptoBuffer &&  initializationVector,
CryptoBuffer &&  tag = CryptoBuffer(0) 
)

Creates new OpenSSL based cipher for key, initializationVector, and optional tag. If this is an authenticated cipher being used for decryption.

◆ OpenSSLCipher() [3/5]

Aws::Utils::Crypto::OpenSSLCipher::OpenSSLCipher ( const CryptoBuffer key,
const CryptoBuffer initializationVector,
const CryptoBuffer tag = CryptoBuffer(0) 
)

Creates new OpenSSL based cipher for key, initializationVector, and optional tag. If this is an authenticated cipher being used for decryption.

◆ OpenSSLCipher() [4/5]

Aws::Utils::Crypto::OpenSSLCipher::OpenSSLCipher ( const OpenSSLCipher other)
delete

◆ OpenSSLCipher() [5/5]

Aws::Utils::Crypto::OpenSSLCipher::OpenSSLCipher ( OpenSSLCipher &&  toMove)

Normally we don't work around VS 2013 not auto-generating these, but they are kind of expensive, so let's go ahead and optimize by defining default move operations. Implementors of this class need to be sure to define the move operations and call the base class.

◆ ~OpenSSLCipher()

virtual Aws::Utils::Crypto::OpenSSLCipher::~OpenSSLCipher ( )
virtual

Member Function Documentation

◆ CheckKeyAndIVLength()

bool Aws::Utils::Crypto::OpenSSLCipher::CheckKeyAndIVLength ( size_t  expectedKeyLength,
size_t  expectedIVLength 
)
protected

◆ DecryptBuffer()

CryptoBuffer Aws::Utils::Crypto::OpenSSLCipher::DecryptBuffer ( const CryptoBuffer encryptedData)
overridevirtual

Decrypt a buffer of data. Part of the contract for this interface is that intention that a user call this function multiple times for a large stream. As such, multiple calls to this function on the same instance should produce valid sequential output from an encrypted stream.

Implements Aws::Utils::Crypto::SymmetricCipher.

Reimplemented in Aws::Utils::Crypto::AES_KeyWrap_Cipher_OpenSSL.

◆ EncryptBuffer()

CryptoBuffer Aws::Utils::Crypto::OpenSSLCipher::EncryptBuffer ( const CryptoBuffer unEncryptedData)
overridevirtual

Encrypt a buffer of data. Part of the contract for this interface is that intention that a user call this function multiple times for a large stream. As such, multiple calls to this function on the same instance should produce valid sequential output for an encrypted stream.

Implements Aws::Utils::Crypto::SymmetricCipher.

Reimplemented in Aws::Utils::Crypto::AES_KeyWrap_Cipher_OpenSSL.

◆ FinalizeDecryption()

CryptoBuffer Aws::Utils::Crypto::OpenSSLCipher::FinalizeDecryption ( )
overridevirtual

Finalize Decryption, returns anything remaining in the last block

Implements Aws::Utils::Crypto::SymmetricCipher.

Reimplemented in Aws::Utils::Crypto::AES_KeyWrap_Cipher_OpenSSL.

◆ FinalizeEncryption()

CryptoBuffer Aws::Utils::Crypto::OpenSSLCipher::FinalizeEncryption ( )
overridevirtual

Finalize Encryption, returns anything remaining in the last block

Implements Aws::Utils::Crypto::SymmetricCipher.

Reimplemented in Aws::Utils::Crypto::AES_KeyWrap_Cipher_OpenSSL, and Aws::Utils::Crypto::AES_GCM_Cipher_OpenSSL.

◆ GetBlockSizeBytes()

virtual size_t Aws::Utils::Crypto::OpenSSLCipher::GetBlockSizeBytes ( ) const
protectedpure virtual

◆ GetKeyLengthBits()

virtual size_t Aws::Utils::Crypto::OpenSSLCipher::GetKeyLengthBits ( ) const
protectedpure virtual

◆ operator=() [1/2]

OpenSSLCipher& Aws::Utils::Crypto::OpenSSLCipher::operator= ( const OpenSSLCipher other)
delete

◆ operator=() [2/2]

OpenSSLCipher& Aws::Utils::Crypto::OpenSSLCipher::operator= ( OpenSSLCipher &&  toMove)
default

Normally we don't work around VS 2013 not auto-generating these, but they are kind of expensive, so let's go ahead and optimize by defining default move operations. Implementors of this class need to be sure to define the move operations and call the base class.

◆ Reset()

void Aws::Utils::Crypto::OpenSSLCipher::Reset ( )
overridevirtual

Member Data Documentation

◆ m_decryptor_ctx

EVP_CIPHER_CTX* Aws::Utils::Crypto::OpenSSLCipher::m_decryptor_ctx
protected

Definition at line 184 of file CryptoImpl.h.

◆ m_encryptor_ctx

EVP_CIPHER_CTX* Aws::Utils::Crypto::OpenSSLCipher::m_encryptor_ctx
protected

Definition at line 183 of file CryptoImpl.h.


The documentation for this class was generated from the following file: