DEV Community

Egit S.
Egit S.

Posted on • Originally published at esabook.wordpress.com on

Assign CA Cert to Android's /system directory for HTTPs decryption

Based on my device lab where tested on Android Virtual Device API v16 – v29, use GAPPs or not.

The main goal is to quickly give a affirmative detail to BE team, when any error occurred.

Fast way for bug spot inspections at production app. Occurred at BE side?, network call, FE logic, or else.

#Installing CA Cert to android system
1. get cert file
cd ~/.mitmproxy
2. get cert hash
// convert cer to pem
openssl x509 -inform der -in certificate.cer -out certificate.pem
// cert hash for android
openssl x509 -inform PEM -subject_hash_old -in mitmproxy-ca.pem | head -1
3. rename cert to hash with *.0 extension
nm=c8750f0d.0
cp mitmproxy-ca.pem $nm
4. start AVD in writable-system mode
emulator -list-avds
emulator @Nexus_5X_API_29_x86 -writable-system
adb root
adb shell "mount -o remount,rw /"
5. push cert file
adb push $nm /system/etc/security/cacerts
6. change file permission
adb shell chmod 664 /system/etc/security/cacerts/$nm
7. reboot android system
adb reboot
8. chenk availability after reboot
adb shell ls /system/etc/security/cacerts/$nm
https://gist.github.com/esabook/1b5e8ae79f07fe4713042dd698c38ea2

Device Android version 9

Download app from Google Play

Test Cert with proxy: connect

Test Cert with proxy: decrypt

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay