HarmonyOS uses signature information such as the digital certificate (.cer) and profile (.p7b) to ensure app/atomic service integrity. If your app/atomic service needs to be released in AppGallery Connect, it must pass signature verification. Therefore, you need to use the release certificate and profile to sign the app/atomic service before releasing it.
For versions earlier than 26.0.0, you must prepare signing materials including the key, CSR, release certificate, and profile to manually sign and build the app, and then upload the app package to AppGallery Connect.
Since version 26.0.0, you only need to build your app before uploading it to AppGallery Connect. During the upload, DevEco Studio will re-sign the app regardless of whether it has been signed before, using either the cloud-managed certificate automatically generated by AppGallery Connect or a certificate created by yourself.
[h2]Building the App
For an app to be released, the app package type must be Release.
- Choose Build > Build Hap(s)/APP(s) > Build APP(s) and wait until the process is complete.
If the build mode is <Default>, the Release mode is used by default for building app packages, and the Debug mode is used by default for building HAPs, HSPs, and HARs. For details, see Specifying a Build Mode.
- Choose build > outputs > {product} in the project directory to obtain the app package.

[h2]Uploading an App Package
Constraints
- This feature is available only in the Chinese mainland.
- This feature will upload your app package to AppGallery Connect. To keep your information safe, do not upload any sensitive personal data (including passwords, source code, private keys, debug installation packages, and service logs).
- Only the app package in the build/outputs directory of the project can be uploaded. Before uploading, ensure that the app package has been built.
Procedure
- In the DevEco Studio menu bar, choose Build > Upload Product. If not signed in, click Sign in to sign in with your Huawei developer account.

- After a successful sign-in, return to DevEco Studio and navigate to the app package upload page. Confirm the user name and team information, select the target app package from the list of built app packages of the current project, and click Distribute App to start the upload.

- Set the upload type (AppGallery Connect, Testing Only, or Custom) and click Next.
- AppGallery Connect: Re-sign the app with cloud-managed certificates and profiles. Upload the app package to AppGallery Connect for testing and release, along with symbol table files.
- Testing Only: Re-sign the app with cloud-managed certificates and profiles. Upload the app package to AppGallery Connect for testing, along with symbol table files.
- Custom: Configure custom upload settings.

- Check whether your app has been registered in AppGallery Connect or associated with a registered app pending release. If neither condition is met, create or associate one directly in DevEco Studio.
- If your app has not been registered in AppGallery Connect, configure information such as the app name and package name in the window, create and release the app, and click Next.
- Project: project name. You can create a project or select an existing project in your team.
- App type: app type, which can be obtained from the app package.
- App name: app name.
- App package name: app package name, which can be obtained from the app package.
- App category: application category.
- Device Type: device type.
- Language: default language.
For details about the options, see Creating an App ID for a HarmonyOS App.

- If your app has been registered in AppGallery Connect but not associated with a registered app pending release, configure App name, App package name, Device Type, and Language in the window and click Next. This will synchronously associate and generate a registered app pending release in AppGallery.
For details about the options, see Creating a HarmonyOS App to Be Associated with the App ID.

- If your app has been registered in AppGallery Connect and associated with a registered app pending release, selecting AppGallery Connect or Testing Only as the upload type will navigate you to step 8 to view the app package upload results. Selecting Custom proceeds to the next step to configure the release scenario for the app package.
- Set the upload type to Custom and click Next to enter the signature configuration page. The available release scenarios are as follows:
- Upload to AppGallery Connect for test and publish: The uploaded package is used for testing and release.
- Upload to AppGallery Connect for test: The uploaded package is used for testing.
- Upload Symbol table: Symbol table files are included for upload.
- Manage Build Version: Build versions are managed automatically, and the value of Build Version is computed and updated by AppGallery Connect.

- Set the signature management mode.
- Automatically manage signing: Signatures are managed automatically, and the app is re-signed with cloud-managed certificates and profiles.
- Manually manage signing: Signatures are managed manually, and you need to configure signature information by yourself.

When manually managing signatures, set
Distribution Certificate to
Create Certificate (create a certificate) or
Import Certificate (import a certificate), and set
Distribution Profile to
Import Profile (import a profile) or
Download Profile (download a profile).
- Creating or importing a certificate
Create a certificate via the following operation page. For details about each option, see Generating a Key and CSR. After creation, request a release profile in AppGallery Connect.
Import the existing local keystore file (.p12) and certificate (.cer).

- Importing or downloading a profile
Import the local .p7b file that matches the certificate, or download the profile from AppGallery Connect and import it.
Select the target .p7b file to download it from AppGallery Connect to your local device.

- After successful signing, an app package suffixed with re-signed.app will be generated under the specified software package path. Verify the information of the app package and click Upload.

- After successful upload, click AppGallery Connect to view the upload record and test result in AppGallery Connect. For details, see Uploading Your Package. To close the upload page, click OK.

[h2]Releasing an .app File to AppGallery
Release the app/atomic service package (.app file) on AppGallery. For details, see Releasing a HarmonyOS App or Releasing an Atomic Service.
Only .app files built in release mode (packaged by DevEco Studio) can be released to AppGallery.
Versions Earlier Than 26.0.0
[h2]Release Process
To release your app/atomic service to AppGallery Connect, package your app/atomic service into an App Pack (.app file). The process is shown below.

[h2]Generating a Key and CSR
HarmonyOS uses digital certificates (.cer) and profiles (.p7b) to ensure app/atomic service integrity. Before requesting a digital certificate and a profile, you need to generate a key stored within a .p12 keystore file and a CSR file (in .csr format).
Basic concepts- Key: classified into the public keys and private keys used in asymmetric encryption and stored in the keystore file in .p12 format. The public and private key pairs are used for digital signature and verification.
- CSR: a .csr file containing the public key from the key pair, as well as the common name, organization name, organizational unit, and other information. It is used to request a digital certificate from AppGallery Connect.
- Digital certificate: a .cer certificate issued by AppGallery Connect.
- Profile: a .p7b file that contains information such as the HarmonyOS app/atomic service's bundle name, digital certificate information, list of certificate permissions that can be requested by the app/atomic service, and list of devices where the app/atomic service can be debugged (if the app/atomic service type is Release, the device list will be empty). Each app/atomic service package must contain a profile.
Currently, you can use DevEco Studio or CertificateTool to generate keys and CSR files.
The UI for generating keys and CSR files via CertificateTool is consistent with that via DevEco Studio 6.1.0 Beta2 and later versions. This section uses DevEco Studio for illustration.
For option descriptions when using CertificateTool, see "DevEco Studio 6.1.0 Beta2 and later."
DevEco Studio 6.1.0 Beta2 or later
- On the menu bar, choose Build > Generate Key and CSR.
If you have a local key, click Skip in the Generate Key interface and use the local key to generate a CSR file.
- Enter the keystore file. Click Select an existing key to select an existing keystore file (.p12 file that contains a key). If no keystore file is available, create one. The following describes how to generate a key using the created keystore file.

- In the Generate Key interface, set the following parameters and click Next.
- Keystore Name: name of the .p12 file. The value can contain only letters, digits, underscores (_), hyphens (-), and periods (.).
- Select file save path: path for storing the keystore file.
- Key store password: keystore password, which must be at least 8 characters long and contain characters from at least two of the following categories: uppercase letters, lowercase letters, digits, and special characters. Make a note of the password. You will need it when configuring the signature.
- Confirm password: Enter the keystore password again.
- Alias: key alias. Make a note of the alias. You will need it when configuring the signature.
- Advance Setting: (optional) advanced settings of the keystore file.
- Validity(years): (optional) certificate validity period. A validity period of 25 years or longer is recommended to cover the entire lifecycle of your app/atomic service.
- First and last name: (optional) common name, which can be the app name or your name.
- Organizational unit: (optional) organizational unit, which can be the department name or, for individual developers, your name.
- Organization: (optional) organization name, which can be the full name of your company or your name.
- City or locality: (optional) city or region.
- State or province: (optional) state or province.
- Country code(XX): (optional) country/region code.
The values of First and last name, Organizational unit, Organization, City or locality, and State or province must contain fewer than 64 characters and cannot contain double quotation marks ("), single quotation marks ('), or backslashes (\).

- In the Generate Certificate Request File (CSR) interface, set the CSR file name and storage path, and click Finish.
- CSR File Name: name of the CSR file. The value can contain only letters, digits, underscores (_), hyphens (-), and periods (.).
- Select file save path: path for storing the CSR file.

- The CSR file is created successfully. You can obtain the generated keystore file (.p12) and CSR file (.csr) from the storage path.

Versions earlier than DevEco Studio 6.1.0 Beta2
- On the menu bar, choose Build > Generate Key and CSR.
If you have a local key, click Skip in the Generate Key window and use the local key to generate a CSR file.
- In Key Store File, click Choose Existing to select an existing key store (.p12 file that contains a key) or New to create one. The following describes how to create a key store.

- In the Create Key Store dialog box, set the following parameters and click OK.
- Key store file: Select the path for storing the keystore file and enter the .p12 file name.
- Password: Set the key store password, which must contain at least 8 characters that include two types of the following: uppercase letters, lowercase letters, digits, and special characters. Do not lose the password as it will be used later in configuring the signature.
- Confirm password: Enter the keystore password again.

- On the Generate Key and CSR page, set the following parameters and click Next.
- Alias: (mandatory) alias of the key. Make a note of the alias. You will need it when configuring the signature.
- Password: (mandatory) password of the key, which is automatically filled in and the same as the keystore password.
- Validity(years): (optional) certificate validity period. A validity period of 25 years or longer is recommended to cover the entire lifecycle of your app/atomic service.
- First and last name: (optional) common name, which can be the app name or your name. The value must not contain double quotation marks ("), backslashes (\), or backticks (`), with its length in the range (0, 64).
- Organizational unit: (optional) organizational unit, which can be the department name or, for individual developers, your name. The value must not contain double quotation marks ("), backslashes (\), or backticks (`), with its length in the range (0, 64).
- Organization: (optional) organization name, which can be the full name of your company or your name. The value must not contain double quotation marks ("), backslashes (\), or backticks (`), with its length in the range (0, 64).
- City or locality: (optional) city or region. The value must not contain double quotation marks ("), backslashes (\), or backticks (`), with its length in the range (0, 64).
- State or province: (optional) state or province. The value must not contain double quotation marks ("), backslashes (\), or backticks (`), with its length in the range (0, 64).
- Country code(XX): (optional) country/region code.
The values of First and last name, Organizational unit, Organization, City or locality, and State or province must not contain double quotation marks ("), backslashes (\), or backticks (`), with their lengths in the range (0, 64).

- On the Generate Key and CSR page, set the CSR directory, including the file name.

- Click OK. You can then obtain the generated keystore file (.p12) and CSR file (.csr) from the storage path.

[h2]Requesting a Release Certificate and a Release Profile
- Create a HarmonyOS app or atomic service in AppGallery Connect. For details, see Creating a HarmonyOS App and Creating an Atomic Service.
- Request a release certificate and a profile and download them in AppGallery Connect. For details, see Requesting a Release Certificate and Requesting a Release Profile.
- With the obtained release certificate and profile, sign your app in DevEco Studio as instructed in Configuring Signature Information.
- If you are requesting a release certificate and profile for an atomic service, set FA to Yes on the New app page.
- The release certificate and release profile can only be used to package and release an app, but cannot be used to run a debug project.
[h2]Configuring Signature Information
With the keystore file (.p12), certificate file (.cer), and profile file (.p7b) – the latter two files are obtained from AppGallery Connect, you can start configuring the signature information for your app/atomic service in DevEco Studio.
Choose
File >
Project Structure >
Project >
Signing Configs >
default, deselect
Automatically generate signature and
Associate with registered application, and configure the key (.p12 file), profile (.p7b file), digital certificate (.cer file), and other details.
- Store file: Select a keystore file in .p12 format.
- Store password: Enter the keystore password.
- Key alias: Enter the alias of the key.
- Key password: Enter the password of the key.
- Sign alg: Specify the signing algorithm, fixed to SHA256withECDSA.
- Profile file: Select the obtained release profile in .p7b format.
- Certpath file: Select the obtained release certificate in .cer format.

After configuration, click OK to save. Then use DevEco Studio to generate the app as instructed in Building the App.
[h2]Building the App
For an app to be released, the app package type must be Release.
- Choose Build > Build Hap(s)/APP(s) > Build APP(s) and wait until the process is complete.
The default Build Mode is release for an App Pack and debug for a HAP/HSP/HAR package.
That is, when Build APP(s) is selected, the App Pack is of the release type by default.
- Choose build > outputs > app > release in the project directory to obtain the digitally signed App Pack.

[h2]Uploading an App Package
Since DevEco Studio 5.0.5.200, you can upload an app package in DevEco Studio after you have created the app.
Constraints
- This feature is available only in the Chinese mainland.
- This feature will upload your app package to AppGallery Connect. To keep your information safe, do not upload any sensitive personal data (including passwords, source code, private keys, debug installation packages, and service logs).
- This feature is only available for apps in the release build mode. Ensure that a release signature has been configured for the app package.
- You can also upload app packages via AppGallery Connect.
Procedure
- In the DevEco Studio menu bar, choose Build > Upload Product. If not signed in, click Sign in to sign in with your Huawei developer account.

- When you are back to the app package upload page in DevEco Studio after a successful sign-in, verify the product information, select the type of the app package to upload, and click OK.
- If the app package to upload is used only for test purposes, select Generate app package and upload it to AppGallery Connect for test.
- If the app package to upload is used for official release, select Generate app package and upload it to AppGallery Connect for test and publish.
- To upload symbol tables, select Upload your app's symbols.
- Products to be uploaded can be viewed and switched by clicking
in the upper-right corner of the editing area in DevEco Studio. - To change the bundle name and version number of the app package, modify the bundleName and versionName fields in the app.json5 file. The bundle name must be registered on AppGallery, valid, and belong to your current developer account.
- The Build Version value is computed by AppGallery Connect and automatically populated.

- After the upload is complete, cloud test results are displayed. Click View Full Result in AppGallery Connect to view the upload records and test results in AppGallery Connect. For details, see Uploading Your Package. To close the upload page, click Close.

[h2]Releasing an .app File to AppGallery
Release the app/atomic service package (.app file) on AppGallery. For details, see Releasing a HarmonyOS App or Releasing an Atomic Service.
Only .app files built in release mode (packaged by DevEco Studio) can be released to AppGallery.
[h2]Downloading CertificateTool