26 #include <ibrcommon/ssl/RSASHA256Stream.h>
27 #include <ibrcommon/Logger.h>
28 #include <openssl/err.h>
29 #include <openssl/rsa.h>
33 #ifdef __DEVELOPMENT_ASSERTIONS__
76 ibrcommon::BLOB::Reference blobref = plb.
getBLOB();
84 pib.setResultSize(key);
87 std::string
sign = calcHash(bundle, key, pib);
93 EVP_PKEY *pkey = key.
getEVP();
94 ibrcommon::RSASHA256Stream rs2s(pkey);
100 int return_code = rs2s.getSign().first;
101 std::string sign_string = rs2s.getSign().second;
108 IBRCOMMON_LOGGER_ex(critical) <<
"an error occured at the creation of the hash and it is invalid" << IBRCOMMON_LOGGER_ENDL;
109 ERR_print_errors_fp(stderr);
110 return std::string(
"");
119 while (it.next(bundle.
end()))
150 EVP_PKEY *pkey = key.
getEVP();
153 ibrcommon::RSASHA256Stream rs2s(pkey,
true);
181 void PayloadIntegrityBlock::setResultSize(
const SecurityKey &key)
183 EVP_PKEY *pkey = key.
getEVP();
186 if ((result_size = EVP_PKEY_size(pkey)) > 0)
dtn::data::Bitset< CIPHERSUITE_FLAGS > _ciphersuite_flags
bool sameHost(const std::string &other) const
virtual EVP_PKEY * getEVP() const
static void free(RSA *key)
virtual std::istream & deserialize(std::istream &stream, const dtn::data::Length &length)
void set(ProcFlags flag, const bool &value)
void set(TLV_TYPES type, std::string value)
void setSecurityDestination(const dtn::data::EID &destination)
virtual dtn::data::Length getSecurityResultSize() const
TLVList _ciphersuite_params
dtn::data::Length getPayloadLength() const
void setCiphersuiteId(const CIPHERSUITE_IDS id)
const std::string get(TLV_TYPES type) const
dtn::data::Length getLength() const
bool get(FLAGS flag) const
static const dtn::data::block_t BLOCK_TYPE
virtual dtn::data::Length getSecurityResultSize() const
static void addFragmentRange(TLVList &ciphersuite_params, const dtn::data::Number &fragmentoffset, const dtn::data::Number &payload_length)
virtual dtn::data::Block * create()
static void getFragmentRange(const TLVList &ciphersuite_params, dtn::data::Number &offset, dtn::data::Number &range)
iterator find(block_t blocktype)
ibrcommon::BLOB::Reference getBLOB() const
static void verify(const dtn::data::Bundle &bundle, const SecurityKey &key)
dtn::data::Number _ciphersuite_id
bool isSecuritySource(const dtn::data::Bundle &, const dtn::data::EID &) const
dtn::data::SDNV< Size > Number
virtual ~PayloadIntegrityBlock()
static void strip(dtn::data::Bundle &bundle)
void setSecuritySource(const dtn::data::EID &source)
dtn::data::Number fragmentoffset
static void sign(dtn::data::Bundle &bundle, const SecurityKey &key, const dtn::data::EID &destination)
virtual std::istream & deserialize(std::istream &stream, const dtn::data::Length &length)
ibrcommon::find_iterator< const_iterator, block_t > const_find_iterator