# generate Android Signature certificate
Android APK Call others like WeChat Open SDK, usually need to sign the application, so as to bind the signed md5 Value. May be understood as: sign(Your App) = Fixed application signature (md5)
# I. Generation of Signature Certificates
First, the application signature needs to generate aSignature certificate, if you already have a signed certificate, you can skip this step.
- There are two formats for signing certificates
jks
andkeystore
, the former can be obtained byAndroid Studio
Generated, the latter may be obtained bykeytool
Command generation - There are differences in the format requirements of signing certificates in different application markets, and users can selectively generate the required certificates, and then the two certificates can be converted to each other.
- In the WeChat open platform to create mobile applications need to configure the signature for the
keystore
Generated, so this article describes only the generation of kyestore Method of certificate
# 1, generate kyestore certificate
# a) mode 1, use kyestore Command Tool Generate Certificate
Use keytool The genkey command generates a certificate:
keytool -genkey -alias Testalias -keyalg RSA -keysize 2048 -validity 36500 -keystore test.keystore
Testalias
Is a certificate alias, can be modified to set their own characters, it is recommended to use English letters and numberstest.keystore
Is the certificate file name, you can modify the file name you want to set, you can also specify the complete file path36500
Is the validity period of the certificate, indicating the 100 Year validity period, unit days, it is recommended to set a little longer time to avoid certificate expiration
Additional Information: Must be installed first JDK
After entering the car will prompt:
Enter keystore password: //Enter the certificate file password, enter complete enter
Re-enter new password: //Enter the certificate file password again, enter complete enter
What is your first and last name?
[Unknown]: //Enter first name and last name, enter complete carriage return
What is the Name of your organizational unit?
[Unknown]: //Enter the organizational unit name, enter the complete return
What is the Name of your organization?
[Unknown]: //Enter the Organization Name, enter Complete Enter
What is the Name of your City or Locality?
[Unknown]: //Enter a city or region name, enter complete enter
What is the Name of your State or Province?
[Unknown]: //Input province/city/Autonomous Region Name, Enter Complete Enter
What is the two-letter country Code for this unit?
[Unknown]: //Input country/Area code (two letters), China for CN, enter to complete the carriage return
Is CN=XX, OU=XX, O=XX, L=XX, ST=XX, C=XX correct?
[no]: //Verify that the above input is correct, enter y and enter
Enter key password for <Testalias >
(RETURN if Same as keystore password): //Verify that the certificate password is the same as the certificate file password (HBuilder|HBuilderX requires the two passwords to be the same), you can directly enter
After the above command is completed, the certificate is generated
# b) mode 2 Using Developer ToolsAndroid Signature Certificate Generationtool
- The path is: toolbar - Selecting equipment - Signature Certificate Management - Android Signature Certificate Generation
- Fill in the following information as required to generate a certificate
Additional Note:
Certificate Alias: The certificate's Key-Alias, this configuration is required
Certificate Password: The certificate's KeyPassword, the configuration key is required
Certificate file password: that is, the certificate's StorePassword, this configuration is required
Once successful, you can go to the certificate file path to view the generated certificate file
# II. Use of Signature Certificates
The generated signature certificate has the following application scenarios:
- The WeChat Developer Tool runs on Android Certificate Required Before Simulator and Real Machine Project Information
- Build in Weixin DevTools APK When you need to configure the certificate project information
- Used to generate signatures to be filled in the development information of the WeChat open platform mobile application
# 1, running in the simulator and real machine
Running on Android for the first time The following signature management pop-up appears when the emulator and the real machine are present:
The relevant explanations are as follows:
- Certificate Alias: The certificate's Key-Alias, this configuration is required
- Certificate Password: The certificate's KeyPassword, the configuration key is required
- Certificate file password: that is, the certificate's StorePassword, this configuration is required
# 2. Construction APK
- to construct APK You need to set the corresponding signature certificate information separately, the details can be viewedPackage generation APK
- That is, the certificate information configured in the manner described above is not synchronized toto construct APKPanel that needs to be reconfigured to build a formal APK Certificate configuration(However, it is recommended to use the same copy, because inconsistent certificate information can affect the inconsistency of the generated signatures, which may occur when debugging on the real machine without a signature, but the construction APK Will appear later.Due to the application package signature information verification does not pass, can not share WeChat)
# 3. Generate application signatures and public keys
- Details can be viewedgenerate Android Signature and Public Key