AWS SDK for C++  1.9.159
AWS SDK for C++
Public Member Functions | List of all members
Aws::Utils::Crypto::SymmetricCryptoStream Class Reference

#include <CryptoStream.h>

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

Public Member Functions

 SymmetricCryptoStream (Aws::IStream &src, CipherMode mode, SymmetricCipher &cipher, size_t bufLen=DEFAULT_BUF_SIZE)
 
 SymmetricCryptoStream (Aws::OStream &sink, CipherMode mode, SymmetricCipher &cipher, size_t bufLen=DEFAULT_BUF_SIZE, int16_t blockOffset=0)
 
 SymmetricCryptoStream (Aws::Utils::Crypto::SymmetricCryptoBufSrc &bufSrc)
 
 SymmetricCryptoStream (Aws::Utils::Crypto::SymmetricCryptoBufSink &bufSink)
 
 SymmetricCryptoStream (const SymmetricCryptoStream &)=delete
 
 SymmetricCryptoStream (SymmetricCryptoStream &&)=delete
 
virtual ~SymmetricCryptoStream ()
 
SymmetricCryptoStreamoperator= (const SymmetricCryptoStream &)=delete
 
SymmetricCryptoStreamoperator= (SymmetricCryptoStream &&)=delete
 
void Finalize ()
 

Detailed Description

IOStream that can either take a src buffer as an input stream and create a wrapper iostream that can be used to receive encrypted or decrypted input.

A common use case is a file that is encrypted on disk being read via ifstream and then read decrypted into memory. Or you could send a plain text file through an iostream and have it encrypted when the stream is read.

This stream is seekable, but it is very expensive to seek backwards since we have to reset the cipher and re-encrypt everything up to that point. So seeking should be avoided if at all possible.

Or it can be used in the opposite direction where the stream is a sink and all input to the stream will be encrypted or decrypted and then sent to the sink stream.

This is particularly useful when receiving an encrypted file over the internet and writing it decrypted to disk. Another case may be that you have an ofstream and you want to write text to it from your program but have it go encrypted to disk.

In output mode, this stream is not seekable.

Definition at line 35 of file CryptoStream.h.

Constructor & Destructor Documentation

◆ SymmetricCryptoStream() [1/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( Aws::IStream src,
CipherMode  mode,
SymmetricCipher cipher,
size_t  bufLen = DEFAULT_BUF_SIZE 
)

src stream to read from and encrypt or decrypt in transit mode of operation for cipher encryption or decryption cipher to use on the data

◆ SymmetricCryptoStream() [2/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( Aws::OStream sink,
CipherMode  mode,
SymmetricCipher cipher,
size_t  bufLen = DEFAULT_BUF_SIZE,
int16_t  blockOffset = 0 
)

sink stream to write the data to and encrypt or decrypt in transit mode of operation for cipher encryption or decryption cipher to use on the data

◆ SymmetricCryptoStream() [3/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( Aws::Utils::Crypto::SymmetricCryptoBufSrc bufSrc)

bufSrc streambuf to use

◆ SymmetricCryptoStream() [4/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( Aws::Utils::Crypto::SymmetricCryptoBufSink bufSink)

bufSink streambuf to use

◆ SymmetricCryptoStream() [5/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( const SymmetricCryptoStream )
delete

◆ SymmetricCryptoStream() [6/6]

Aws::Utils::Crypto::SymmetricCryptoStream::SymmetricCryptoStream ( SymmetricCryptoStream &&  )
delete

◆ ~SymmetricCryptoStream()

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

Member Function Documentation

◆ Finalize()

void Aws::Utils::Crypto::SymmetricCryptoStream::Finalize ( )

Call this in output stream mode when you want to flush the output to file. It will be called by the destructor, but if you want to sync before then, call this method. This stream is unusable after this method has been called.

◆ operator=() [1/2]

SymmetricCryptoStream& Aws::Utils::Crypto::SymmetricCryptoStream::operator= ( const SymmetricCryptoStream )
delete

◆ operator=() [2/2]

SymmetricCryptoStream& Aws::Utils::Crypto::SymmetricCryptoStream::operator= ( SymmetricCryptoStream &&  )
delete

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