DEV Community

Cover image for HarmonyOS Development: The first article on the application shelf, generating key and certificate request files
程序员一鸣
程序员一鸣

Posted on

HarmonyOS Development: The first article on the application shelf, generating key and certificate request files

Foreword 

this article is based on Api13 

packaging is the premise to be put on the application market. The packaging of Hongmeng application is very different from Android. All signature configurations in Android can be done in IDE, while Hongmeng cannot be done. The signature rules of the application store must be observed. In this series of articles, we will focus on summarizing how to type a shelf package and the output of a shelf package in Hongmeng, which requires multiple steps, in this article, we start with the first step to explain, that is, how to generate the key and certificate request file. 

How do you run on a real plane? 

In test development, if we want to run on a real machine, we will find that we must configure a signature information, otherwise it cannot run. 

Image description

Click the blue character above to open the signature configuration, or click the icon in the circle in the figure below to go directly to the signature configuration window. 

Image description

After arriving at the Signature configuration page, if it is the first time to run, you need an account. Therefore, you must have a Huawei account for both the Test and the following formal. 

Image description

If not, you can register directly after clicking Login. If so, you can log in directly. After logging in, you can return to our development tool and find that the signature information of the test has been automatically configured for us. 

Image description

This signature information generates the following configuration information in the project build-profile.json5 file, which is our test configuration. 

Image description

After the above configuration is completed, then you can run to the real machine.

Through the above real machine operation, we have basically seen some configuration information of the signature, but these signature configurations are tested and temporary, but it can be said to be basically the same as the officially launched signature and attributes. Let's take a look at them one by one: 

first of all, the signingConfigs keyword, which is an array of objects, is mainly used to configure signature schemes, can be configured multiple, in actual development, we can configure testing, formal, internal testing and so on. 

signingConfigs also has many properties, such as the name of the signature scheme, the signature type, and so on, which are mainly summarized as follows: 

Image description

the most important is the material keyword, which is the signature information we want to configure. Each field is explained as follows: 

Image description

configuring signatures is a crucial step for applications to be put on shelves. Once the configuration is wrong, applications cannot be put on shelves. Therefore, it is very important that everyone must be clear. From the material configuration information, we can see that a correct signature information requires issuing certificates, secret key library files and other elements. Next, we will perform the first step to generate our own keys and certificate request files. 

Key and Certificate Request File 

first, choose Build > Generate Key and CSR in the top menu bar of DevEco Studio ". 

Image description

After clicking, the following page will appear: 

Image description

if you have a. p12 file with the key, select Choose Existing. If not, click New to create a New one. 

After clicking Create, the following page will appear: 

Image description

the main method is to select the storage path of the key file and set the password. The basic overview is as follows:

Key store file: Set the storage path for the key store file and fill in the p12 file name.
Password: To set a key repository password, it must be a combination of two or more characters from uppercase letters, lowercase letters, numbers, and special symbols, with a length of at least 8 digits. Please remember this password as it will be required for subsequent signature configuration.
Confirm password: Enter the key repository password again.
Enter fullscreen mode Exit fullscreen mode

After completing the above information, you will come to the following page. 

Image description

Alias is very important and needs to be used in subsequent signature configurations. It is the Alias information of the key and is used to identify the key name. 

After Advance Setting is launched, there are some configuration information, which is optional and can be set according to your own needs. Validity: Certificate Validity period, which is recommended to be set to 25 years or more, covering the complete life cycle of the application/meta-service. Certificate: enter basic Certificate information, such as organization, city or region, country code, etc. 

Image description

After completing the above information, we directly click Next: 

Image description

click Finish after setting the CSR file storage path and CSR file name in the above window ". 

In this way, our secret key and certificate request file have been generated. 

Image description

Related Summary 

the above information configuration is only a small step before the shelf. It only completes the generation of the local secret key and certificate request file, and has not really configured the signature. In the next article, we will focus on how to apply for a certificate. 

This article tags: HarmonyOS application shelves.

Top comments (0)