42 #ifndef _DWMXCHACHA20POLY1305OUTBUFFER_HH_ 43 #define _DWMXCHACHA20POLY1305OUTBUFFER_HH_ 48 #include <cryptopp/cryptlib.h> 49 #include <cryptopp/chachapoly.h> 50 #include <cryptopp/osrng.h> 54 namespace XChaCha20Poly1305 {
70 :
public std::streambuf
76 OutBuffer(std::ostream & os,
const std::string & key);
79 int_type overflow(int_type c)
override;
81 std::streamsize xsputn(
const char *p, std::streamsize n)
override;
85 CryptoPP::byte _key[32];
86 CryptoPP::byte _iv[24];
87 CryptoPP::AutoSeededRandomPool _rng;
88 CryptoPP::XChaCha20Poly1305::Encryption _encryptor;
89 std::unique_ptr<CryptoPP::AuthenticatedEncryptionFilter> _aef;
98 #endif // _DWMXCHACHA20POLY1305OUTBUFFER_HH_ This class is a helper for encrypted stream output.
Definition: DwmXChaCha20Poly1305OutBuffer.hh:69
OutBuffer(std::ostream &os, const std::string &key)
Construct with the given ostream os and encryption key key.