1e41f4b71Sopenharmony_ci# hapsigner Overview 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe OpenHarmony apps and debug tools must be signed to ensure their integrity and trusted source. Only signed apps and debug tools can be installed, run, debugged, and used on devices. [developtools_hapsigner](https://gitee.com/openharmony/developtools_hapsigner) provides the source code of the signing tool hapsigner, including the code for generating a key pair, a certificate signing request (CSR), a certificate, and signing a profile, an app package, and a debug tool. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciThe mandatory code signing mechanism provides validity check and integrity protection for apps in runtime, eliminating execution of malicious code on devices and tampering of app code by attackers. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciCode signing is enabled by default for hapsigner. If you do not need the mandatory code signing feature, you can disable it as required. Currently, hapsigner can be used to sign binary tools and app packages in .hap, .hsp, and .hqf formats only. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci> **NOTE** 10e41f4b71Sopenharmony_ci> 11e41f4b71Sopenharmony_ci> For the apps that do not need to apply for permissions via the ACL, DevEco Studio provides an auto signing solution to implement one-click signing of apps/services. For details, see [Having Your App Automatically Signed](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465). 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci## Basic Concepts 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciThe hapsigner tool is implemented based on the Public Key Infrastructure (PKI). Before using this tool, you need to understand the following concepts: 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci - Asymmetric key pair 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci The asymmetric key algorithm is the basis of data signing and signature verification. The hapsigner tool can generate standard asymmetric key pairs, including ECC P384/256 and RSA 2048/3072/4096. 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci - CSR 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci The CSR contains the public key, subject, and private key signature of a certificate. Before applying for a certificate, you must generate a CSR based on the key pair and submit the CSR to the Certificate Authority (CA). 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci - Certificate 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci OpenHarmony uses the RFC5280 standard to build the X.509 certificate trust system. The OpenHarmony certificates used for app signing are classified into the root CA certificate, intermediate CA certificate, and entity certificate (app or profile signing certificate). The app signing certificate indicates the identity of the app developer, which ensures the traceability of the source of the apps. The profile signing certificate is used to verify the signature of the profile, which ensures the integrity of the profile. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci - HAP 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci A Harmony Ability Package (HAP) is used to deploy an ability, which is the basic unit for OpenHarmony app development. An OpenHarmony app consists of one or more abilities. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci - HSP 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci A Harmony Shared Package (HSP) is a dynamic shared package. HSPs can be classified as intra-app HSPs and inter-app HSPs. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci - HQF 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci A Harmony Ability Package Quick Fix (HQF), installed on a device, is used to quickly fix HAP problems. 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci - Debug tool 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci A toolchain that provides C++ debugging, for example, [LLDB](https://gitee.com/openharmony/docs/blob/master/en/application-dev/tools/lldb-tool.md). 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci - Profile 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci A [HarmonyAppProvision configuration file](app-provision-structure.md) in an app package provides information such as the authorized app permissions and device ID. 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci## Constraints 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci - The hapsigner tool is developed in Java and C++. The tool in Java must run on JRE 8 or later. The tool in C++ must run on an OpenHarmony standard system with C++ 17 or later. 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci - The scripts for one-click signing (available only for the tool in Java) are written in Python and must run on Python 3.5 or later. 54