IBR-DTNSuite
0.12
|
#include <PayloadIntegrityBlock.h>
Classes | |
class | Factory |
Public Member Functions | |
virtual | ~PayloadIntegrityBlock () |
virtual std::istream & | deserialize (std::istream &stream, const dtn::data::Length &length) |
Public Member Functions inherited from dtn::security::SecurityBlock | |
virtual | ~SecurityBlock ()=0 |
virtual dtn::data::Length | getLength () const |
virtual dtn::data::Length | getLength_mutable () const |
virtual std::ostream & | serialize (std::ostream &stream, dtn::data::Length &length) const |
virtual std::ostream & | serialize_strict (std::ostream &stream, dtn::data::Length &length) const |
const dtn::data::EID | getSecuritySource () const |
const dtn::data::EID | getSecurityDestination () const |
void | setSecuritySource (const dtn::data::EID &source) |
void | setSecurityDestination (const dtn::data::EID &destination) |
bool | isSecuritySource (const dtn::data::Bundle &, const dtn::data::EID &) const |
bool | isSecurityDestination (const dtn::data::Bundle &, const dtn::data::EID &) const |
const dtn::data::EID | getSecuritySource (const dtn::data::Bundle &) const |
const dtn::data::EID | getSecurityDestination (const dtn::data::Bundle &) const |
template<class T > | |
T & | encryptBlock (dtn::data::Bundle &bundle, dtn::data::Bundle::iterator &it, uint32_t salt, const unsigned char ephemeral_key[ibrcommon::AES128Stream::key_size_in_bytes]) |
Public Member Functions inherited from dtn::data::Block | |
virtual | ~Block () |
Block & | operator= (const Block &block) |
bool | operator== (const block_t &id) const |
virtual void | addEID (const dtn::data::EID &eid) |
virtual void | clearEIDs () |
virtual const eid_list & | getEIDList () const |
const block_t & | getType () const |
void | set (ProcFlags flag, const bool &value) |
bool | get (ProcFlags flag) const |
const Bitset< ProcFlags > & | getProcessingFlags () const |
virtual Length | getLength_strict () const |
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) |
Static Public Attributes | |
static const dtn::data::block_t | BLOCK_TYPE = SecurityBlock::PAYLOAD_INTEGRITY_BLOCK |
Protected Member Functions | |
PayloadIntegrityBlock () | |
virtual dtn::data::Length | getSecurityResultSize () const |
Protected Member Functions inherited from dtn::security::SecurityBlock | |
void | store_security_references () |
SecurityBlock (const SecurityBlock::BLOCK_TYPES type, const CIPHERSUITE_IDS id) | |
SecurityBlock (const SecurityBlock::BLOCK_TYPES type) | |
void | setCiphersuiteId (const CIPHERSUITE_IDS id) |
void | setCorrelator (const dtn::data::Number &corr) |
virtual MutableSerializer & | serialize_mutable (MutableSerializer &serializer, bool include_security_result=true) const |
Protected Member Functions inherited from dtn::data::Block | |
Block (block_t blocktype) | |
Friends | |
class | dtn::data::Bundle |
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 43 of file PayloadIntegrityBlock.h.
|
virtual |
frees the internal PKEY object, without deleting the rsa object
given in the constructor
Definition at line 53 of file PayloadIntegrityBlock.cpp.
|
protected |
Constructs an empty PayloadIntegrityBlock in order for adding it to a bundle and sets its ciphersuite id to PIB_RSA_SHA256.
Definition at line 48 of file PayloadIntegrityBlock.cpp.
Referenced by dtn::security::PayloadIntegrityBlock::Factory::create().
|
virtual |
Parses the PayloadIntegrityBlock from a Stream
stream | the stream to read from |
Reimplemented from dtn::security::SecurityBlock.
Definition at line 190 of file PayloadIntegrityBlock.cpp.
References dtn::security::SecurityBlock::_security_result, dtn::security::SecurityBlock::deserialize(), and dtn::security::SecurityBlock::TLVList::getLength().
|
protectedvirtual |
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 57 of file PayloadIntegrityBlock.cpp.
References dtn::security::SecurityBlock::getSecurityResultSize().
|
static |
Takes a bundle and adds a PayloadIntegrityBlock to it using the key given in the constructor after the primary block.
bundle | the bundle to be hashed and signed |
Definition at line 67 of file PayloadIntegrityBlock.cpp.
References dtn::security::SecurityBlock::_ciphersuite_flags, dtn::security::SecurityBlock::_ciphersuite_params, dtn::security::SecurityBlock::_security_result, dtn::security::SecurityBlock::addFragmentRange(), dtn::security::SecurityBlock::CONTAINS_SECURITY_RESULT, dtn::data::PrimaryBlock::destination, dtn::data::Bundle::find(), dtn::data::PrimaryBlock::FRAGMENT, dtn::data::BundleID::fragmentoffset, dtn::data::PrimaryBlock::get(), dtn::data::PayloadBlock::getBLOB(), dtn::security::SecurityBlock::integrity_signature, dtn::security::SecurityBlock::PIB_RSA_SHA256, dtn::data::Bundle::push_front(), dtn::security::SecurityKey::reference, dtn::data::Block::REPLICATE_IN_EVERY_FRAGMENT, dtn::data::EID::sameHost(), dtn::data::Block::set(), dtn::security::SecurityBlock::TLVList::set(), dtn::security::SecurityBlock::setCiphersuiteId(), dtn::security::SecurityBlock::setSecurityDestination(), dtn::security::SecurityBlock::setSecuritySource(), and dtn::data::BundleID::source.
Referenced by dtn::security::SecurityManager::sign().
|
static |
Removes all PayloadIntegrityBlocks from a bundle
bundle | the bundle, which shall be cleaned from pibs |
Definition at line 185 of file PayloadIntegrityBlock.cpp.
References dtn::data::Bundle::begin(), BLOCK_TYPE, dtn::data::Bundle::end(), and dtn::data::Bundle::erase().
|
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.
bundle | the bundle to be checked |
Definition at line 114 of file PayloadIntegrityBlock.cpp.
References dtn::security::SecurityBlock::_ciphersuite_id, dtn::security::SecurityBlock::_security_result, dtn::data::Bundle::begin(), BLOCK_TYPE, dtn::data::Bundle::end(), dtn::security::SecurityKey::free(), dtn::security::SecurityBlock::TLVList::get(), dtn::security::SecurityKey::getEVP(), ibrcommon::RSASHA256Stream::getVerification(), dtn::security::SecurityBlock::integrity_signature, dtn::security::SecurityBlock::isSecuritySource(), dtn::security::SecurityBlock::PIB_RSA_SHA256, and dtn::security::SecurityKey::reference.
Referenced by dtn::security::SecurityManager::verifyPIB().
|
friend |
Definition at line 45 of file PayloadIntegrityBlock.h.
|
static |
The block type of this class.
Definition at line 56 of file PayloadIntegrityBlock.h.
Referenced by dtn::security::PayloadConfidentialBlock::encrypt(), dtn::security::SecurityManager::fastverify(), strip(), and verify().