IBR-DTNSuite  0.8
dtn::security::ExtensionSecurityBlock Class Reference

#include <ExtensionSecurityBlock.h>

Inheritance diagram for dtn::security::ExtensionSecurityBlock:
Collaboration diagram for dtn::security::ExtensionSecurityBlock:

List of all members.

Classes

class  Factory

Public Member Functions

virtual ~ExtensionSecurityBlock ()

Static Public Member Functions

static void encrypt (dtn::data::Bundle &bundle, const SecurityKey &key, const dtn::data::Block &block, const dtn::data::EID &source, const dtn::data::EID &destination)
static void decrypt (dtn::data::Bundle &bundle, const SecurityKey &key, const dtn::security::ExtensionSecurityBlock &block)
static void decrypt (dtn::data::Bundle &bundle, const SecurityKey &key, u_int64_t correlator=0)

Static Public Attributes

static const char BLOCK_TYPE = SecurityBlock::EXTENSION_SECURITY_BLOCK

Protected Member Functions

 ExtensionSecurityBlock ()

Friends

class dtn::data::Bundle

Detailed Description

Encrypts ExtensionBlocks and replaces them with an ExtensionSecurityBlock, which stores the ciphertext in its security result, which means that there should not be a payloadblock encrypted. You can instantiate a factory of this class with a rsa key and the node belonging to this key. Encryption is done with AES128. The AES-Key will be encrypted using the rsa key and placed into the security parameters.
You can encrypt one or a series of blocks using the encryptBlock() method. Encryption is done with the decryptBlock() method.
Take care which kind of rsa key is given to this class. You can instantiate it with a public rsa key, but decryption will fail with it and you only notice it, when your programm breaks.

Definition at line 24 of file ExtensionSecurityBlock.h.


Constructor & Destructor Documentation

Creates an empty ExtensionSecurityBlock and sets its ciphersuite id to ESB_RSA_AES128_EXT

Definition at line 21 of file ExtensionSecurityBlock.cpp.

Referenced by dtn::security::ExtensionSecurityBlock::Factory::create().


Member Function Documentation

Decrypts the given block and replaces the ESB with the original block in the bundle. This block must carry the symmetric AES key, which was used to decrypt, and not be correlated.

Parameters:
bundlethe bundle to which block belongs
blockthe to be decrypted block
Returns:
true if block decryption succeeded and the block has been replaced, false otherwise. when false the encrypted block will remain as it was

Definition at line 56 of file ExtensionSecurityBlock.cpp.

References dtn::security::SecurityBlock::_ciphersuite_params, dtn::security::SecurityBlock::decryptBlock(), dtn::security::SecurityBlock::getKey(), dtn::security::SecurityKey::getRSA(), dtn::security::SecurityBlock::getSalt(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_ex, ibrcommon::AES128Stream::key_size_in_bytes, and dtn::security::SecurityBlock::salt.

Referenced by decrypt().

Here is the call graph for this function:

void dtn::security::ExtensionSecurityBlock::decrypt ( dtn::data::Bundle bundle,
const SecurityKey key,
u_int64_t  correlator = 0 
) [static]

Decrypts all blocks in the bundle which have correlator as their correlatorvalue set. Assuming that they belong together, with first block carrying the key information.

Parameters:
bundlethe bundle to which the blocks belong to
correlatorthe correlator which have the blocks set
Returns:
true if block decryption succeeded and the blocks have been replaced, false otherwise. when false the old blocks will remain intakt. But be carefull. If from a series of blocks one block fails, this single block will remain encrypted inside the bundle. the other blocks will decrypted, so recovering the failed block may be impossible.

Definition at line 76 of file ExtensionSecurityBlock.cpp.

References dtn::security::SecurityBlock::_correlator, decrypt(), and dtn::data::Bundle::getBlocks().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class dtn::data::Bundle [friend]

This class is allowed to call the parameterless contructor and the constructor with the bundle parameter.

Definition at line 30 of file ExtensionSecurityBlock.h.


Member Data Documentation

The block type of this class.

Definition at line 41 of file ExtensionSecurityBlock.h.


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