![]() |
Zero Trust IoT library
|
Simulates a Zero Trust-based TLS handshake mechanism between NS-3 nodes. More...
#include <zt-tls-handshake.h>
Public Member Functions | |
ZtTlsHandshake () | |
Constructor. | |
void | StartHandshake (Ptr< Node > client, Ptr< Node > server, uint32_t clientId, uint32_t serverId) |
Start a simulated TLS handshake between client and server nodes. | |
bool | HasSession (uint32_t peerId) const |
Check if a session exists for a given peer. | |
std::string | GetSessionKey (uint32_t peerId) const |
Retrieve the session key for a peer in hexadecimal string format. | |
void | SetExternalLogger (std::function< void(std::string)> logger) |
Set an external logger for emitting TLS logs. | |
void | SetPolicyValidator (std::function< bool(uint32_t, std::string)> validator) |
Set a policy validator for enforcing Zero Trust identity checks. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the NS-3 TypeId. | |
Private Member Functions | |
void | Log (const std::string &msg) const |
Emit a log message using the external logger or NS_LOG fallback. | |
Private Attributes | |
std::map< uint32_t, std::string > | m_sessionKeys |
Maps node IDs to session keys. | |
std::function< void(std::string)> | m_logger |
Optional external logger. | |
std::function< bool(uint32_t, std::string)> | m_policyValidator |
Optional external policy validator. | |
Simulates a Zero Trust-based TLS handshake mechanism between NS-3 nodes.
This class is responsible for performing identity-validated TLS-like handshakes between IoT nodes, establishing symmetric session keys, and enforcing policy-based authentication using injected policy validation logic.
Definition at line 23 of file zt-tls-handshake.h.
ns3::ZtTlsHandshake::ZtTlsHandshake | ( | ) |
std::string ns3::ZtTlsHandshake::GetSessionKey | ( | uint32_t | peerId | ) | const |
Retrieve the session key for a peer in hexadecimal string format.
Retrieve session key for a given peer.
peerId | Node ID of the peer. |
peerId | Node ID of the peer |
Definition at line 86 of file zt-tls-handshake.cc.
|
static |
Get the NS-3 TypeId.
Get the ns-3 TypeId for ZtTlsHandshake.
Definition at line 19 of file zt-tls-handshake.cc.
bool ns3::ZtTlsHandshake::HasSession | ( | uint32_t | peerId | ) | const |
Check if a session exists for a given peer.
Check if a session key exists for a peer.
peerId | Node ID of the peer. |
peerId | Node ID of the peer |
Definition at line 76 of file zt-tls-handshake.cc.
|
private |
Emit a log message using the external logger or NS_LOG fallback.
Internal logging wrapper.
msg | The message to log. |
msg | Log message |
Definition at line 114 of file zt-tls-handshake.cc.
void ns3::ZtTlsHandshake::SetExternalLogger | ( | std::function< void(std::string)> | logger | ) |
Set an external logger for emitting TLS logs.
Set external logging function.
logger | Function accepting a string message. |
logger | Function to be used for logging |
Definition at line 96 of file zt-tls-handshake.cc.
void ns3::ZtTlsHandshake::SetPolicyValidator | ( | std::function< bool(uint32_t, std::string)> | validator | ) |
Set a policy validator for enforcing Zero Trust identity checks.
Set policy validation function for authorization.
validator | Function taking node ID and role string, returns true if authorized. |
validator | Function that validates (nodeId, role) |
Definition at line 105 of file zt-tls-handshake.cc.
void ns3::ZtTlsHandshake::StartHandshake | ( | Ptr< Node > | client, |
Ptr< Node > | server, | ||
uint32_t | clientId, | ||
uint32_t | serverId | ||
) |
Start a simulated TLS handshake between client and server nodes.
Start a simulated handshake between client and server.
Performs mutual policy validation and generates a symmetric session key shared by both nodes.
client | Pointer to the client node. |
server | Pointer to the server node. |
clientId | Unique identifier for the client node. |
serverId | Unique identifier for the server node. |
client | Pointer to the client Node |
server | Pointer to the server Node |
clientId | ID of the client node |
serverId | ID of the server node |
Definition at line 42 of file zt-tls-handshake.cc.
|
private |
Optional external logger.
Definition at line 83 of file zt-tls-handshake.h.
|
private |
Optional external policy validator.
Definition at line 84 of file zt-tls-handshake.h.
|
private |
Maps node IDs to session keys.
Definition at line 82 of file zt-tls-handshake.h.