#include "common/step/security/step_revoke_trust_anchor.h"
#include <trust-anchor.h>
-#include <boost/filesystem.hpp>
+#include <filesystem>
#include <string>
#include "common/utils/file_util.h"
namespace common_installer {
namespace security {
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
if (!manifest->use_system_certs)
return Step::Status::OK;
- bf::path pkg_certs_path = context_->GetPkgPath() / kTpkTrustAnchorPath;
+ fs::path pkg_certs_path = context_->GetPkgPath() / kTpkTrustAnchorPath;
if (!context_->pkg_type.get().compare(kWgt)) {
// For wgt package,
// create [pkg_root]/res/.trust-anchor directory and create symbolic link
- if (bf::exists(pkg_certs_path)) {
- for (bf::directory_iterator file(pkg_certs_path);
- file != bf::directory_iterator(); ++file) {
- bf::path current(file->path());
- if (bf::is_symlink(symlink_status(current))) {
- if (!bf::remove(current)) {
+ if (fs::exists(pkg_certs_path)) {
+ for (fs::directory_iterator file(pkg_certs_path);
+ file != fs::directory_iterator(); ++file) {
+ fs::path current(file->path());
+ if (fs::is_symlink(symlink_status(current))) {
+ if (!fs::remove(current)) {
LOG(ERROR) << "Failed to remove previous symlink : " << current;
return Step::Status::APP_DIR_ERROR;
}
return Step::Status::APP_DIR_ERROR;
}
- bf::path pkg_certs_src_path =
+ fs::path pkg_certs_src_path =
context_->GetPkgPath() / "res/wgt" / kWgtTrustAnchorPath;
- for (bf::directory_iterator file(pkg_certs_src_path);
- file != bf::directory_iterator(); ++file) {
- bf::path current(file->path());
+ for (fs::directory_iterator file(pkg_certs_src_path);
+ file != fs::directory_iterator(); ++file) {
+ fs::path current(file->path());
try {
- bf::create_symlink(current, pkg_certs_path / current.filename());
- } catch (const bf::filesystem_error& error) {
+ fs::create_symlink(current, pkg_certs_path / current.filename());
+ } catch (const fs::filesystem_error& error) {
LOG(ERROR) << "Failed to make trust anchor symlink : " << error.what();
return Step::Status::APP_DIR_ERROR;
}
}
int ret = trust_anchor_install(context_->pkgid.get().c_str(),
- context_->uid.get(), pkg_certs_path.string().c_str(),
+ context_->uid.get(), pkg_certs_path.c_str(),
(strcasecmp(manifest->use_system_certs, "true") == 0) ? true : false);
if (ret != TRUST_ANCHOR_ERROR_NONE) {