Current location - Quotes Website - Signature design - Can I get the signature file if there is an apk for android?
Can I get the signature file if there is an apk for android?

1) Use jdk's keytool tool to generate a certificate for signing> keytool -genkey -v -alias CERT -keyalg RSA -keysize 2048 -validity 10000 -keystoreCERT.keystore The creation process requires you to enter some identification information and passwords , some important parameter values ??are explained as follows (modify accordingly according to your own needs): CERT.keystore ---- The file name where the certificate is saved CERT ---- The alias of the certificate 10000 ---- The validity period of 10000 days is 2048 ---- The default is 1024 bits, Android recommends using 2048 bits or higher. For other detailed information, you can use keytool -help to view the help. After the certificate is generated, use the following command to view the certificate information: > keytool -list -alias CERT -keystore CERT .keystore

2) Use jdk’s jarsigner tool to sign the apk file> jarsigner -verbose -keystore CERT.keystore to_sign.apk The CERT signing process requires entering the password of the certificate. Some important parameter values ????are explained as follows (according to Make corresponding modifications according to your own needs): CERT.keystore ---- The file name where the certificate is saved CERT ---- The alias of the certificate If there is a folder "META-INFO" in the root directory of the apk file to be signed, please Delete first (required to re-sign). If you don't want the creation process to output too much information, you can remove "-verbose". The above signature will directly overwrite the original file. If you do not want to be overwritten and the signature is another new file signed.akp, just change to_sign.apk to -signedjar to_sign.apk signed.akp. After signing, you can use the following command to verify whether the signature is successful: > jarsigner -verify to_sign.apk If you need to view more detailed verification information, you can modify it to: > jarsigner -certs -verbose -verify to_sign.apk

3 ) Use the zipalign tool of android sdk to optimize the signed apk file > zipalign -v 4 unaligned.apk aligned.apk Be careful to zipalign after signing. This tool does not come with jdk, but is in %ANDROID_HOME%\tools\zipalign.exe.

--ITJOB