|
|
|
@ -153,14 +153,29 @@ namespace SignedPackage {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void decrypt_archive(
|
|
|
|
|
std::filesystem::path archive,
|
|
|
|
|
std::filesystem::path key,
|
|
|
|
|
CryptoPP::PrivateKey& provisioning_key
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::filesystem::path extract_deployment_archive(
|
|
|
|
|
CryptoPP::PublicKey& deployment_key,
|
|
|
|
|
CryptoPP::PrivateKey& provisioning_key,
|
|
|
|
|
std::string pkg_path
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
std::filesystem::path target_path = mktempdir();
|
|
|
|
|
extract_archive(pkg_path, target_path, { "DIST.A", "DIST.KEY", "DIST.SIG" });
|
|
|
|
|
check_signature(target_path / "DIST.A", target_path / "DIST.SIG", deployment_key);
|
|
|
|
|
|
|
|
|
|
extract_archive(pkg_path, target_path, { "DIST.A", "DIST.KEY",
|
|
|
|
|
"DIST.SIG" });
|
|
|
|
|
check_signature(target_path / "DIST.A", target_path / "DIST.SIG",
|
|
|
|
|
deployment_key);
|
|
|
|
|
decrypt_archive(target_path / "DIST.A", target_path / "DIST.KEY",
|
|
|
|
|
provisioning_key);
|
|
|
|
|
|
|
|
|
|
return target_path;
|
|
|
|
|
}
|
|
|
|
@ -172,8 +187,11 @@ namespace SignedPackage {
|
|
|
|
|
std::string target_path
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
std::string tmp_path = extract_deployment_archive(deployment_key, pkg_path);
|
|
|
|
|
std::string tmp_path = extract_deployment_archive(deployment_key,
|
|
|
|
|
provisioning_key, pkg_path);
|
|
|
|
|
ensure_target_path(target_path);
|
|
|
|
|
|
|
|
|
|
std::filesystem::remove_all(tmp_path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void provision_system(
|
|
|
|
|