Summary:
Originally signature is not required, but I have a android special equipment, installation restrictions, but give me a sale through a validation certificate.
So what I want to install the software, you need this certificate validation.
The main procedure signature, as well as modify the method signature now record it.
One: Preparing the Environment
In fact, useless any special tools JAVA JDK suffice.
https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
According to their version download, I downloaded the Windows 158.63 MB jdk-12.0.2_windows-x64_bin.exe
The next step all the way to install it.
Two: to generate the signature certificate
Find your installation folder
D: \ Program Files \ the Java \ the JDK-12.0.1 \ bin> the keytool -alias-genkey- jackadam -keyalg RSA -validity 36500 -keystore jackadam.keystore enter the keystore password: Enter the new password again: your first and last name is What? [Unknown]: Jack your organizational unit name what is? [Unknown]: Technology What is your organization name? [Unknown]: fntco what your city or region name? [Unknown]: zhengzhou your area State / City / what autonomous regions name? [Unknown]: henan what two-letter country / region code for this unit? [Unknown]: CN CN = Jack, OU = Technology, O = fntco, L = zhengzhou, ST = henan , C = cn correct? [No]: y is being generated 2,048-bit RSA key pairs and self-signed certificate for the following objects (SHA256withRSA) (valid for 36,500 days): CN = Jack, OU = Technology, O = fntco, L = zhengzhou, ST = henan, C = cn
Red can be marked according to their preferences change. It will generate a name for the certificate in the bin directory jackadam of jackadam.keystore this key file.
-validity 36500 did not write a lot of information in this argument, which is the 100-year period.
Who nothing to change the certificate to play this game? 100 years to write it.
Three: View Signature
The first step: unzip the apk
Step two: find .RSA file in the META-INF
Step Three: Enter the command on the mac terminal or window controller:
the keytool -printcert -file xxx.RSA Enter to view signature the file will .RSA files dragged into the back -file, you can see: as shown
It also ruthless than I am, 1000, 365,000 days. Really the end of time ah.
Four: Remove Signature
Actually very simple, open the apk with WinRAR, find the META-INF folder, delete all other files can be outside MANIFEST.MF.
Five: Signature
Signature command as shown below:
Use jarsigner to sign
jarsigner -verbose -keystore [your private key storage path] -signedjar [after signature file storage path] [file path unsigned] [Your certificate's name]
or directly to the password into the signature to go inside, you do not have to manually enter the password database password: command is as follows
jarsigner -verbose -keystore [your private key storage path] -storepass password store password -signedjar [after signature file storage path] [unsigned file path ] [your certificate's name]
or
jarsigner -verbose -keystore [your private key storage path] -signedjar [after signature file storage path] [file path unsigned] [your certificate name] -storepass password store password
My operation is as follows:
Six: Verify signature
How this experience? View sample and signature ah.
Check to be signed on the right.