nstool/src/PkiValidator.h

34 lines
1.1 KiB
C
Raw Permalink Normal View History

#pragma once
#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>
namespace nstool {
class PkiValidator
{
public:
PkiValidator();
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);
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;
private:
2021-09-30 11:40:45 +00:00
std::string mModuleName;
KeyBag mKeyCfg;
2022-06-29 13:19:36 +00:00
std::vector<pie::hac::es::SignedData<pie::hac::es::CertificateBody>> mCertificateBank;
2022-06-29 13:19:36 +00:00
void makeCertIdent(const pie::hac::es::SignedData<pie::hac::es::CertificateBody>& cert, std::string& ident) const;
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;
};
}