Current location - Quotes Website - Personality signature - How to sign apk and zip files
How to sign apk and zip files
If you just want to know how to sign and download the signing tool, please go directly to the section "How to sign Apk or zip files with SignApk.jar". To create your own certificate, please start from scratch.

Prepare knowledge:

When you want to publish a software or homemade ROM, you need a certificate with a private key to sign one. Apk or Zip file. Android system uses certificates to identify the authentication relationship between the software author and the software. The classic method is to create a certificate with keytool and then sign it with jarsigner. But this tutorial will provide an easier way for most people to use a tool called SignApk.jar

SignApk.jar is a tool that has been included in the source package of Android platform. You can download it in the attachment of this post. If you want to use SignApk.jar, you need to create a private key with the corresponding certificate/public key. You can use Openssl to create private/public key pairs. It is relatively easy to use Openssl in Unix/Linux system. For Windows users, you can download the Windows version of Openssl in this attachment or this link.

How to create a private/public key pair using OpenSSL (also called certificate file, I don't blame for mistakes) (Windows version)

Download openssl-0.9.8k_WIN32.zip in the attachment.

Unzip the downloaded compressed package to any location on your computer (for example, C:\OpenSSL).

Enter in order under the OpenSSL\bin folder (using the CMD command line tool, you need to enter some information in step 2, as shown in the figure):

1、OpenSSL gen RSA-out key . PEM 1024

2、OpenSSL req-new-key key . PEM-config C:\ OpenSSL \ OpenSSL . CNF-out request . PEM

OpenSSL x509-req-days 9999-in request . PEM-sign key key . PEM-out certificate . PEM

4、OpenSSL pkcs 8-top k8-out form DER-in key . PEM-inform PEM-out key . pk8-nocrypt

Big star tip: If your recovery does not have the signature verification switching function, then signing ROM with your own certificate file will prompt that the signature verification failed. Because at present, almost all the private keys carried in third-party recovery belong to testkey. (The certificate file contained in the attachment android.zip has been updated to testkey. )

How to use SignApk.jar to sign Apk or zip files;

Download the attachment to android.zip

Unzip the downloaded compressed package to any location on the computer (for example: C:\android).

If the JAVA environment is not installed on your computer, please download and install it.

(If you created your own private/public key pair) Copy certificate.pem and key.pk8 to the extracted android folder.

Use the CMD command-line tool cd to the android folder, and then enter: (For the package I provided, just put the file to be signed in the android folder and drag it into the corresponding batch file).

Java-jar signapk . jar certificate . PEM key . pk8 your-app . apk your-signed-app . apk

or

Java-jar signapk . jar certificate . PEM key . pk8 your-update . zip your-signed-update . zip