nstool/src/PkiCertProcess.h

45 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
#include <fnd/IFile.h>
#include <fnd/SharedPtr.h>
#include <fnd/List.h>
#include <fnd/Vec.h>
2018-08-07 07:17:51 +00:00
#include <nn/pki/SignedData.h>
#include <nn/pki/CertificateBody.h>
#include "KeyConfiguration.h"
#include "common.h"
class PkiCertProcess
{
public:
PkiCertProcess();
void process();
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
void setKeyCfg(const KeyConfiguration& keycfg);
void setCliOutputMode(CliOutputMode type);
void setVerifyMode(bool verify);
private:
const std::string kModuleName = "PkiCertProcess";
static const size_t kSmallHexDumpLen = 0x10;
fnd::SharedPtr<fnd::IFile> mFile;
KeyConfiguration mKeyCfg;
CliOutputMode mCliOutputMode;
bool mVerify;
2018-08-07 08:13:18 +00:00
fnd::List<nn::pki::SignedData<nn::pki::CertificateBody>> mCert;
void importCerts();
void validateCerts();
void displayCerts();
2018-08-07 08:13:18 +00:00
void displayCert(const nn::pki::SignedData<nn::pki::CertificateBody>& cert);
size_t getHexDumpLen(size_t max_size) const;
2018-08-07 08:13:18 +00:00
const char* getSignTypeStr(nn::pki::sign::SignatureId type) const;
const char* getEndiannessStr(bool isLittleEndian) const;
2018-08-07 08:13:18 +00:00
const char* getPublicKeyTypeStr(nn::pki::cert::PublicKeyType type) const;
};