IBR-DTNSuite  0.10
ibrcommon::CipherStream Class Referenceabstract

#include <CipherStream.h>

Inheritance diagram for ibrcommon::CipherStream:
Inheritance graph
Collaboration diagram for ibrcommon::CipherStream:
Collaboration graph

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 32 of file CipherStream.h.

Member Enumeration Documentation

Enumerator
CIPHER_ENCRYPT 
CIPHER_DECRYPT 

Definition at line 35 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 26 of file CipherStream.cpp.

ibrcommon::CipherStream::~CipherStream ( )
virtual

Definition at line 32 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 60 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 
)
protectedpure virtual
virtual void ibrcommon::CipherStream::decrypt_final ( )
inlineprotectedvirtual

Definition at line 66 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 36 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 
)
protectedpure virtual
virtual void ibrcommon::CipherStream::encrypt_final ( )
inlineprotectedvirtual

Definition at line 65 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())
protectedvirtual

Definition at line 105 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 ( )
protectedvirtual

Definition at line 84 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

CipherMode ibrcommon::CipherStream::_mode
protected

Definition at line 71 of file CipherStream.h.

Referenced by overflow(), and sync().


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