Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / security / step_signature.h
1 // Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMMON_STEP_SECURITY_STEP_SIGNATURE_H_
6 #define COMMON_STEP_SECURITY_STEP_SIGNATURE_H_
7
8 #include <manifest_parser/utils/logging.h>
9
10 #include <filesystem>
11 #include <memory>
12
13 #include "common/installer_context.h"
14 #include "common/step/step.h"
15 #include "common/signature.h"
16
17 namespace common_installer {
18 namespace security {
19
20 /**
21  * \brief Step responsible for checking signature of given package and
22  *        saving certificates into individual files to restore certificate database.
23  *        Used by WGT and TPK backend
24  */
25 class StepSignature : public Step {
26  public:
27   using Step::Step;
28
29   StepSignature(InstallerContext* context, bool save_signature)
30       : Step(context), save_signature_(save_signature) {}
31
32   Status process() override;
33   Status undo() override;
34   Status clean() override;
35   Status precheck() override;
36
37  protected:
38   virtual std::filesystem::path GetSignatureRoot() const;
39   virtual Status CheckPrivilegeLevel(PrivilegeLevel level);
40
41  private:
42   bool save_signature_;
43   std::filesystem::path backup_path_;
44   std::unique_ptr<Signature> signature_;
45
46   STEP_NAME(Signature)
47 };
48
49 }  // namespace security
50 }  // namespace common_installer
51
52 #endif  // COMMON_STEP_SECURITY_STEP_SIGNATURE_H_