![]() |
Zero Trust IoT library
|
Simulates a Zero Trust policy engine that enforces access control using certificates. More...
#include <zt-certificate.h>
Public Member Functions | |
void | SetCaPublicKey (CryptoPP::RSA::PublicKey pub) |
Sets the CA's public key used for certificate verification. | |
void | Revoke (uint32_t nodeId) |
Revokes a node by its ID, preventing it from being authorized. | |
bool | Authorize (uint32_t nodeId, const std::string &role, const std::string &certStr) |
Authorizes a node based on its certificate. | |
Private Attributes | |
CryptoPP::RSA::PublicKey | caPublicKey |
Trusted public key used for signature verification. | |
std::unordered_set< uint32_t > | revoke |
Set of node IDs that are explicitly revoked. | |
Simulates a Zero Trust policy engine that enforces access control using certificates.
This engine validates node certificates, verifies digital signatures, checks role and expiry, and maintains a list of revoked node IDs.
Definition at line 51 of file zt-certificate.h.
bool ZtPolicyEngineWithCert::Authorize | ( | uint32_t | nodeId, |
const std::string & | role, | ||
const std::string & | certStr | ||
) |
Authorizes a node based on its certificate.
Verifies and authorizes a node based on its certificate.
nodeId | The node's claimed ID. |
role | The role the node claims to perform. |
certStr | The certificate string presented by the node. |
nodeId | ID of the node attempting access |
role | Role of the node |
certStr | Certificate string to validate |
Definition at line 79 of file zt-certificate.cc.
void ZtPolicyEngineWithCert::Revoke | ( | uint32_t | nodeId | ) |
Revokes a node by its ID, preventing it from being authorized.
Revokes access for a specific node.
nodeId | The node ID to be added to the revocation list. |
nodeId | ID of the node to be revoked |
Definition at line 68 of file zt-certificate.cc.
void ZtPolicyEngineWithCert::SetCaPublicKey | ( | CryptoPP::RSA::PublicKey | pub | ) |
Sets the CA's public key used for certificate verification.
Sets the CA public key for the policy engine.
pub | The public RSA key of the trusted Certificate Authority. |
pub | RSA public key of the certificate authority |
Definition at line 60 of file zt-certificate.cc.
|
private |
Trusted public key used for signature verification.
Definition at line 75 of file zt-certificate.h.
|
private |
Set of node IDs that are explicitly revoked.
Definition at line 76 of file zt-certificate.h.