1 /* 2 * Copyright (c) 2025-2025 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 #ifndef HELP_H 16 #define HELP_H 17 18 #include <string> 19 /* this file use to create help.txt content and 20 * it is divided into 12 strings according 21 * to the functional module 22 */ 23 namespace OHOS { 24 namespace SignatureTools { 25 26 const std::string HELP_TXT_HEADER = R"( 27 USAGE: <sign|display-sign>[options] 28 )"; 29 30 const std::string SIGN_HELP_TXT = R"( 31 sign[options]: 32 -keyAlias : key alias, required fields; 33 -keyPwd : key password, optional fields on localSign mode; 34 -appCertFile : application signature certificate file, required fields on localSign mode, optional fields 35 on remoteSign mode; 36 -profileFile : signed Provision Profile file, p7b format, required fields; 37 -profileSigned : indicates whether the profile file has a signature.The options are as follows 38 : 1 : yes; 0:no; default value:1. optional fields; 39 -inFile : input original elf file, required fields; 40 -signAlg : signature algorithm, required fields, including SHA256withECDSA/SHA384withECDSA; 41 -keystoreFile : keystore file, if signature mode is localSign, required fields on localSign mode, 42 JKS or P12 format; 43 -keystorePwd : keystore password, optional fields on localSign mode; 44 -outFile : output the signed Provision Profile file, required fields; 45 -moduleFile : module.json file. 46 -selfSign : Whether the elf file is self sign, The value 1 means enable self sign, and value 0 means disable. 47 The default value is 0. It is optional. 48 49 EXAMPLE : 50 sign -keyAlias "oh-app1-key-v1" -appCertFile "/home/app-release-cert.cer" -signCode "1" 51 -keystoreFile "/home/app-keypair.jks" -keystorePwd ****** -outFile "signed.elf" 52 -profileFile "/home/signed-profile.p7b" -inFile "unsigned.elf" -signAlg SHA256withECDSA 53 )"; 54 55 const std::string VERIFY_HELP_TXT = R"( 56 display-sign[options]: 57 -inFile : display-sign elf file sign information, required fields; 58 59 EXAMPLE: 60 display-sign -inFile "signed.elf" 61 )"; 62 63 const std::string HELP_END_TXT = R"( 64 COMMANDS : 65 sign : elf file signature 66 display-sign : display elf file signature 67 )"; 68 /* help.txt all content */ 69 const std::string HELP_TXT = HELP_TXT_HEADER + SIGN_HELP_TXT + VERIFY_HELP_TXT + HELP_END_TXT; 70 } 71 } 72 #endif