Introspection did not find any typical Config paths. More...
#include "qkd-crypto.h"
Public Member Functions | |
QKDCrypto () | |
Constructor. More... | |
virtual | ~QKDCrypto () |
Destructor. More... | |
bool | CheckForResourcesToProcessThePacket (Ptr< Packet > p, uint32_t TOSBand, Ptr< QKDBuffer > QKDbuffer) |
Check whether there is enough resources (key material) to process (encrypt or decrypt) the packet. More... | |
Ptr< Packet > | Decrypt (Ptr< Packet > p, Ptr< QKDBuffer > QKDBuffer) |
This functions is used for real decryption process. More... | |
std::vector< Ptr< Packet > > | ProcessIncomingPacket (Ptr< Packet > p, Ptr< QKDBuffer > QKDBuffer, uint32_t channelID) |
This functions is an entry point toward deencryption/authentication-check of the packet Packet is deserialized from string in case when packet was previously encrypted or authentication, otherwise, the packet is kept in "Packet" form and only QKDCommandHeader and QKDHeader are removed. More... | |
std::vector< Ptr< Packet > > | ProcessOutgoingPacket (Ptr< Packet > p, Ptr< QKDBuffer > QKDBuffer, uint32_t channelID) |
This functions is an entry point toward encryption/authentication of the packet Packet is serialized to string in case when encryption or authentication is required, otherwise, the packet is kept in "Packet" form and only QKDCommandHeader and QKDHeader is added. More... | |
![]() | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the TypeId. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
std::string | AESDecrypt (const std::string &data, Ptr< QKDKey > key) |
AES decryption. More... | |
std::string | AESEncrypt (const std::string &data, Ptr< QKDKey > key) |
AES encryption. More... | |
std::string | Authenticate (std::string &, Ptr< QKDKey > key, uint8_t authenticationType) |
Help parent function used for calling child authentication functions. More... | |
std::string | base64_decode (std::string const &s) |
Help function - base64_decode. More... | |
std::string | base64_encode (std::string &s) |
Help function - base64_encode. More... | |
Ptr< Packet > | CheckAuthentication (Ptr< Packet > p, Ptr< QKDKey > key, uint8_t authenticationType) |
Help parent function used for calling child authentication functions for authentication check. More... | |
std::vector< Ptr< Packet > > | CheckForFragmentation (Ptr< Packet > p, Ptr< QKDBuffer > QKDBuffer) |
Check for reassembly of packet fragments. More... | |
QKDCommandHeader | CreateQKDCommandHeader (Ptr< Packet > p) |
Help function used to create QKDCommandHeader by analyzing tags of the packet. More... | |
std::string | HexDecode (const std::string &data) |
Help function used to decode string to HEX string. More... | |
std::string | HexEncode (const std::string &data) |
Help function used to encode string to HEX string. More... | |
std::string | MD5 (std::string &inputString) |
MD5 Authentication function. More... | |
std::string | OTP (const std::string &data, Ptr< QKDKey > key) |
One-time cipher. More... | |
std::string | PacketToString (Ptr< Packet > p) |
Help function used to serialize packet to std::string which is later used for encryption. More... | |
std::vector< uint8_t > | QKDDelimiterHeaderToVector (QKDDelimiterHeader &qkdHeader) |
Help function used to covert QKDDelimiterHeader to vector<uint8_t> which is suitable for encryption. More... | |
std::vector< uint8_t > | QKDHeaderToVector (QKDHeader &qkdHeader) |
Help function used to covert QKDHeader to vector<uint8_t> which is suitable for encryption. More... | |
std::string | SHA1 (std::string &inputString) |
SHA1 Authentication function. More... | |
std::string | StringCompressEncode (const std::string &data) |
Help function used to compress string. More... | |
std::string | StringDecompressDecode (const std::string &data) |
Help function used to decompress string. More... | |
QKDDelimiterHeader | StringToQKDDelimiterHeader (std::string &input) |
Help function used to covert std::string to QKDDelimiterHeader Function is used in decryption (deserialize process) More... | |
QKDHeader | StringToQKDHeader (std::string &input) |
Help function used to covert std::string to QKDHeader Function is used in decryption (deserialize process) More... | |
std::vector< uint8_t > | StringToVector (std::string &input) |
Help function used to convert string to vector<uint8_t> More... | |
std::string | VectorToString (std::vector< uint8_t > inputVector) |
Help function used to vector<uint8_t> to convert string. More... | |
std::string | VMAC (std::string &inputString, Ptr< QKDKey > key) |
Authentication function in Wegman-Carter fashion. More... | |
Private Attributes | |
uint32_t | m_aodvqRerrHeaderSize |
uint32_t | m_aodvqRrepAckHeaderSize |
uint32_t | m_aodvqRrepHeaderSize |
uint32_t | m_aodvqRreqHeaderSize |
uint32_t | m_aodvqTypeHeaderSize |
uint32_t | m_aodvRerrHeaderSize |
uint32_t | m_aodvRrepAckHeaderSize |
uint32_t | m_aodvRrepHeaderSize |
uint32_t | m_aodvRreqHeaderSize |
uint32_t | m_aodvTypeHeaderSize |
uint32_t | m_authenticationTagLengthInBits |
length of the authentication tag in bits (32 by default) More... | |
TracedCallback< Ptr< Packet >, std::string > | m_authenticationTrace |
trace callback for authentication More... | |
std::map< uint32_t, std::string > | m_cacheFlowValues |
map used to hold info about fragmented packets More... | |
bool | m_compressionEnabled |
encryption (ZIP or similar) enabled? More... | |
TracedCallback< Ptr< Packet >, std::string > | m_deauthenticationTrace |
trace callback for authentication check More... | |
TracedCallback< Ptr< Packet > > | m_decryptionTrace |
trace callback for decryption More... | |
uint32_t | m_dsdvHeaderSize |
uint32_t | m_dsdvqHeaderSize |
bool | m_encryptionEnabled |
real encryption used? More... | |
TracedCallback< Ptr< Packet > > | m_encryptionTrace |
trace callback for encryption More... | |
uint32_t | m_icmpv4DestinationUnreachableHeaderSize |
uint32_t | m_icmpv4EchoHeaderSize |
uint32_t | m_icmpv4HeaderSize |
uint32_t | m_icmpv4TimeExceededHeaderSize |
uint32_t | m_ipv4HeaderSize |
we store details about the ipv4 header size which is later used in decryption More... | |
byte | m_iv [CryptoPP::AES::BLOCKSIZE] |
uint32_t | m_olsrPacketHeaderSize |
uint32_t | m_qkdDHeaderSize |
qkd delimiter header size More... | |
uint32_t | m_qkdHeaderSize |
qkd header size More... | |
uint32_t | m_udpHeaderSize |
Additional Inherited Members | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Introspection did not find any typical Config paths.
QKD crypto is a class used to perform encryption, decryption, authentication, atuhentication-check operations and reassembly of previously fragmented packets.
Size of this type is 280 bytes (on a 64-bit architecture).
QKD crypto uses cryptographic algorithms and schemes from Crypto++ free and open source C++ class cryptographic library. Currently, QKDCrypto supports following crypto-graphic algorithms and schemes: • One-Time Pad (OTP) cipher, • Advanced Encryption Standard (AES) block cipher, • VMAC message authentication code (MAC) algorithm, • MD5 MAC algorithm, • SHA1 MAC algorithm. QKD crypto implements functions for serialization and deserialization of the packet into a byte array which is used as the input in cryptographic algorithms and schemes.
QKD crypto is a class used to perform encryption, decryption, authentication, authentication-check operations and reassembly of previously fragmented packets. QKD crypto uses cryptographic algorithms and schemes from Crypto++ open-source C++ class cryptographic library. Currently, QKD crypto supports several cryptographic algorithms and cryptographic hashes including One-Time Pad (OTP) cipher, Advanced Encryption Standard (AES) block cipher, VMAC message authentication code (MAC) algorithm and other. Also, QKD crypto implements functions for serialization and deserialization of the packet into a byte array which is used as the input in cryptographic algorithms and schemes.
The main idea behind QKDCrypto is to convert packet payload and its header to string and perform cryptographic operations over that string. Since some headers have variable length, like TCP or OLSR, then and there is no field indicating the size of these headers (there is only field indicating whole packet size in IPv4 header) it is difficult to distinguish between packet payload and end of packet's header. Therefore, we use a small trick to add a QKDDelimiterHeader to help us in this process. This header sits between the packets and it contains only one field (m_delimiter) which is actually the size of next header. For example, in case of TCP, QKDDelimiterHeader sits between IPv4 and TCP indicating the size of TCP header. The order of packets in this case is IPv4, QKDDelimiterHeader, TCP, payload... In case of OLSR it sits between OlsrPacketHeader and OLSRMessageHEader indicating the size of OLSRMessageHeader which can vary. The order of packets in this case is IPv4, UPD, OLSRPacketHeader, QKDDelimiterHeader, OLSRMessageHeader, OLSRPacketHeader, QKDDelimiterHeader, OLSRMessageHeader and etc.
Post taken from ns-3-users google group by Tommaso Pecorella: https://groups.google.com/forum/#!searchin/ns-3-users/A$20Buffer$20does$20NOT$20hold$20just$20the$20header$20(or$20packet)$20content$2C$20it$20contains$20also$20the$20packet$20metadata.%7Csort:relevance/ns-3-users/zfS7DBVs8RM/XUgaFlHABAAJ
"A Buffer does NOT hold just the header (or packet) content, it contains also the packet metadata. As a consequence it's often much longer than expected. The buffer size that you need to serialize something is (not a surprise) returned by GetSerializedSize. If you ask what's the serialized size of an IPv4 header, the answer is... 20 bytes (obvious). However, the Buffer you just serialized the header into... that's different, because THAT has some metadata to carry. Result: Buffer.GetSerializedSize() -> 32 bytes. You need a 32 Bytes long array (minimum) But wait, there's more ! You need to store the array size somewhere. Guess what ? If you serialize a Buffer with a GetSerializedSize equal to 32, you need a 32+4 Bytes array (minimum). Problem: what about the Deserialize ? Well, in that case too you should know the amount of bytes to deserialize. If you think it's less or more, an error will be thrown."
Definition at line 123 of file qkd-crypto.h.
ns3::QKDCrypto::QKDCrypto | ( | ) |
Constructor.
Definition at line 114 of file qkd-crypto.cc.
References m_authenticationTagLengthInBits, m_iv, m_qkdHeaderSize, and NS_LOG_FUNCTION.
|
virtual |
Destructor.
Definition at line 122 of file qkd-crypto.cc.
AES decryption.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3279 of file qkd-crypto.cc.
References data, m_encryptionEnabled, m_iv, and NS_LOG_FUNCTION.
Referenced by Decrypt().
AES encryption.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3257 of file qkd-crypto.cc.
References data, m_encryptionEnabled, m_iv, and NS_LOG_FUNCTION.
Referenced by ProcessOutgoingPacket().
|
private |
Help parent function used for calling child authentication functions.
std::string | data |
Ptr<QKDKey> | key |
uint8_t | authentic |
Definition at line 3337 of file qkd-crypto.cc.
References MD5(), NS_LOG_FUNCTION, QKDCRYPTO_AUTH_MD5, QKDCRYPTO_AUTH_SHA1, QKDCRYPTO_AUTH_VMAC, SHA1(), and VMAC().
Referenced by ProcessOutgoingPacket().
|
private |
Help function - base64_decode.
std::string | data |
Definition at line 3533 of file qkd-crypto.cc.
References ns3::is_base64(), and NS_LOG_FUNCTION.
|
private |
Help function - base64_encode.
std::string | data |
Definition at line 3483 of file qkd-crypto.cc.
References NS_LOG_FUNCTION.
|
private |
Help parent function used for calling child authentication functions for authentication check.
std::string | data |
Ptr<QKDKey> | key |
uint8_t | authentic |
Definition at line 3358 of file qkd-crypto.cc.
References ns3::Packet::Copy(), ns3::Packet::CopyData(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_deauthenticationTrace, MD5(), NS_LOG_FUNCTION, packetSize, ns3::Packet::PeekHeader(), QKDCRYPTO_AUTH_MD5, QKDCRYPTO_AUTH_SHA1, QKDCRYPTO_AUTH_VMAC, ns3::Packet::RemoveHeader(), SHA1(), and VMAC().
Referenced by Decrypt().
|
private |
Check for reassembly of packet fragments.
Function needs to store in cache memory fragments until it receives whole packet. After receiving of whole packet, decryption can be performed
Ptr<Packet> | |
Ptr<QKDBuffer> |
Definition at line 1830 of file qkd-crypto.cc.
References ns3::Packet::AddHeader(), ns3::Packet::CopyData(), ns3::QKDHeader::GetLength(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), HexEncode(), m_cacheFlowValues, m_qkdHeaderSize, NS_LOG_FUNCTION, NS_LOG_INFO, packetSize, and StringToQKDHeader().
Referenced by ProcessIncomingPacket().
bool ns3::QKDCrypto::CheckForResourcesToProcessThePacket | ( | Ptr< Packet > | p, |
uint32_t | TOSBand, | ||
Ptr< QKDBuffer > | QKDbuffer | ||
) |
Check whether there is enough resources (key material) to process (encrypt or decrypt) the packet.
Ptr<Packet> | |
uint32_t | |
Ptr<QKDBuffer> |
Definition at line 293 of file qkd-crypto.cc.
References ns3::QKDInternalTag::GetAuthenticateValue(), ns3::QKDInternalTag::GetEncryptValue(), ns3::Packet::GetSize(), m_authenticationTagLengthInBits, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekPacketTag(), QKDCRYPTO_AES, QKDCRYPTO_AUTH_VMAC, QKDCRYPTO_OTP, and ns3::QKDBuffer::QKDSTATUS_EMPTY.
|
private |
Help function used to create QKDCommandHeader by analyzing tags of the packet.
Ptr<Packet> | p |
Definition at line 262 of file qkd-crypto.cc.
References ns3::QKDCommandTag::GetCommand(), ns3::QKDCommandTag::GetRoutingProtocolNumber(), NS_LOG_FUNCTION, ns3::Packet::PeekPacketTag(), and ns3::QKDCommandHeader::SetCommand().
Referenced by PacketToString().
This functions is used for real decryption process.
Ptr<Packet> | |
Ptr<QKDBuffer> |
Definition at line 2045 of file qkd-crypto.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), AESDecrypt(), AODV_RERR_HEADER_PROTOCOL_NUMBER, AODV_RREP_ACK_HEADER_PROTOCOL_NUMBER, AODV_RREP_HEADER_PROTOCOL_NUMBER, AODV_RREQ_HEADER_PROTOCOL_NUMBER, AODV_TYPE_HEADER_PROTOCOL_NUMBER, AODVQ_RERR_HEADER_PROTOCOL_NUMBER, AODVQ_RREP_ACK_HEADER_PROTOCOL_NUMBER, AODVQ_RREP_HEADER_PROTOCOL_NUMBER, AODVQ_RREQ_HEADER_PROTOCOL_NUMBER, AODVQ_TYPE_HEADER_PROTOCOL_NUMBER, ns3::Buffer::Begin(), CheckAuthentication(), ns3::Packet::CopyData(), ns3::dsdvq::DsdvqHeader::Deserialize(), ns3::QKDCommandHeader::Deserialize(), ns3::aodv::TypeHeader::Deserialize(), ns3::aodvq::TypeHeader::Deserialize(), ns3::dsdv::DsdvHeader::Deserialize(), ns3::Icmpv4Header::Deserialize(), ns3::olsr::PacketHeader::Deserialize(), ns3::Icmpv4Echo::Deserialize(), ns3::aodv::RreqHeader::Deserialize(), ns3::aodvq::RreqHeader::Deserialize(), ns3::Icmpv4DestinationUnreachable::Deserialize(), ns3::Ipv4Header::Deserialize(), ns3::Icmpv4TimeExceeded::Deserialize(), ns3::olsr::MessageHeader::Deserialize(), ns3::TcpHeader::Deserialize(), ns3::aodv::RrepHeader::Deserialize(), ns3::aodvq::RrepHeader::Deserialize(), ns3::aodv::RrepAckHeader::Deserialize(), ns3::aodvq::RrepAckHeader::Deserialize(), ns3::aodv::RerrHeader::Deserialize(), ns3::aodvq::RerrHeader::Deserialize(), ns3::Buffer::Deserialize(), DSDV_PACKET_HEADER_PROTOCOL_NUMBER, DSDVQ_PACKET_HEADER_PROTOCOL_NUMBER, ns3::QKDDelimiterHeader::GetDelimiterSize(), ns3::olsr::MessageHeader::GetMessageType(), ns3::QKDCommandHeader::GetProtocol(), ns3::Ipv4Header::GetProtocol(), ns3::Packet::GetSize(), ns3::Icmpv4Header::GetType(), ns3::Packet::GetUid(), ns3::Icmpv4Header::ICMPV4_DEST_UNREACH, ns3::Icmpv4Header::ICMPV4_ECHO, ns3::Icmpv4Header::ICMPV4_ECHO_REPLY, ns3::Icmpv4Header::ICMPV4_TIME_EXCEEDED, m_aodvqRerrHeaderSize, m_aodvqRrepAckHeaderSize, m_aodvqRrepHeaderSize, m_aodvqRreqHeaderSize, m_aodvqTypeHeaderSize, m_aodvRerrHeaderSize, m_aodvRrepAckHeaderSize, m_aodvRrepHeaderSize, m_aodvRreqHeaderSize, m_aodvTypeHeaderSize, m_authenticationTagLengthInBits, m_decryptionTrace, m_dsdvHeaderSize, m_dsdvqHeaderSize, m_icmpv4DestinationUnreachableHeaderSize, m_icmpv4EchoHeaderSize, m_icmpv4HeaderSize, m_icmpv4TimeExceededHeaderSize, m_ipv4HeaderSize, m_olsrPacketHeaderSize, m_qkdDHeaderSize, m_udpHeaderSize, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_WARN, OLSR_MESSAGE_HEADER_PROTOCOL_NUMBER, OLSR_PACKET_HEADER_PROTOCOL_NUMBER, OTP(), packetSize, ns3::Packet::PeekHeader(), QKDCRYPTO_AES, QKDCRYPTO_AUTH_VMAC, QKDCRYPTO_OTP, ns3::Packet::RemoveHeader(), ns3::QKDInternalTag::SetAuthenticateValue(), StringDecompressDecode(), and StringToQKDDelimiterHeader().
Referenced by ProcessIncomingPacket().
|
static |
Get the TypeId.
Definition at line 80 of file qkd-crypto.cc.
References m_authenticationTrace, m_compressionEnabled, m_deauthenticationTrace, m_decryptionTrace, m_encryptionEnabled, m_encryptionTrace, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
private |
Help function used to decode string to HEX string.
std::string | data |
Definition at line 3319 of file qkd-crypto.cc.
References data, m_encryptionEnabled, and NS_LOG_FUNCTION.
|
private |
Help function used to encode string to HEX string.
std::string | data |
Definition at line 3301 of file qkd-crypto.cc.
References data, m_encryptionEnabled, and NS_LOG_FUNCTION.
Referenced by CheckForFragmentation().
|
private |
MD5 Authentication function.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3437 of file qkd-crypto.cc.
References m_authenticationTagLengthInBits, m_encryptionEnabled, and NS_LOG_FUNCTION.
Referenced by Authenticate(), and CheckAuthentication().
One-time cipher.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3236 of file qkd-crypto.cc.
References data, m_encryptionEnabled, and NS_LOG_FUNCTION.
Referenced by Decrypt(), and ProcessOutgoingPacket().
Help function used to serialize packet to std::string which is later used for encryption.
Ptr<Packet> | p |
Definition at line 578 of file qkd-crypto.cc.
References ns3::Buffer::AddAtStart(), AODV_RERR_HEADER_PROTOCOL_NUMBER, AODV_RREP_ACK_HEADER_PROTOCOL_NUMBER, AODV_RREP_HEADER_PROTOCOL_NUMBER, AODV_RREQ_HEADER_PROTOCOL_NUMBER, AODV_TYPE_HEADER_PROTOCOL_NUMBER, AODVQ_RERR_HEADER_PROTOCOL_NUMBER, AODVQ_RREP_ACK_HEADER_PROTOCOL_NUMBER, AODVQ_RREP_HEADER_PROTOCOL_NUMBER, AODVQ_RREQ_HEADER_PROTOCOL_NUMBER, AODVQ_TYPE_HEADER_PROTOCOL_NUMBER, ns3::Buffer::Begin(), ns3::Packet::BeginItem(), ns3::Packet::CopyData(), CreateQKDCommandHeader(), ns3::PacketMetadata::Item::current, ns3::dsdvq::DsdvqHeader::Deserialize(), ns3::aodvq::TypeHeader::Deserialize(), ns3::aodv::TypeHeader::Deserialize(), ns3::dsdv::DsdvHeader::Deserialize(), ns3::Icmpv4Header::Deserialize(), ns3::UdpHeader::Deserialize(), ns3::olsr::PacketHeader::Deserialize(), ns3::Icmpv4Echo::Deserialize(), ns3::aodvq::RreqHeader::Deserialize(), ns3::aodv::RreqHeader::Deserialize(), ns3::Icmpv4DestinationUnreachable::Deserialize(), ns3::Ipv4Header::Deserialize(), ns3::Icmpv4TimeExceeded::Deserialize(), ns3::olsr::MessageHeader::Deserialize(), ns3::TcpHeader::Deserialize(), ns3::aodvq::RrepHeader::Deserialize(), ns3::aodv::RrepHeader::Deserialize(), ns3::aodv::RrepAckHeader::Deserialize(), ns3::aodvq::RrepAckHeader::Deserialize(), ns3::aodv::RerrHeader::Deserialize(), ns3::aodvq::RerrHeader::Deserialize(), DSDV_PACKET_HEADER_PROTOCOL_NUMBER, DSDVQ_PACKET_HEADER_PROTOCOL_NUMBER, ns3::TypeId::GetConstructor(), ns3::olsr::MessageHeader::GetMessageType(), ns3::TypeId::GetName(), ns3::Ipv4Header::GetProtocol(), ns3::dsdvq::DsdvqHeader::GetSerializedSize(), ns3::aodvq::TypeHeader::GetSerializedSize(), ns3::aodv::TypeHeader::GetSerializedSize(), ns3::dsdv::DsdvHeader::GetSerializedSize(), ns3::Icmpv4Header::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::olsr::PacketHeader::GetSerializedSize(), ns3::Icmpv4Echo::GetSerializedSize(), ns3::aodvq::RreqHeader::GetSerializedSize(), ns3::aodv::RreqHeader::GetSerializedSize(), ns3::Icmpv4DestinationUnreachable::GetSerializedSize(), ns3::Ipv4Header::GetSerializedSize(), ns3::Icmpv4TimeExceeded::GetSerializedSize(), ns3::olsr::MessageHeader::GetSerializedSize(), ns3::TcpHeader::GetSerializedSize(), ns3::aodvq::RrepHeader::GetSerializedSize(), ns3::aodv::RrepHeader::GetSerializedSize(), ns3::aodv::RrepAckHeader::GetSerializedSize(), ns3::aodvq::RrepAckHeader::GetSerializedSize(), ns3::Buffer::GetSerializedSize(), ns3::aodv::RerrHeader::GetSerializedSize(), ns3::aodvq::RerrHeader::GetSerializedSize(), ns3::TypeId::GetSize(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::TypeId::GetUid(), ns3::PacketMetadata::ItemIterator::HasNext(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_aodvqRerrHeaderSize, m_aodvqRrepAckHeaderSize, m_aodvqRrepHeaderSize, m_aodvqRreqHeaderSize, m_aodvqTypeHeaderSize, m_aodvRerrHeaderSize, m_aodvRrepAckHeaderSize, m_aodvRrepHeaderSize, m_aodvRreqHeaderSize, m_aodvTypeHeaderSize, m_dsdvHeaderSize, m_dsdvqHeaderSize, m_icmpv4DestinationUnreachableHeaderSize, m_icmpv4EchoHeaderSize, m_icmpv4HeaderSize, m_icmpv4TimeExceededHeaderSize, m_ipv4HeaderSize, m_olsrPacketHeaderSize, m_udpHeaderSize, ns3::PacketMetadata::ItemIterator::Next(), NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, OLSR_MESSAGE_HEADER_PROTOCOL_NUMBER, OLSR_PACKET_HEADER_PROTOCOL_NUMBER, packetSize, ns3::Packet::PeekPacketTag(), QKDDelimiterHeaderToVector(), ns3::Packet::RemovePacketTag(), ns3::dsdvq::DsdvqHeader::Serialize(), ns3::aodv::TypeHeader::Serialize(), ns3::aodvq::TypeHeader::Serialize(), ns3::dsdv::DsdvHeader::Serialize(), ns3::Icmpv4Header::Serialize(), ns3::UdpHeader::Serialize(), ns3::olsr::PacketHeader::Serialize(), ns3::Icmpv4Echo::Serialize(), ns3::aodvq::RreqHeader::Serialize(), ns3::aodv::RreqHeader::Serialize(), ns3::Icmpv4DestinationUnreachable::Serialize(), ns3::Ipv4Header::Serialize(), ns3::Icmpv4TimeExceeded::Serialize(), ns3::olsr::MessageHeader::Serialize(), ns3::TcpHeader::Serialize(), ns3::aodv::RrepHeader::Serialize(), ns3::aodvq::RrepHeader::Serialize(), ns3::aodv::RrepAckHeader::Serialize(), ns3::aodvq::RrepAckHeader::Serialize(), ns3::aodv::RerrHeader::Serialize(), ns3::aodvq::RerrHeader::Serialize(), ns3::Buffer::Serialize(), ns3::QKDDelimiterHeader::SetDelimiterSize(), ns3::PacketMetadata::Item::tid, and VectorToString().
Referenced by ProcessOutgoingPacket().
std::vector< Ptr< Packet > > ns3::QKDCrypto::ProcessIncomingPacket | ( | Ptr< Packet > | p, |
Ptr< QKDBuffer > | QKDBuffer, | ||
uint32_t | channelID | ||
) |
This functions is an entry point toward deencryption/authentication-check of the packet Packet is deserialized from string in case when packet was previously encrypted or authentication, otherwise, the packet is kept in "Packet" form and only QKDCommandHeader and QKDHeader are removed.
Ptr<Packet> | |
Ptr<QKDBuffer> | |
uint32_t | channelID |
Definition at line 2015 of file qkd-crypto.cc.
References CheckForFragmentation(), Decrypt(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), and NS_LOG_FUNCTION.
std::vector< Ptr< Packet > > ns3::QKDCrypto::ProcessOutgoingPacket | ( | Ptr< Packet > | p, |
Ptr< QKDBuffer > | QKDBuffer, | ||
uint32_t | channelID | ||
) |
This functions is an entry point toward encryption/authentication of the packet Packet is serialized to string in case when encryption or authentication is required, otherwise, the packet is kept in "Packet" form and only QKDCommandHeader and QKDHeader is added.
Ptr<Packet> | |
Ptr<QKDBuffer> | |
uint32_t |
Definition at line 352 of file qkd-crypto.cc.
References AESEncrypt(), Authenticate(), ns3::QKDInternalTag::GetAuthenticateValue(), ns3::QKDInternalTag::GetEncryptValue(), ns3::QKDHeader::GetLength(), ns3::QKDHeader::GetMessageId(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_authenticationTagLengthInBits, m_authenticationTrace, m_compressionEnabled, m_encryptionTrace, m_qkdHeaderSize, NS_LOG_FUNCTION, NS_LOG_WARN, OTP(), PacketToString(), ns3::Packet::PeekPacketTag(), QKDCRYPTO_AES, QKDCRYPTO_AUTH_VMAC, QKDCRYPTO_OTP, QKDHeaderToVector(), ns3::Packet::RemovePacketTag(), ns3::QKDHeader::SetAuthenticated(), ns3::QKDHeader::SetAuthenticationKeyId(), ns3::QKDHeader::SetAuthTag(), ns3::QKDHeader::SetChannelId(), ns3::QKDHeader::SetEncrypted(), ns3::QKDHeader::SetEncryptionKeyId(), ns3::QKDHeader::SetLength(), ns3::QKDHeader::SetMessageId(), ns3::QKDHeader::SetZipped(), StringCompressEncode(), StringToVector(), and VectorToString().
|
private |
Help function used to covert QKDDelimiterHeader to vector<uint8_t> which is suitable for encryption.
QKDDelimiterHeader | qkdheader |
Definition at line 187 of file qkd-crypto.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ns3::QKDDelimiterHeader::GetSerializedSize(), ns3::Buffer::GetSerializedSize(), m_qkdDHeaderSize, NS_ASSERT, NS_LOG_FUNCTION, ns3::QKDDelimiterHeader::Serialize(), and ns3::Buffer::Serialize().
Referenced by PacketToString().
|
private |
Help function used to covert QKDHeader to vector<uint8_t> which is suitable for encryption.
QKDHeader | qkdheader |
Definition at line 161 of file qkd-crypto.cc.
References ns3::Buffer::AddAtStart(), ns3::Buffer::Begin(), ns3::QKDHeader::GetSerializedSize(), ns3::Buffer::GetSerializedSize(), m_qkdHeaderSize, NS_ASSERT, NS_LOG_FUNCTION, ns3::QKDHeader::Serialize(), and ns3::Buffer::Serialize().
Referenced by ProcessOutgoingPacket().
|
private |
SHA1 Authentication function.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3460 of file qkd-crypto.cc.
References m_authenticationTagLengthInBits, m_encryptionEnabled, and NS_LOG_FUNCTION.
Referenced by Authenticate(), and CheckAuthentication().
|
private |
Help function used to compress string.
std::string | data |
Definition at line 3578 of file qkd-crypto.cc.
References data, m_compressionEnabled, and NS_LOG_FUNCTION.
Referenced by ProcessOutgoingPacket().
|
private |
Help function used to decompress string.
std::string | data |
Definition at line 3601 of file qkd-crypto.cc.
References data, m_compressionEnabled, and NS_LOG_FUNCTION.
Referenced by Decrypt().
|
private |
Help function used to covert std::string to QKDDelimiterHeader Function is used in decryption (deserialize process)
std::string | input |
Definition at line 239 of file qkd-crypto.cc.
References ns3::Buffer::Begin(), ns3::QKDDelimiterHeader::Deserialize(), ns3::Buffer::Deserialize(), m_qkdDHeaderSize, and NS_LOG_FUNCTION.
Referenced by Decrypt().
|
private |
Help function used to covert std::string to QKDHeader Function is used in decryption (deserialize process)
std::string | input |
Definition at line 216 of file qkd-crypto.cc.
References ns3::Buffer::Begin(), ns3::QKDHeader::Deserialize(), ns3::Buffer::Deserialize(), m_qkdHeaderSize, and NS_LOG_FUNCTION.
Referenced by CheckForFragmentation().
|
private |
Help function used to convert string to vector<uint8_t>
std::string | input |
Definition at line 128 of file qkd-crypto.cc.
References NS_LOG_FUNCTION.
Referenced by ProcessOutgoingPacket().
|
private |
Help function used to vector<uint8_t> to convert string.
std::vector<uint8_t> |
Definition at line 143 of file qkd-crypto.cc.
References NS_LOG_FUNCTION.
Referenced by PacketToString(), and ProcessOutgoingPacket().
Authentication function in Wegman-Carter fashion.
std::string | data |
Ptr<QKDKey> | key |
Definition at line 3410 of file qkd-crypto.cc.
References m_authenticationTagLengthInBits, m_encryptionEnabled, m_iv, and NS_LOG_FUNCTION.
Referenced by Authenticate(), and CheckAuthentication().
|
private |
Definition at line 432 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 431 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 429 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 430 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 428 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 425 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 424 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 422 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 423 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 421 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
length of the authentication tag in bits (32 by default)
Definition at line 378 of file qkd-crypto.h.
Referenced by CheckForResourcesToProcessThePacket(), Decrypt(), MD5(), ProcessOutgoingPacket(), QKDCrypto(), SHA1(), and VMAC().
|
private |
trace callback for authentication
Definition at line 383 of file qkd-crypto.h.
Referenced by GetTypeId(), and ProcessOutgoingPacket().
|
private |
map used to hold info about fragmented packets
Definition at line 386 of file qkd-crypto.h.
Referenced by CheckForFragmentation().
|
private |
encryption (ZIP or similar) enabled?
Definition at line 391 of file qkd-crypto.h.
Referenced by GetTypeId(), ProcessOutgoingPacket(), StringCompressEncode(), and StringDecompressDecode().
|
private |
trace callback for authentication check
Definition at line 384 of file qkd-crypto.h.
Referenced by CheckAuthentication(), and GetTypeId().
|
private |
trace callback for decryption
Definition at line 381 of file qkd-crypto.h.
Referenced by Decrypt(), and GetTypeId().
|
private |
Definition at line 418 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 415 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
real encryption used?
Definition at line 392 of file qkd-crypto.h.
Referenced by AESDecrypt(), AESEncrypt(), GetTypeId(), HexDecode(), HexEncode(), MD5(), OTP(), SHA1(), and VMAC().
|
private |
trace callback for encryption
Definition at line 380 of file qkd-crypto.h.
Referenced by GetTypeId(), and ProcessOutgoingPacket().
|
private |
Definition at line 406 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 404 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 403 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 405 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
we store details about the ipv4 header size which is later used in decryption
Definition at line 400 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
Definition at line 197 of file qkd-crypto.h.
Referenced by AESDecrypt(), AESEncrypt(), QKDCrypto(), and VMAC().
|
private |
Definition at line 412 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().
|
private |
qkd delimiter header size
Definition at line 389 of file qkd-crypto.h.
Referenced by Decrypt(), QKDDelimiterHeaderToVector(), and StringToQKDDelimiterHeader().
|
private |
qkd header size
Definition at line 388 of file qkd-crypto.h.
Referenced by CheckForFragmentation(), ProcessOutgoingPacket(), QKDCrypto(), QKDHeaderToVector(), and StringToQKDHeader().
|
private |
Definition at line 409 of file qkd-crypto.h.
Referenced by Decrypt(), and PacketToString().