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

#include <PayloadIntegrityBlock.h>

Inheritance diagram for dtn::security::PayloadIntegrityBlock:
Collaboration diagram for dtn::security::PayloadIntegrityBlock:

List of all members.

Classes

class  Factory

Public Member Functions

virtual ~PayloadIntegrityBlock ()
virtual std::istream & deserialize (std::istream &stream, const size_t length)

Static Public Member Functions

static void sign (dtn::data::Bundle &bundle, const SecurityKey &key, const dtn::data::EID &destination)
static void verify (const dtn::data::Bundle &bundle, const SecurityKey &key)
static void strip (dtn::data::Bundle &bundle, const SecurityKey &key, const bool all=false)
static void strip (dtn::data::Bundle &bundle)

Static Public Attributes

static const char BLOCK_TYPE = SecurityBlock::PAYLOAD_INTEGRITY_BLOCK

Protected Member Functions

 PayloadIntegrityBlock ()
virtual size_t getSecurityResultSize () const

Friends

class dtn::data::Bundle

Detailed Description

Signs bundles for connections of security aware nodes. A factory with a rsa key can be created for signing or verifieing the bundle. From the bundle the primary block, the payload block, PayloadIntegrityBlock and the PayloadConfidentialBlock will be covered by the signature.
A sign can be added using the addHash()-Method. Verification can be done via one of the verify()-Methods.

Definition at line 22 of file PayloadIntegrityBlock.h.


Constructor & Destructor Documentation

frees the internal PKEY object, without deleting the rsa object given in the constructor

Definition at line 28 of file PayloadIntegrityBlock.cpp.

Constructs an empty PayloadIntegrityBlock in order for adding it to a bundle and sets its ciphersuite id to PIB_RSA_SHA256.

Definition at line 23 of file PayloadIntegrityBlock.cpp.

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


Member Function Documentation

std::istream & dtn::security::PayloadIntegrityBlock::deserialize ( std::istream &  stream,
const size_t  length 
) [virtual]

Parses the PayloadIntegrityBlock from a Stream

Parameters:
streamthe stream to read from

Reimplemented from dtn::security::SecurityBlock.

Definition at line 205 of file PayloadIntegrityBlock.cpp.

References dtn::security::SecurityBlock::_security_result, and dtn::security::SecurityBlock::TLVList::getLength().

Here is the call graph for this function:

size_t dtn::security::PayloadIntegrityBlock::getSecurityResultSize ( ) const [protected, virtual]

Returns the size of the security result field. This is used for strict canonicalisation, where the block itself is included to the canonical form, but the security result is excluded or unknown.

Reimplemented from dtn::security::SecurityBlock.

Definition at line 32 of file PayloadIntegrityBlock.cpp.

void dtn::security::PayloadIntegrityBlock::sign ( dtn::data::Bundle bundle,
const SecurityKey key,
const dtn::data::EID destination 
) [static]
void dtn::security::PayloadIntegrityBlock::strip ( dtn::data::Bundle bundle,
const SecurityKey key,
const bool  all = false 
) [static]

Seeks for a valid PIB in the stack and removes all blocks above and the PIB block itself.

Parameters:
bundlethe bundle to be tested
Returns:
the number of removed blocks

Definition at line 161 of file PayloadIntegrityBlock.cpp.

References dtn::data::Bundle::getBlocks(), dtn::data::Bundle::remove(), and verify().

Referenced by dtn::security::SecurityManager::verifyPIB().

Here is the call graph for this function:

Removes all PayloadIntegrityBlocks from a bundle

Parameters:
bundlethe bundle, which shall be cleaned from pibs

Definition at line 196 of file PayloadIntegrityBlock.cpp.

References dtn::data::Bundle::getBlocks(), and dtn::data::Bundle::remove().

Here is the call graph for this function:

void dtn::security::PayloadIntegrityBlock::verify ( const dtn::data::Bundle bundle,
const SecurityKey key 
) [static]

Tests if the bundles signatures is correct. There might be multiple PIBs inside the bundle, which may be tested and the result will be 1 if one matches.

Parameters:
bundlethe bundle to be checked
Returns:
-1 if an error occured, 0 if the signature does not match, 1 if the signature matches

Definition at line 129 of file PayloadIntegrityBlock.cpp.

References dtn::data::Bundle::getBlocks().

Referenced by strip(), and dtn::security::SecurityManager::verifyPIB().

Here is the call graph for this function:


Friends And Related Function Documentation

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

Definition at line 24 of file PayloadIntegrityBlock.h.


Member Data Documentation

The block type of this class.

Definition at line 35 of file PayloadIntegrityBlock.h.


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