MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / preprocess_secure_submsg

Method preprocess_secure_submsg

dds/DCPS/security/CryptoBuiltInImpl.cpp:1701–1785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1699}
1700
1701bool CryptoBuiltInImpl::preprocess_secure_submsg(
1702 DatawriterCryptoHandle& datawriter_crypto,
1703 DatareaderCryptoHandle& datareader_crypto,
1704 SecureSubmessageCategory_t& secure_submessage_category,
1705 const DDS::OctetSeq& encoded_rtps_submessage,
1706 ParticipantCryptoHandle,
1707 ParticipantCryptoHandle sending_participant_crypto,
1708 SecurityException& ex)
1709{
1710 if (DDS::HANDLE_NIL == sending_participant_crypto) {
1711 CommonUtilities::set_security_error(ex, -1, 0, "Invalid Sending Participant");
1712 return false;
1713 }
1714
1715 ACE_Message_Block mb_in(to_mb(encoded_rtps_submessage.get_buffer()),
1716 encoded_rtps_submessage.length());
1717 mb_in.wr_ptr(encoded_rtps_submessage.length());
1718 Serializer de_ser(&mb_in, common_encoding);
1719 CryptoHeader ch = CryptoHeader();
1720 if (!(de_ser.skip(RTPS::SMHDR_SZ) && (de_ser >> ch))) {
1721 ACE_ERROR((LM_ERROR,
1722 "(%P|%t) CryptoBuiltInImpl::preprocess_secure_submsg: "
1723 "Could not deserializer CyptoHeader\n"));
1724 }
1725
1726 ACE_Guard<ACE_Thread_Mutex> guard(mutex_);
1727 typedef std::multimap<ParticipantCryptoHandle, EntityInfo>::iterator iter_t;
1728 const std::pair<iter_t, iter_t> iters =
1729 participant_to_entity_.equal_range(sending_participant_crypto);
1730 if (security_debug.chlookup) {
1731 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {chlookup} CryptoBuiltInImpl::preprocess_secure_submsg: ")
1732 ACE_TEXT("Looking for CH that matches transformation id:\n%C"),
1733 to_dds_string(ch.transform_identifier).c_str()));
1734 }
1735 for (iter_t iter = iters.first; iter != iters.second; ++iter) {
1736 const NativeCryptoHandle sending_entity_candidate = iter->second.handle_;
1737 const KeyTable_t::const_iterator kiter = keys_.find(sending_entity_candidate);
1738 if (security_debug.chlookup) {
1739 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {chlookup} CryptoBuiltInImpl::preprocess_secure_submsg: ")
1740 ACE_TEXT(" Looking at CH %u, has keys: %C\n"),
1741 sending_entity_candidate, kiter == keys_.end() ? "false" : "true"));
1742 }
1743 if (kiter != keys_.end()) {
1744 const KeySeq& keyseq = kiter->second;
1745 const unsigned keycount = keyseq.length();
1746 if (security_debug.chlookup) {
1747 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {chlookup} CryptoBuiltInImpl::preprocess_secure_submsg: ")
1748 ACE_TEXT(" Number of keys: %u\n"), keycount));
1749 }
1750 for (unsigned int i = 0; i < keycount; ++i) {
1751 if (security_debug.chlookup) {
1752 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {chlookup} CryptoBuiltInImpl::preprocess_secure_submsg: ")
1753 ACE_TEXT(" Key: %C\n"),
1754 (OPENDDS_STRING(ctk_to_dds_string(keyseq[i].transformation_kind)) + ", " +
1755 ctki_to_dds_string(keyseq[i].sender_key_id)).c_str()));
1756 }
1757 if (matches(keyseq[i], ch)) {
1758 char chtype = '\0';

Callers 2

deliver_from_secureMethod · 0.80
TEST_FFunction · 0.80

Calls 11

set_security_errorFunction · 0.85
to_mbFunction · 0.85
ctk_to_dds_stringFunction · 0.85
ctki_to_dds_stringFunction · 0.85
skipMethod · 0.80
to_dds_stringFunction · 0.70
matchesFunction · 0.70
get_bufferMethod · 0.45
lengthMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected