![]() |
Zero Trust IoT library
|
Implements policy enforcement for Zero Trust security in NS-3 simulations. More...
#include <zt-policy-engine.h>
Public Member Functions | |
| void | AddAuthorized (uint32_t nodeId, const std::string &role) |
| Add a node to the authorized list with a specified role. | |
| bool | Authorize (uint32_t nodeId, const std::string &role) |
| Check if a node is authorized for a given role. | |
| void | SetCaPublicKey (RSA::PublicKey pub) |
| Set the Certificate Authority's public key for verifying digital signatures. | |
| void | Revoke (uint32_t nodeId) |
| Add a node ID to the revocation list. | |
| bool | AuthorizeWithCert (uint32_t nodeId, const std::string &role, const std::string &certStr) |
| Perform certificate-based authorization for a node. | |
Static Public Member Functions | |
| static TypeId | GetTypeId () |
| Get the TypeId for ZtPolicyEngine. | |
Private Attributes | |
| std::unordered_map< uint32_t, std::string > | authTable |
| Maps node ID to assigned role. | |
| std::unordered_set< uint32_t > | revoke |
| List of revoked node IDs. | |
| RSA::PublicKey | caPublicKey |
| Public key for certificate signature verification. | |
Implements policy enforcement for Zero Trust security in NS-3 simulations.
The ZtPolicyEngine class is responsible for enforcing identity-based access control, managing certificate validation, revocations, and dynamic role-based authorization.
Definition at line 22 of file zt-policy-engine.h.
| void ns3::ZtPolicyEngine::AddAuthorized | ( | uint32_t | nodeId, |
| const std::string & | role | ||
| ) |
Add a node to the authorized list with a specified role.
Add an authorized node and its assigned role.
| nodeId | The node ID to authorize. |
| role | The role assigned to the node (e.g., "sensor", "gateway"). |
| nodeId | The ID of the node. |
| role | The assigned role for the node (e.g., "sensor", "gateway"). |
Definition at line 32 of file zt-policy-engine.cc.
| bool ns3::ZtPolicyEngine::Authorize | ( | uint32_t | nodeId, |
| const std::string & | role | ||
| ) |
Check if a node is authorized for a given role.
Check if a node is authorized based on its ID and expected role.
| nodeId | The ID of the requesting node. |
| role | The required role for access. |
| nodeId | The ID of the node requesting access. |
| role | The expected role the node must have. |
Definition at line 42 of file zt-policy-engine.cc.
| bool ns3::ZtPolicyEngine::AuthorizeWithCert | ( | uint32_t | nodeId, |
| const std::string & | role, | ||
| const std::string & | certStr | ||
| ) |
Perform certificate-based authorization for a node.
Authorize a node using certificate validation.
This checks:
| nodeId | The ID of the requesting node. |
| role | The required role for access. |
| certStr | The certificate string (including fields and base64-encoded signature). |
This function checks:
| nodeId | The ID of the node requesting access. |
| role | The expected role for the node. |
| certStr | The full certificate string including signature. |
Definition at line 76 of file zt-policy-engine.cc.
|
static |
Get the TypeId for ZtPolicyEngine.
Definition at line 19 of file zt-policy-engine.cc.
| void ns3::ZtPolicyEngine::Revoke | ( | uint32_t | nodeId | ) |
Add a node ID to the revocation list.
Revoke a node by adding its ID to the revocation list.
| nodeId | The ID of the node to revoke. |
| nodeId | The ID of the node to be revoked. |
Definition at line 58 of file zt-policy-engine.cc.
| void ns3::ZtPolicyEngine::SetCaPublicKey | ( | RSA::PublicKey | pub | ) |
Set the Certificate Authority's public key for verifying digital signatures.
Set the public key of the Certificate Authority used for signature verification.
| pub | The RSA public key of the CA. |
Definition at line 50 of file zt-policy-engine.cc.
|
private |
Maps node ID to assigned role.
Definition at line 74 of file zt-policy-engine.h.
|
private |
Public key for certificate signature verification.
Definition at line 76 of file zt-policy-engine.h.
|
private |
List of revoked node IDs.
Definition at line 75 of file zt-policy-engine.h.