25 #include "ibrcommon/ssl/HMacStream.h"
26 #include <ibrcommon/Logger.h>
31 #ifdef __DEVELOPMENT_ASSERTIONS__
73 std::string sizehash_hash =
calcMAC(bundle, key);
83 verify(bundle, key, correlator);
92 verify(bundle, key, correlator);
96 while (it.next(bundle.
end()))
116 std::set<dtn::data::Number> correlators;
119 std::string our_hash_string = calcMAC(bundle, key);
122 while (it.next(bundle.end()))
130 if (correlators.find(bab.
_correlator) == correlators.end())
continue;
133 if (our_hash_string == bab_result)
140 IBRCOMMON_LOGGER_DEBUG_TAG(
"BundleAuthenticationBlock", 15) <<
"security mac does not match" << IBRCOMMON_LOGGER_ENDL;
161 std::string hmac_key = key.
getData();
162 ibrcommon::HMacStream hms((
const unsigned char*)hmac_key.c_str(),
static_cast<int>(hmac_key.length()));
167 return ibrcommon::HashStream::extract(hms);
177 size += EVP_MD_size(EVP_sha1());
dtn::data::Bitset< CIPHERSUITE_FLAGS > _ciphersuite_flags
static void auth(dtn::data::Bundle &bundle, const dtn::security::SecurityKey &key)
bool sameHost(const std::string &other) const
void setCorrelator(const dtn::data::Number &corr)
virtual ~BundleAuthenticationBlock()
void set(ProcFlags flag, const bool &value)
void set(TLV_TYPES type, std::string value)
static std::string calcMAC(const dtn::data::Bundle &bundle, const dtn::security::SecurityKey &key, const bool with_correlator=false, const dtn::data::Number &correlator=0)
void setCiphersuiteId(const CIPHERSUITE_IDS id)
const std::string get(TLV_TYPES type) const
BundleAuthenticationBlock()
static void verify(const dtn::data::Bundle &bundle, const dtn::security::SecurityKey &key)
virtual const std::string getData() const
virtual dtn::data::Length getSecurityResultSize() const
dtn::data::Number _correlator
static const dtn::data::block_t BLOCK_TYPE
ibrcommon::find_iterator< iterator, block_t > find_iterator
static void strip(dtn::data::Bundle &bundle, const dtn::security::SecurityKey &key)
dtn::data::Number _ciphersuite_id
bool isSecuritySource(const dtn::data::Bundle &, const dtn::data::EID &) const
dtn::data::SDNV< Size > Number
void setSecuritySource(const dtn::data::EID &source)
virtual dtn::data::Block * create()
static dtn::data::Number createCorrelatorValue(const dtn::data::Bundle &bundle)
ibrcommon::find_iterator< const_iterator, block_t > const_find_iterator