#pragma once #include "types.h" #include "KeyBag.h" #include #include namespace nstool { class PkiValidator { public: PkiValidator(); void setKeyCfg(const KeyBag& keycfg); void addCertificates(const std::vector>& certs); void addCertificate(const nn::pki::SignedData& cert); void clearCertificates(); void validateSignature(const std::string& issuer, nn::pki::sign::SignatureId signature_id, const tc::ByteData& signature, const tc::ByteData& hash) const; private: std::string mModuleName; KeyBag mKeyCfg; std::vector> mCertificateBank; void makeCertIdent(const nn::pki::SignedData& 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; const nn::pki::SignedData& getCert(const std::string& ident) const; }; }