IBR-DTNSuite  0.8
ibrcommon::CipherStream Class Reference

#include <CipherStream.h>

Inheritance diagram for ibrcommon::CipherStream:

List of all members.

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

Detailed Description

Definition at line 17 of file CipherStream.h.


Member Enumeration Documentation

Enumerator:
CIPHER_ENCRYPT 
CIPHER_DECRYPT 

Definition at line 20 of file CipherStream.h.


Constructor & Destructor Documentation

ibrcommon::CipherStream::CipherStream ( std::ostream &  stream,
const CipherMode  mode = CIPHER_DECRYPT,
const size_t  buffer = 2048 
)

Definition at line 12 of file CipherStream.cpp.

Definition at line 18 of file CipherStream.cpp.


Member Function Documentation

void ibrcommon::CipherStream::decrypt ( std::iostream &  stream)

* decrypt a seekable stream by reading and writing into the same stream

Parameters:
stream
key
salt
iv
tag

Definition at line 47 of file CipherStream.cpp.

References decrypt_final().

Referenced by overflow().

Here is the call graph for this function:

virtual void ibrcommon::CipherStream::decrypt ( char *  buf,
const size_t  size 
) [protected, pure virtual]
virtual void ibrcommon::CipherStream::decrypt_final ( ) [inline, protected, virtual]

Definition at line 51 of file CipherStream.h.

Referenced by decrypt(), and sync().

void ibrcommon::CipherStream::encrypt ( std::iostream &  stream)

encrypt a seekable stream by reading and writing into the same stream

Parameters:
stream
key
salt

Definition at line 23 of file CipherStream.cpp.

References encrypt_final().

Referenced by overflow().

Here is the call graph for this function:

virtual void ibrcommon::CipherStream::encrypt ( char *  buf,
const size_t  size 
) [protected, pure virtual]
virtual void ibrcommon::CipherStream::encrypt_final ( ) [inline, protected, virtual]

Definition at line 50 of file CipherStream.h.

Referenced by encrypt(), and sync().

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:


Member Data Documentation

Definition at line 56 of file CipherStream.h.

Referenced by overflow(), and sync().


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