15 #ifndef ENCRYPTSTREAMBUF_H
16 #define ENCRYPTSTREAMBUF_H
18 #include "dtoolbase.h"
23 #include "openssl/evp.h"
30 class EXPCL_DTOOLCONFIG EncryptStreamBuf :
public streambuf {
33 virtual ~EncryptStreamBuf();
35 void open_read(istream *source,
bool owns_source,
const string &password);
38 void open_write(ostream *dest,
bool owns_dest,
const string &password);
41 INLINE
void set_algorithm(
const string &algorithm);
42 INLINE
const string &get_algorithm()
const;
44 INLINE
void set_key_length(
int key_length);
45 INLINE
int get_key_length()
const;
47 INLINE
void set_iteration_count(
int iteration_count);
48 INLINE
int get_iteration_count()
const;
51 virtual int overflow(
int c);
53 virtual int underflow();
56 size_t read_chars(
char *start,
size_t length);
57 void write_chars(
const char *start,
size_t length);
71 EVP_CIPHER_CTX _read_ctx;
72 size_t _read_block_size;
73 unsigned char *_read_overflow_buffer;
74 size_t _in_read_overflow_buffer;
77 EVP_CIPHER_CTX _write_ctx;
78 size_t _write_block_size;
81 #include "encryptStreamBuf.I"
83 #endif // HAVE_OPENSSL