Skip to content

Releases: geekofia/apkmodtools

v1.0.0 - Windows Release

06 Nov 23:49
Compare
Choose a tag to compare

Instructions

  1. extract the zip.
  2. install jdk-8u231-windows-x64.exe (download) to default location.
  3. set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_231.
  4. add below folders to path:
<ZIP_EXTRACTED_FOLDER>\bin
<ZIP_EXTRACTED_FOLDER>\openssl\bin
<ZIP_EXTRACTED_FOLDER>\dextools
  1. add jd-gui.exe shortcut to %AppData%\Microsoft\Windows\Start Menu\Programs

To generate new certificate.pem and key.pk8 run below commands:

openssl genrsa -out key.pem 1024
openssl req -config "PATH_TO_OPENSSL_CONFIG" -new -key key.pem -out request.pem
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt

To just sign an existing apk with certificate.pem and key.pk8 provided in bin folder, run below commands:

java -jar signapk.jar certificate.pem key.pk8 <APK_NAME> <APK_NAME_SIGNED>

Example

PS> openssl genrsa -out key.pem 1024
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
........++++++
.......................................++++++
e is 65537 (0x10001)

PS> openssl req -config "D:\openssl\openssl.cnf" -new -key key.pem -out request.pem
Loading 'screen' into random state - done
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

PS> openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
Loading 'screen' into random state - done
Signature ok
subject=/C=XX/ST=XXXXXX/L=XXXXXX/O=XXXXX/OU=XXXXX/CN=XXXXXXXXXXXXXXX/emailAddress=XXXXXXXXXXXXXXX
Getting Private key
unable to write 'random state'

PS> openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt

PS> java -jar .\signapk.jar .\certificate.pem .\key.pk8 .\grammar_v5.apk .\grammar_v5_signed_new.apk