Class Poco::Crypto::CryptoOutputStream
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Crypto

# class CryptoOutputStream

Library: Crypto
Package: Cipher
Header: Poco/Crypto/CryptoStream.h

## Description

This stream transforms all data passing through it using the given CryptoTransform.

Use a CryptoTransform object provided by Cipher::createEncrytor() or Cipher::createDecryptor() to create an encrypting or decrypting stream, respectively.

After all data has been passed through the stream, close() must be called to ensure completion of cryptographic transformation.

## Inheritance

Direct Base Classes: CryptoIOS, std::ostream

All Base Classes: CryptoIOS, std::ios, std::ostream

## Member Summary

Member Functions: close

Inherited Functions: rdbuf

## Constructors

### CryptoOutputStream

CryptoOutputStream(
std::ostream & ostr,
CryptoTransform * pTransform,
std::streamsize bufferSize = 8192
);

Create a new CryptoOutputStream object. The CryptoOutputStream takes the ownership of the given CryptoTransform object.

### CryptoOutputStream

CryptoOutputStream(
std::ostream & ostr,
Cipher & cipher,
std::streamsize bufferSize = 8192
);

Create a new decrypting CryptoOutputStream object using the given cipher.

## Destructor

### ~CryptoOutputStream

~CryptoOutputStream();

Destroys the CryptoOutputStream.

## Member Functions

### close

void close();

Flushes all buffers and finishes the encryption.