IBR-DTNSuite
0.12
|
#include <ExtensionSecurityBlock.h>
Classes | |
class | Factory |
Public Member Functions | |
virtual | ~ExtensionSecurityBlock () |
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 |
virtual std::istream & | deserialize (std::istream &stream, const dtn::data::Length &length) |
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 | encrypt (dtn::data::Bundle &bundle, const SecurityKey &key, dtn::data::Bundle::iterator it, const dtn::data::EID &source, const dtn::data::EID &destination) |
static void | decrypt (dtn::data::Bundle &bundle, const SecurityKey &key, dtn::data::Bundle::iterator it) |
static void | decrypt (dtn::data::Bundle &bundle, const SecurityKey &key, const dtn::data::Number &correlator=0) |
Static Public Attributes | |
static const dtn::data::block_t | BLOCK_TYPE = SecurityBlock::EXTENSION_SECURITY_BLOCK |
Protected Member Functions | |
ExtensionSecurityBlock () | |
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 |
virtual dtn::data::Length | getSecurityResultSize () const |
Protected Member Functions inherited from dtn::data::Block | |
Block (block_t blocktype) | |
Friends | |
class | dtn::data::Bundle |
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 45 of file ExtensionSecurityBlock.h.
|
virtual |
does nothing
Definition at line 50 of file ExtensionSecurityBlock.cpp.
|
protected |
Creates an empty ExtensionSecurityBlock and sets its ciphersuite id to ESB_RSA_AES128_EXT
Definition at line 45 of file ExtensionSecurityBlock.cpp.
Referenced by dtn::security::ExtensionSecurityBlock::Factory::create().
|
static |
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.
bundle | the bundle to which block belongs |
block | the to be decrypted block |
Definition at line 80 of file ExtensionSecurityBlock.cpp.
References dtn::security::SecurityBlock::_ciphersuite_params, ibrcommon::LogLevel::critical, 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().
|
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.
bundle | the bundle to which the blocks belong to |
correlator | the correlator which have the blocks set |
Definition at line 102 of file ExtensionSecurityBlock.cpp.
References dtn::security::SecurityBlock::_correlator, dtn::data::Bundle::begin(), BLOCK_TYPE, decrypt(), and dtn::data::Bundle::end().
|
static |
Encrypts and encapsulates a block into a ExtensionSecurityBlock. The ExtensionSecurityBlock will be placed at the same place as the original block.
bundle | the bundle to which block belongs |
block | the to be encrypted block |
Definition at line 54 of file ExtensionSecurityBlock.cpp.
References dtn::security::SecurityBlock::_ciphersuite_flags, dtn::security::SecurityBlock::_ciphersuite_params, dtn::security::SecurityBlock::addKey(), dtn::security::SecurityBlock::addSalt(), dtn::security::SecurityBlock::CONTAINS_CIPHERSUITE_PARAMS, dtn::security::SecurityBlock::createSaltAndKey(), dtn::security::SecurityKey::free(), dtn::security::SecurityKey::getRSA(), ibrcommon::AES128Stream::key_size_in_bytes, dtn::security::SecurityBlock::salt, dtn::security::SecurityBlock::setSecurityDestination(), and dtn::security::SecurityBlock::setSecuritySource().
|
friend |
This class is allowed to call the parameterless contructor and the constructor with the bundle parameter.
Definition at line 51 of file ExtensionSecurityBlock.h.
|
static |
The block type of this class.
Definition at line 62 of file ExtensionSecurityBlock.h.
Referenced by decrypt().