Zero Trust IoT library
Loading...
Searching...
No Matches
zt-policy-engine.h
Go to the documentation of this file.
1// === zt-policy-engine.h ===
2#ifndef ZT_POLICY_ENGINE_H
3#define ZT_POLICY_ENGINE_H
4
5#include <string>
6#include <unordered_map>
7#include <unordered_set>
8#include <ns3/object.h>
9#include <cryptopp/rsa.h>
10
11using namespace CryptoPP;
12
13namespace ns3 {
14
22class ZtPolicyEngine : public Object {
23public:
28 static TypeId GetTypeId();
29
35 void AddAuthorized(uint32_t nodeId, const std::string& role);
36
43 bool Authorize(uint32_t nodeId, const std::string& role);
44
49 void SetCaPublicKey(RSA::PublicKey pub);
50
55 void Revoke(uint32_t nodeId);
56
71 bool AuthorizeWithCert(uint32_t nodeId, const std::string& role, const std::string& certStr);
72
73private:
74 std::unordered_map<uint32_t, std::string> authTable;
75 std::unordered_set<uint32_t> revoke;
76 RSA::PublicKey caPublicKey;
77};
78
79} // namespace ns3
80
81#endif // ZT_POLICY_ENGINE_H
82
Implements policy enforcement for Zero Trust security in NS-3 simulations.
void AddAuthorized(uint32_t nodeId, const std::string &role)
Add a node to the authorized list with a specified role.
std::unordered_set< uint32_t > revoke
List of revoked node IDs.
std::unordered_map< uint32_t, std::string > authTable
Maps node ID to assigned role.
static TypeId GetTypeId()
Get the TypeId for ZtPolicyEngine.
void Revoke(uint32_t nodeId)
Add a node ID to the revocation list.
bool Authorize(uint32_t nodeId, const std::string &role)
Check if a node is authorized for a given role.
RSA::PublicKey caPublicKey
Public key for certificate signature verification.
void SetCaPublicKey(RSA::PublicKey pub)
Set the Certificate Authority's public key for verifying digital signatures.
bool AuthorizeWithCert(uint32_t nodeId, const std::string &role, const std::string &certStr)
Perform certificate-based authorization for a node.