IBR-DTNSuite
0.8
|
#include <CipherStream.h>
Public Types | |
enum | CipherMode { CIPHER_ENCRYPT = 0, CIPHER_DECRYPT = 1 } |
Public Member Functions | |
CipherStream (std::ostream &stream, const CipherMode mode=CIPHER_DECRYPT, const size_t buffer=2048) | |
virtual | ~CipherStream () |
void | encrypt (std::iostream &stream) |
void | decrypt (std::iostream &stream) |
Protected Member Functions | |
virtual void | encrypt (char *buf, const size_t size)=0 |
virtual void | decrypt (char *buf, const size_t size)=0 |
virtual void | encrypt_final () |
virtual void | decrypt_final () |
virtual int | sync () |
virtual std::char_traits< char > ::int_type | overflow (std::char_traits< char >::int_type=std::char_traits< char >::eof()) |
Protected Attributes | |
CipherMode | _mode |
Definition at line 17 of file CipherStream.h.
Definition at line 20 of file CipherStream.h.
ibrcommon::CipherStream::CipherStream | ( | std::ostream & | stream, |
const CipherMode | mode = CIPHER_DECRYPT , |
||
const size_t | buffer = 2048 |
||
) |
Definition at line 12 of file CipherStream.cpp.
ibrcommon::CipherStream::~CipherStream | ( | ) | [virtual] |
Definition at line 18 of file CipherStream.cpp.
void ibrcommon::CipherStream::decrypt | ( | std::iostream & | stream | ) |
* decrypt a seekable stream by reading and writing into the same stream
stream | |
key | |
salt | |
iv | |
tag |
Definition at line 47 of file CipherStream.cpp.
References decrypt_final().
Referenced by overflow().
virtual void ibrcommon::CipherStream::decrypt | ( | char * | buf, |
const size_t | size | ||
) | [protected, pure virtual] |
Implemented in ibrcommon::AES128Stream, and ibrcommon::XORStream.
virtual void ibrcommon::CipherStream::decrypt_final | ( | ) | [inline, protected, virtual] |
Definition at line 51 of file CipherStream.h.
void ibrcommon::CipherStream::encrypt | ( | std::iostream & | stream | ) |
encrypt a seekable stream by reading and writing into the same stream
stream | |
key | |
salt |
Definition at line 23 of file CipherStream.cpp.
References encrypt_final().
Referenced by overflow().
virtual void ibrcommon::CipherStream::encrypt | ( | char * | buf, |
const size_t | size | ||
) | [protected, pure virtual] |
Implemented in ibrcommon::AES128Stream, and ibrcommon::XORStream.
virtual void ibrcommon::CipherStream::encrypt_final | ( | ) | [inline, protected, virtual] |
Definition at line 50 of file CipherStream.h.
std::char_traits< char >::int_type ibrcommon::CipherStream::overflow | ( | std::char_traits< char >::int_type | c = std::char_traits<char>::eof() | ) | [protected, virtual] |
Definition at line 92 of file CipherStream.cpp.
References _mode, CIPHER_DECRYPT, CIPHER_ENCRYPT, decrypt(), and encrypt().
Referenced by sync().
int ibrcommon::CipherStream::sync | ( | ) | [protected, virtual] |
Definition at line 71 of file CipherStream.cpp.
References _mode, CIPHER_DECRYPT, CIPHER_ENCRYPT, decrypt_final(), encrypt_final(), and overflow().
CipherMode ibrcommon::CipherStream::_mode [protected] |
Definition at line 56 of file CipherStream.h.
Referenced by overflow(), and sync().