step/security/step_check_signature.cc
step/security/step_privilege_compatibility.cc
step/security/step_recover_security.cc
+ step/security/step_recover_signature.cc
step/security/step_register_security.cc
step/security/step_revoke_security.cc
step/security/step_rollback_deinstallation_security.cc
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "common/step/security/step_recover_signature.h"
+
+#include <string>
+
+#include "common/certificate_validation.h"
+
+namespace common_installer {
+namespace security {
+
+Step::Status StepRecoverSignature::RecoveryUpdate() {
+ std::string error_message;
+ PrivilegeLevel level;
+ if (!ValidateSignatures(GetSignatureRoot(), &level,
+ &context_->certificate_info.get(), false,
+ false, &error_message)) {
+ LOG(ERROR) << "Failed to verify signature: " << error_message;
+ return Status::CERT_ERROR;
+ }
+ return Status::OK;
+}
+
+} // namespace security
+} // namespace common_installer
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_STEP_SECURITY_STEP_RECOVER_SIGNATURE_H_
+#define COMMON_STEP_SECURITY_STEP_RECOVER_SIGNATURE_H_
+
+#include <boost/filesystem/path.hpp>
+#include <manifest_parser/utils/logging.h>
+
+#include "common/installer_context.h"
+#include "common/step/recovery/step_recovery.h"
+
+namespace common_installer {
+namespace security {
+
+/**
+ * @brief responsible for restoring security
+ * rules
+ *
+ * Part of Recovery Mode. In case of partial
+ * installation security rules get unregistered
+ * In case of unsuccessful partial update
+ * security rules for the app before update
+ * gets restored
+ */
+class StepRecoverSignature : public recovery::StepRecovery {
+ public:
+ using StepRecovery::StepRecovery;
+
+ Status RecoveryNew() override { return Status::OK; }
+ Status RecoveryUpdate() override;
+
+ private:
+ virtual boost::filesystem::path GetSignatureRoot() = 0;
+
+ STEP_NAME(RecoverSignature)
+};
+
+} // namespace security
+} // namespace common_installer
+
+#endif // COMMON_STEP_SECURITY_STEP_RECOVER_SIGNATURE_H_