IBR-DTNSuite  0.8
ibrdtn/ibrdtn/security/ExtensionSecurityBlock.h
Go to the documentation of this file.
00001 #ifndef _EXTENSION_SECURITY_BLOCK_H_
00002 #define _EXTENSION_SECURITY_BLOCK_H_
00003 #include "ibrdtn/security/SecurityBlock.h"
00004 #include "ibrdtn/security/SecurityKey.h"
00005 #include "ibrdtn/data/ExtensionBlock.h"
00006 
00007 namespace dtn
00008 {
00009         namespace security
00010         {
00024                 class ExtensionSecurityBlock : public SecurityBlock
00025                 {
00030                         friend class dtn::data::Bundle;
00031                                 public:
00032                                 class Factory : public dtn::data::ExtensionBlock::Factory
00033                                 {
00034                                 public:
00035                                         Factory() : dtn::data::ExtensionBlock::Factory(ExtensionSecurityBlock::BLOCK_TYPE) {};
00036                                         virtual ~Factory() {};
00037                                         virtual dtn::data::Block* create();
00038                                 };
00039 
00041                                 static const char BLOCK_TYPE = SecurityBlock::EXTENSION_SECURITY_BLOCK;
00042 
00044                                 virtual ~ExtensionSecurityBlock();
00045 
00053                                 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);
00054 
00065                                 static void decrypt(dtn::data::Bundle& bundle, const SecurityKey &key, const dtn::security::ExtensionSecurityBlock &block);
00066 
00079                                 static void decrypt(dtn::data::Bundle& bundle, const SecurityKey &key, u_int64_t correlator = 0);
00080 
00081                         protected:
00086                                 ExtensionSecurityBlock();
00087                 };
00088 
00092                 static ExtensionSecurityBlock::Factory __ExtensionSecurityBlockFactory__;
00093         }
00094 }
00095 
00096 #endif