IOS/ES: Add helper function ReadCertStore

This commit is contained in:
Léo Lam 2017-06-11 22:01:41 +02:00
parent 88348e2903
commit f3bf1d626c
2 changed files with 14 additions and 0 deletions

View File

@ -781,6 +781,19 @@ bool ES::IsIssuerCorrect(VerifyContainerType type, const IOS::ES::CertReader& is
}
}
ReturnCode ES::ReadCertStore(std::vector<u8>* buffer) const
{
const std::string store_path = Common::RootUserPath(Common::FROM_SESSION_ROOT) + "/sys/cert.sys";
File::IOFile store_file{store_path, "rb"};
if (!store_file)
return FS_ENOENT;
buffer->resize(store_file.GetSize());
if (!store_file.ReadBytes(buffer->data(), buffer->size()))
return ES_SHORT_READ;
return IPC_SUCCESS;
}
ReturnCode ES::WriteNewCertToStore(const IOS::ES::CertReader& cert)
{
const std::string store_path = Common::RootUserPath(Common::FROM_SESSION_ROOT) + "/sys/cert.sys";

View File

@ -319,6 +319,7 @@ private:
UpdateCertStore,
};
bool IsIssuerCorrect(VerifyContainerType type, const IOS::ES::CertReader& issuer_cert) const;
ReturnCode ReadCertStore(std::vector<u8>* buffer) const;
ReturnCode WriteNewCertToStore(const IOS::ES::CertReader& cert);
ReturnCode VerifyContainer(VerifyContainerType type, VerifyMode mode,
const IOS::ES::SignedBlobReader& signed_blob,