154aa6d63Sopenharmony_ci/* 254aa6d63Sopenharmony_ci * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 354aa6d63Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 454aa6d63Sopenharmony_ci * you may not use this file except in compliance with the License. 554aa6d63Sopenharmony_ci * You may obtain a copy of the License at 654aa6d63Sopenharmony_ci * 754aa6d63Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 854aa6d63Sopenharmony_ci * 954aa6d63Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1054aa6d63Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1154aa6d63Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1254aa6d63Sopenharmony_ci * See the License for the specific language governing permissions and 1354aa6d63Sopenharmony_ci * limitations under the License. 1454aa6d63Sopenharmony_ci */ 1554aa6d63Sopenharmony_ci 1654aa6d63Sopenharmony_ci#ifndef SIGNATRUETOOLS_CONSTANT_H 1754aa6d63Sopenharmony_ci#define SIGNATRUETOOLS_CONSTANT_H 1854aa6d63Sopenharmony_ci 1954aa6d63Sopenharmony_ci#include <stdint.h> 2054aa6d63Sopenharmony_ci#include <string> 2154aa6d63Sopenharmony_ci 2254aa6d63Sopenharmony_cinamespace OHOS { 2354aa6d63Sopenharmony_cinamespace SignatureTools { 2454aa6d63Sopenharmony_ciconst char APP_SIGNING_CAPABILITY[] = {0x30, 0x06, 0x02, 0x01, 0x01, 0x0A, 0x01, 0x00}; 2554aa6d63Sopenharmony_ciconst char PROFILE_SIGNING_CAPABILITY[] = {0x30, 0x06, 0x02, 0x01, 0x01, 0x0A, 0x01, 0x01}; 2654aa6d63Sopenharmony_ci 2754aa6d63Sopenharmony_ciconstexpr long DEFAULT_START_VALIDITY = 0; 2854aa6d63Sopenharmony_ciconstexpr long ONE_DAY_TIME = 86400; 2954aa6d63Sopenharmony_ciconstexpr long DEFAULT_CERT_VERSION = 2; 3054aa6d63Sopenharmony_ci 3154aa6d63Sopenharmony_ciconstexpr int NIST_P_256 = 256; 3254aa6d63Sopenharmony_ciconstexpr int NIST_P_384 = 384; 3354aa6d63Sopenharmony_ciconstexpr int DEFAULT_VALIDITY_DAYS = 3650; 3454aa6d63Sopenharmony_ciconstexpr int INVALIDCHAR = 3; 3554aa6d63Sopenharmony_ciconstexpr int DEFAULT_BASIC_CONSTRAINTS_PATH_LEN = 0; 3654aa6d63Sopenharmony_ciconstexpr int RANDOM_SERIAL_NUMBER_LENGTH = 32; 3754aa6d63Sopenharmony_ciconstexpr int DEFAULT_CUSTOM_VALIDITY_DAYS = 1095; 3854aa6d63Sopenharmony_ci 3954aa6d63Sopenharmony_ciconst bool DEFAULT_KEY_USAGE_CRITICAL = true; 4054aa6d63Sopenharmony_ciconst bool DEFAULT_EXT_KEY_USAGE_CRITICAL = false; 4154aa6d63Sopenharmony_ciconst bool DEFAULT_BASIC_CONSTRAINTS = false; 4254aa6d63Sopenharmony_ciconst bool DEFAULT_BASIC_CONSTRAINTS_CRITICAL = false; 4354aa6d63Sopenharmony_ciconst bool DEFAULT_BASIC_CONSTRAINTS_CA = false; 4454aa6d63Sopenharmony_ci 4554aa6d63Sopenharmony_ciconst std::string SIGN_ALG_SHA256 = "SHA256withECDSA"; 4654aa6d63Sopenharmony_ciconst std::string SIGN_ALG_SHA384 = "SHA384withECDSA"; 4754aa6d63Sopenharmony_ciconst std::string DEFAULT_BASIC_EXTENSION = "critical,CA:FALSE"; 4854aa6d63Sopenharmony_ciconst std::string DEFAULT_KEYUSAGE_EXTENSION = "digitalSignature"; 4954aa6d63Sopenharmony_ciconst std::string DEFAULT_EXTEND_KEYUSAGE = "codeSigning"; 5054aa6d63Sopenharmony_ciconst std::string NID_BASIC_CONST = "basicConstraints"; 5154aa6d63Sopenharmony_ciconst std::string NID_KEYUSAGE_CONST = "keyUsage"; 5254aa6d63Sopenharmony_ciconst std::string NID_EXT_KEYUSAGE_CONST = "extendedKeyUsage"; 5354aa6d63Sopenharmony_ciconst std::string PKCS7_EXT_SIGNATURE_OID = "1.2.840.113549.1.1.10"; 5454aa6d63Sopenharmony_ciconst std::string X509_EXT_OID = "1.3.6.1.4.1.2011.2.376.1.3"; 5554aa6d63Sopenharmony_ciconst std::string OWNERID_OID = "1.3.6.1.4.1.2011.2.376.1.4.1"; // SIGNED_ID 5654aa6d63Sopenharmony_ciconst std::string OWNERID_OID_SHORT_NAME = "ownerID"; 5754aa6d63Sopenharmony_ciconst std::string OWNERID_OID_LONG_NAME = "Code Signature Owner ID"; 5854aa6d63Sopenharmony_ciconst std::string DEFAULT_PROFILE_SIGNED_1 = "1"; 5954aa6d63Sopenharmony_ciconst std::string DEFAULT_PROFILE_SIGNED_0 = "0"; 6054aa6d63Sopenharmony_ciconst std::string ZIP = "zip"; 6154aa6d63Sopenharmony_ciconst std::string ELF = "elf"; 6254aa6d63Sopenharmony_ciconst std::string BIN = "bin"; 6354aa6d63Sopenharmony_ciconst std::string OUT_FORM_CERT = "cert"; 6454aa6d63Sopenharmony_ciconst std::string OUT_FORM_CERT_CHAIN = "certChain"; 6554aa6d63Sopenharmony_ciconst std::string DEBUG_STR = "debug"; 6654aa6d63Sopenharmony_ciconst std::string DEBUG_LIB_ID = "DEBUG_LIB_ID"; 6754aa6d63Sopenharmony_ciconst std::string REMOTE_SIGN = "remoteSign"; 6854aa6d63Sopenharmony_ciconst std::string LOCAL_SIGN = "localSign"; 6954aa6d63Sopenharmony_ci 7054aa6d63Sopenharmony_ci//Corresponding to each functional module 7154aa6d63Sopenharmony_ciconst std::string GENERATE_KEYPAIR = "generate-keypair"; 7254aa6d63Sopenharmony_ciconst std::string GENERATE_CSR = "generate-csr"; 7354aa6d63Sopenharmony_ciconst std::string GENERATE_CA = "generate-ca"; 7454aa6d63Sopenharmony_ciconst std::string GENERATE_CERT = "generate-cert"; 7554aa6d63Sopenharmony_ciconst std::string GENERATE_APP_CERT = "generate-app-cert"; 7654aa6d63Sopenharmony_ciconst std::string GENERATE_PROFILE_CERT = "generate-profile-cert"; 7754aa6d63Sopenharmony_ciconst std::string SIGN_APP = "sign-app"; 7854aa6d63Sopenharmony_ciconst std::string SIGN_PROFILE = "sign-profile"; 7954aa6d63Sopenharmony_ciconst std::string VERIFY_APP = "verify-app"; 8054aa6d63Sopenharmony_ciconst std::string VERIFY_PROFILE = "verify-profile"; 8154aa6d63Sopenharmony_ci 8254aa6d63Sopenharmony_ciconstexpr int32_t ONE_DAY_HOUR = 24; 8354aa6d63Sopenharmony_ciconstexpr int32_t ONE_DAY_MINUTE = 60; 8454aa6d63Sopenharmony_ciconstexpr int32_t ONE_DAY_SECOND = 60; 8554aa6d63Sopenharmony_ci 8654aa6d63Sopenharmony_cistatic constexpr int YEAR1900 = 1900; 8754aa6d63Sopenharmony_cistatic constexpr int MIN_CERTS_NUM = 2; 8854aa6d63Sopenharmony_cistatic constexpr int MAX_CERTS_NUM = 3; 8954aa6d63Sopenharmony_ci} // namespace UpdateEngine 9054aa6d63Sopenharmony_ci} // namespace OHOS 9154aa6d63Sopenharmony_ci#endif // SIGNATRUETOOLS_CONSTANT_H