1 /*
2  * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SIGNATRUETOOLS_HAP_SIGN_TOOL_H
17 #define SIGNATRUETOOLS_HAP_SIGN_TOOL_H
18 
19 #include <unordered_map>
20 #include <string>
21 #include <vector>
22 
23 #include "cmd_util.h"
24 #include "sign_tool_service_impl.h"
25 #include "signature_tools_log.h"
26 #include "params_trust_list.h"
27 #include "string_utils.h"
28 
29 namespace OHOS {
30 namespace SignatureTools {
31 class ParamsRunTool final {
32 public:
33     ParamsRunTool() = delete;
34     static bool ProcessCmd(char** args, size_t size);
35     static bool DispatchParams(const ParamsSharedPtr& params, SignToolServiceImpl& api);
36     static bool CallGenerators(const ParamsSharedPtr& params, SignToolServiceImpl& api);
37     static bool RunKeypair(Options* params, SignToolServiceImpl& api);
38     static bool RunCa(Options* params, SignToolServiceImpl& api);
39     static bool RunCert(Options* params, SignToolServiceImpl& api);
40     static bool RunAppCert(Options* params, SignToolServiceImpl& api);
41     static bool RunProfileCert(Options* params, SignToolServiceImpl& api);
42     static bool RunCsr(Options* params, SignToolServiceImpl& api);
43     static bool RunSignProfile(Options* params, SignToolServiceImpl& api);
44     static bool RunSignApp(Options* params, SignToolServiceImpl& api);
45     static bool RunVerifyProfile(Options* params, SignToolServiceImpl& api);
46     static bool RunVerifyApp(Options* params, SignToolServiceImpl& api);
47     static bool CheckEndCertArguments(Options& params);
48     static bool CheckProfile(Options& params);
49     static void PrintHelp();
50     static void Version();
51 
52 public:
53     static std::vector<std::string> InformList;
54 
55 private:
56     static const std::string VERSION;
57 };
58 } // namespace SignatureTools
59 } // namespace OHOS
60 #endif // SIGNATRUETOOLS_HAP_SIGN_TOOL_H
61