2018-08-05 15:09:07 +00:00
|
|
|
#pragma once
|
2021-09-28 11:15:54 +00:00
|
|
|
#include "types.h"
|
|
|
|
#include "KeyBag.h"
|
|
|
|
|
2022-06-29 13:19:36 +00:00
|
|
|
#include <pietendo/hac/es/SignedData.h>
|
|
|
|
#include <pietendo/hac/es/CertificateBody.h>
|
2021-09-28 11:15:54 +00:00
|
|
|
|
|
|
|
namespace nstool {
|
2018-08-05 15:09:07 +00:00
|
|
|
|
|
|
|
class PkiValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PkiValidator();
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
void setKeyCfg(const KeyBag& keycfg);
|
2022-06-29 13:19:36 +00:00
|
|
|
void addCertificates(const std::vector<pie::hac::es::SignedData<pie::hac::es::CertificateBody>>& certs);
|
|
|
|
void addCertificate(const pie::hac::es::SignedData<pie::hac::es::CertificateBody>& cert);
|
2018-08-05 15:09:07 +00:00
|
|
|
void clearCertificates();
|
|
|
|
|
2022-06-29 13:19:36 +00:00
|
|
|
void validateSignature(const std::string& issuer, pie::hac::es::sign::SignatureId signature_id, const tc::ByteData& signature, const tc::ByteData& hash) const;
|
2018-08-05 15:09:07 +00:00
|
|
|
|
|
|
|
private:
|
2021-09-30 11:40:45 +00:00
|
|
|
std::string mModuleName;
|
2018-08-05 15:09:07 +00:00
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
KeyBag mKeyCfg;
|
2022-06-29 13:19:36 +00:00
|
|
|
std::vector<pie::hac::es::SignedData<pie::hac::es::CertificateBody>> mCertificateBank;
|
2018-08-05 15:09:07 +00:00
|
|
|
|
2022-06-29 13:19:36 +00:00
|
|
|
void makeCertIdent(const pie::hac::es::SignedData<pie::hac::es::CertificateBody>& cert, std::string& ident) const;
|
2018-08-05 15:09:07 +00:00
|
|
|
void makeCertIdent(const std::string& issuer, const std::string& subject, std::string& ident) const;
|
|
|
|
bool doesCertExist(const std::string& ident) const;
|
2022-06-29 13:19:36 +00:00
|
|
|
const pie::hac::es::SignedData<pie::hac::es::CertificateBody>& getCert(const std::string& ident) const;
|
2021-09-28 11:15:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|