-
Notifications
You must be signed in to change notification settings - Fork 2
/
default-cert-manager.h
43 lines (29 loc) · 1.29 KB
/
default-cert-manager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by Tyler on 8/8/20.
//
#ifndef DLEDGER_DEFAULT_CERT_MANAGER_H
#define DLEDGER_DEFAULT_CERT_MANAGER_H
#include <unordered_set>
#include "dledger/cert-manager.hpp"
using namespace ndn;
namespace dledger {
class DefaultCertificateManager : public CertificateManager {
public:
DefaultCertificateManager(const Name &peerPrefix,
shared_ptr<security::Certificate> anchorCert,
const std::list<security::Certificate> &startingPeers);
bool verifySignature(const Data &data) const override;
bool verifyRecordFormat(const Record &record) const override;
bool endorseSignature(const Data &data) const override;
bool verifySignature(const Interest &interest) const override;
void acceptRecord(const Record &record) override;
bool authorizedToGenerate() const override;
private:
Name getCertificateNameIdentity(const Name &certificateName) const;
Name m_peerPrefix;
std::shared_ptr<security::Certificate> m_anchorCert;
std::map<Name, std::list<security::Certificate>> m_peerCertificates; // first: name of the peer, second: certificate
std::unordered_set<Name> m_revokedCertificates;
};
};
#endif //DLEDGER_DEFAULT_CERT_MANAGER_H