The Android platform signature certificate is generated
The Android platform packages and distributes APK applications, which need to be signed with a digital certificate (.keystore file) to identify the developer.
You can run the keytool command in the JRE environment. The following is how the Windows platform generates a certificate:
Installing the JRE environment (JRE8 recommended)
Oracle’s official download jre installation package www.oracle.com/technetwork…
Baidu web disk:
- Link: pan.baidu.com/s/14nUOI3AM…
- Extraction code: MRXA
Setting environment Variables
Open command line (CMD) window + R Enter CMD to invoke the command line
set PATH=%PATH%;" C: \ Program Files \ Java \ jre1.8.0 _201 \ bin"Copy the code
Generating a Signing Certificate
keytool -genkey -alias testalias -keyalg RSA -keysize 2048 -validity 36500 -keystore test.keystore
Copy the code
- The testAlias is the certificate alias. You can set the testAlias to the character you want. You are advised to use letters and digits
- Test. keystore is the name of the certificate file. You can change it to a desired file name
Prompt after Enter
Enter keystore password: // Enter the certificate file password and press Enter to Enter the certificate private key password Re-enterNew password: // Enter the certificate file password again and press Enter What is your first and last name? [Unknown]: // Enter your name and last name and press Enter What is the name of your organizational unit? [Unknown]: // Enter the name of your organization, enter What is the name of your organization? [Unknown]: // Enter the name of the organization and press Enter What is the name of your City or Locality? [UnknownWhat is the name of your State or Province? [Unknown]: // Enter the name of the province/city/autonomous region and press Enter What is the two-letter country code for this unit?
[Unknown]: // Enter the country/region code (two letters), China Is CN, enter Is CN=XX, OU=XX, O=XX, L=XX, ST=XX, C=XX correct? [no]: // Verify that the preceding information is correct, type y, and press Enter key passwordfor <testalias>
(RETURN ifSame as keystore password) : / / and the certificate file confirmation certificate passwords are the same (HBuilder | HBuilderX requirements) the two codes, return can directlyCopy the code
After the above command is executed, the certificate will be generated. The path is the certificate alias of the location where you generated the command line. (Certificate file)
Check the certificate
Keytool -list -v -keystore test.keystore Enter keystore password: // Enter the password and press EnterCopy the code
The following information is output
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: test
Creation date: 2020-12-23
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Tester, OU=Test, O=Test, L=HD, ST=BJ, C=CN
Issuer: CN=Tester, OU=Test, O=Test, L=HD, ST=BJ, C=CN
Serial number: 7dd12840
Valid from: Fri Jul 26 20:52:56 CST 2012 until: Sun Jul 02 20:52:56 CST 2119
Certificate fingerprints:
MD5: F9:F6:C8:1F:DB:AB:50:14:7D:6F:2C:4F:CE:E6:0A:A5
SHA1: BB:AC:E2:2F:97:3B:18:02:E7:D6:69:A3:7A:28:EF:D2:3F:A3:68:E7
SHA256: 24:11:7D:E7:36:12:BC:FE:AF:2A:6A:24:BD:04:4F:2E:33:E5:2D:41:96:5F:50:4D:74:17:7F:4F:E2:55:EB:26
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
Copy the code