certificate in ota rom - Sony Tablet S

there are 2 important certificate in ota rom file
1:com.sony.tablet
this is sony's ket to sign rom files,you can get it this way
unzip file rom\META-INF\CERT.RSA
rename to cert.rsa.p7b
double click to open
in system certmgr,you can find certificate file
this file only have public key,use to verify file.
only with private key,you can sign new file.
2:test key
in rom\system\etc\security\otacerts.zip\testkey.x509.pem
to open it,just change ext name to .crt,windows will open it
you can also file this key in allinone\files\,and it's private key .pk8
aio use this key to resign custom rom.you can flash custom rom with condi fixed recovery.
View attachment cert.zip
last,there are many other certificate in system\etc\security\cacerts
to open in windows,add ext name .crt
but it's not important
-----------------------------------------------------------------
PS:the rule of sign apk/zip file
android sdk have file signapk.jar to sign file.
it does:
1,calc sha1 hash for all files in zip,write it to MANIFEST.MF
2,calc sha1 hash for manifest,write to CERT.SF
3,write public part of certificate to CERT.RSA
4,append sign data at last of zip file

Related

[TUT] Advance Framework Edit

things you'll need
APK MANAGER
7zip
DESCRIPTION :
Q : Basic
A : The icons are stored in the Drawable-mdpi folder in the framework.
these icons are linked to XML's in Drawable folder
if you just add the icons and don't change the xml, you'll get nothing.
Q : Why Cant we just Edit the XML files?
A : The XML files are encrypted. if you try to edit it you will get weird characters.
Q : No XML No Edits, Are we Done?
A : Yes, No XML No Edits. But we've a walkaround. The APK MANAGER
it decompiles the apk and unencrypts the xml file.
BASIC :
Extract the contents of APK MANAGER to any folder
you'll have few folders
place your apk in the place-apk-here-for-modding folder
open Script.bat
and chose option to decompile and minimize
it will create a folder namely PROJECTS
now you can edit the xml files
after your done, maximize the apkmanager window and choose comiple apk
HOW TO ADD MORE PNGS :
if you want to add pngs like the battery percentage you'll need to link the png to the xml file
this can be done by two ways
1. assigning resource_id
&
2. directly putting in the names
the 1st method is easy but complex so forget it
the second method is simpler.
just find the xml file corresponding to the png and than simply add the name.
for eg.
stat_sys_battery.xml is the battery status xml.
<item android:drawable="@drawable/stat_sys_battery_0" android:maxLevel="0" />
Click to expand...
Click to collapse
here the
android:drawable is the android code
and
@drawable/stat_sys_battery_* is the file location
check the attachment for better understanding
Click to expand...
Click to collapse
THE PROBLEM & THE SOLUTION :
if you try to edit any modded framework file you'll get error while compiling.
and your phone will hang if you use that file.
SOLUTION
instead of using modded file. use the STOCK framework. Edit your files and compile your apk
now when you compile it, it will give you few options
1. is it a system file [y/n]
choose yes
2. (...blah blah.. do you wish to keep files)
choose yes
now it will extract the stock (unedited) framework in a KEEP folder
minimize the window
open the folder and delete all the files you modified.
if you had modified xml file you'll also need to delete resources.asrc
now maximize the apkmanager window and press any key.
your modded apk will be compiled in the place-apk-here-for-modding folder
PS : IT WOULD BE UNSIGNED
LAST STEP :
open the compiled unsigned apk and extract all the files you edited (including resources.asrc)
simply replace these files in the framework-res.apk you wanted to mod
only part to take care is the resources.asrc file you don't have to replace it directly
do this steps for replacing resources.asrc
1. right click the resources.asrc
2. select add to archive
3. archive format zip
4. compression method Store
5. select the path of your framework-res.apk
I know this all seems way to complex but if you read carefully and do it step by step, its all easy as a PIE

[Q] Create .pk8 from testkey.x509.pem file

Hello,
I need a specific key for sign update.zip for android device. In this device, i've find a file x509.pem, containing the sentences "-----BEGIN CERTIFICATE-----" with a long key, and at the end : "-----END CERTIFICATE-----".
But, i need a pk8 file for sign my zip and i don't know how i can to proceed for do that ...
I've read documentation on "openssl pkcs8" tool, but i can't to convert my x509.pem to .pk8 .(I'm just a beginner).
Thanks for your help.

[HOW TO]Sign Your Apk For Google Play

Hey Guys,
I found it very hard to find this method on the net. I looked for around 12 hours (over a period of 2 days). But here it is!
This method is very helpful if you need to increase the length of your signature on your apk. As Google Play has a minimum length of validity for signatures.
This tutorial contains some knowledge from other websites and some from my own self. Please feel free to use my hard work below. But try to reference me if you can. Thanks!
First of all,
jarsigner and keytool are .exe files that help create your "signed" application for release to the market to prevent fraud.
1.
Make a folder somewhere called "keytools" and make a folder in that called "key"
2. Now move your apk file to the folder keytools.
(Not inside any other folders)
3. Check
"C:\Program Files\Java\jdk1.7.0_11\bin" for jarsigner and keytools..
... or whatever jdk version you have
If you DONT have it install the following: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
4. open cmd.exe,
5. cd your way to where you have your keytools folder...
I had to do.. cd desktop, and to keytools to get to C:\Users\Matt\Desktop\keytools\
In this directory is you apk file which we will manipulate.
Now add the directory C:\"Program Files"\Java\jdk1.7.0_11\bin\ or something like that to PATH in Environment Variables.
Directions on how to do this can be found here: http://www.computerhope.com/issues/ch000549.htm
type the following now (or something similar to my example)
keytool -genkey -alias xda.keystore -keyalg RSA -validity 20000 -keystore keys/xda.keystore
Then you will have be presented with:
Enter keystore password: (type in a password you will use)
Re-enter new password: (type in same password here)
What is your first and last name? Matt <LAST NAME HERE>
What is the name of your Organization unit? (You dont NEED to type anything)
What is the name of your city or locality? <What it says>
What is the name of your state or providence? <What it says>
what is the two-letter country code for this unit? AU
is CN=Matt C=AU.....etc. correct?
[no]: yes (type yes there)
Enter key password for <xda.keystore>
<RETURN if same as keystore password>: (push enter)
6.
To add the directory of jarsigner to the PATH variable just do the steps from here: http://www.computerhope.com/issues/ch000549.htm but with the path of jarsigner. Which should be something like this: echo "PATH=/cygdrive/c/Program\ Files/Java/jdk1.7.0.11/bin:\${PATH}" >> .bash_profile
Now, type the following now (or something similar to my example) NOTE: This is all in cmd.
jarsigner -verbose -keystore key/donate.keystore -signedjar Donate_signed.apk xda.apk xda.keystore
Enter Passphase for keystore: (your password you made earlier)
DO NOT TYPE --> adding: META-INF/MINFEST.MF ....
.......
.....
...Signing: classes.dex <--DO NOT TYPE
and you're all set! you signed your apk file or whatever you wanted to create!
Congratulations.
NOW STOP BEING FRUSTRATED LIKE I WAS FOR HOURS!
Or, if your using Eclipse just right-click your project and choose Android Tools > Export Signed Application Package.. and follow the export wizard.
@M4ttz
Thanks a lot mate!!!!!!!!!
mytheme_signed.apk is created! Let's go to Google Play
EDIT
Google told me that I need to zipalign my apk file.... If I zipalign Google says that my file isn't signed!!!!

[Q] Is it possible to reduce size of .apk without break signature?

1) The SHA1-Digest in the signature is based on the compressed or uncompressed files inside the apk?
2) If it is based on the uncompressed files, is it possible to decompress and recompress with 7-zip utility (always in the zip format) and then zipalign without break the signature?
3) Is there an online service or an application to verify that the signature match the files?
Method 1 in the given thread will not break signature of app
https://forum.xda-developers.com/android/general/guide-t4080131
2nd method usually make backed-up apps non-installable and not sure about signature preservation.
Best way to check signature of an apk is to check its certificate's hash and compare it with original,
MiXplorer is best choice for it, Just tap on any apk in MiXplorer then goto certificate and then at bottom tap at checksum, Here you will get a number of hashes, take any one and compare it??

Plugin Descriptions (Donate Version)

Plugin Installation:
Open the Plugin Manager
Choose Install a Plugin
Choose the plugin you want to install
Choose Run a Plugin
Choose the Plugin you want to run
Enjoy!
NOTE: The usage instructions in each plugin description below assume you have already installed it. When the instructions end, that's when you run the plugin from the plugin manager.
SuperR's Kitchen Plugin Descriptions
SuperR Maintained Plugins:
add_placeholder
Only for system-as-root devices
Adds placeholder files to all empty directories in your project
add_remove_files
Add all apk files from a directory
Choose apk to import
Choose directory structure to import
Delete files from your ROM based on directory structure
NOTE: To use "Choose directory structure to import" and "Delete files from your ROM based on directory structure", your directory must be set up as the following example:
Code:
your_directory_name/system/anything_you_want
your_directory_name/vendor/anything_you_want
your_directory_name/cache/anything_you_want
your_directory_name/hidden/anything_you_want
your_directory_name/boot.img
The above is only an example. You can add anything you want as long as there is a "system" directory inside another directory. When choosing the directory, choose your_directory_name instead of system or it won't work. Think of the directory structure exactly like the kitchen project directory. When you import directory structure, your directory will be copied into your project directory and files will be overwritten if they already exist. When you remove a directory structure, you will choose your_directory_name again and the plugin will remove the same files it finds from your project directory.
amlogic_unpack
Unpack Amlogic firmware img
apktools
Choose an apk from your current rom directory.
Decompile the apk.
Build apk.
Sign apk with 3 options (use signapk.jar, copy original META-INF to new apk, or copy new classes.dex and resources.arsc to original apk).
Move apk back to where it came from.
Patch smali using .ptch files
Delete META-INF from all apk files
Delete SEC-INF from all apk files
Separate lib directory from all apk files
Zipalign apk files
aroma_install
Install Aroma in your existing ROM.
Create aroma-config using a menu.
Choose apk files to add to the option menu.
Usage:
Extract your ROM normally using ONLY set_metadata or set_perm.
autorom_config
Creates an AutoROM config file to automate the extraction process and many other tasks.
Currently supports perm type, vendor.img, rom name, custom signature, deodexing, root, su.d, and Busybox
buildprop_add
Adds lines from a file to build.prop.
concatimg
Combines partition_*.img files into a single img file
custom_zip
Create a flashable zip of one or more image files as long as you know the partition name where it should be flashed.
Create a flashable patch zip from directories that have matching fs_config and file_contexts3 files
Convert updater-script to update-binary script for use in the mods_install plugin
Usage:
Copy the partition images and/or directories you want in the zip into a new directory in your project.
In the kitchen main menu, choose Plugin Manager > Run a plugin > custom_zip
Choose the new directory from the list.
For img files in by-name devices, type the partition name from your device where it should be flashed (ex. aboot)
For img files in mmcblk devices, choose your block from the list (add it to the device superr_mmc file if needed first).
decrypt_htc
Decrypt ruu.exe and ruu.zip files stored in your current project directory.
Extract system.img & boot.img to the current project directory for extraction.
Usage:
Copy ruu.exe or ruu.zip to current project directory (ruu.zip must be named exactly ruu.zip).
gapps
Downloads and includes Open Gapps in your ROM.
Choice of aroma, super, stock, full, mini, micro, nano, or pico
Detects Android version and architecture from ROM to download the latest available version for your device.
If there is no ROM, it will allow you to choose Android version and architecture.
Remove gapps if it already exists.
gen_set_metadata
Generates set_metadata lines for every file in project directories that have matching fs_config and file_contexts3 files.
img_tools
Allows rebuilding ext4 img files that have been extracted by the kitchen even if there is not a complete ROM in the project.
Convert sparse img to raw img
Convert raw img to sparse img
Build super.img
Resize img
super.img Build Requirements:
All included img files must be built as sparse.
img file names must be either partition.img or partition_new.img.
super.img size must be in 00_project_files/srk.conf.
Example:
supersize=9437184000
The numeric value in the example above is the raw super.img file size in bytes.
The kitchen adds the super.img size when unpacking a super.img. If the kitchen did not unpack the super.img, you can enter the size in srk.conf manually.
Optional values metadata-size and metadata-slots can also be added to srk.conf. Defaults are listed below:
metadata-size=65536
metadata-slots=2
*This plugin will only work in v3.2.1.0 or higher*
lg_tools
Unpack LG kdz files
Removes rctd, ccmd, and triton from LG boot.img.
mods_install
Add any flashable zip to your ROM that uses an update-binary script instead of a updater-script
Remove mods
Shows the kitchen added mods you currently have installed
ozip_decrypt
Decrypt firmware.ozip files
payload_dump
Unpack payload.bin firmware
rockchip_unpack
Unpack Rockchip firmware img files
samsung_tools
Asks one-by-one if you want to add ro.config.tima=0, ro.config.knox=0, ro.securestorage.knox=false, ro.securestorage.support=false, ro.security.mdpp.ux=Disabled, and wlan.wfd.hdcp=disabled to ramdisk default.prop
Create tar.md5 from all img, mbn, ext4, and bin files in your ROM directory.
Create tar.md5 from all the above except system.img, system.img.ext4, boot.img, and recovery.img
Decode OMC/CSC
Deodex patch for Android 8.1+
Pack *_new.img files to lz4
sepolicy_injector
Converts sepolicy denials into allow rules, and optionally patches seplicy with the new rules.
Paste a denial
Read denials from 00_project_files/logcat.log
unsign_mtk_img
Removes MTK signature from img files
updateapp
Extract firmware.zip that contains UPDATE.APP
Extract img files from UPDATE.APP
Usage:
Place a firmware.zip or UPDATE.APP in your rom directory.
xiaomi_patch
Patches several things in Xiaomi firmware.
Usage:
Extract your firmware with the kitchen, then run the plugin.
xperia_unpack
Unpack Xperia firmware
Choose full firmware zip, an ftf file, or a sin file.
When choosing a sin file, all sin files in the project directory will be unpacked.
Respects the partition_extract_list variable from kitchen/tools/srk.conf
User Contributed Plugins:
None
Custom Plugins
The donate version has plugin support. This means you can integrate your own script into the kitchen. Each plugin must have its own directory inside the kitchen plugin directory, and it must be named the same as the plugin script.
Examples:
/kitchen/tools/plugins/example_bash/example_bash.sh (Linux, Mac)
/kitchen/tools/plugins/example_batch/example_batch.bat (Windows)
You can check the example plugins in the kitchen for more details and use them as templates for your own plugin.
There are 3 variables set in the example plugin to take note of:
bd = /path/to/kitchen
rd = /path/to/kitchen/superr_projectname
plugdir = /path/to/kitchen/tools/plugins/pluginname
NOTE: If you would like to contribute a plugin, please PM a link to the plugin for review.
This post contains the last working versions of all plugins that have lost native Windows support.
If you are running the kitchen in WSL, WSL2, Linux, or Mac you should use the kitchen plugin manager to get the latest versions of these plugins.

Categories

Resources