Skip to content

Instantly share code, notes, and snippets.

@owen800q
Last active October 29, 2020 23:58
Show Gist options
  • Save owen800q/c84cf86240abda5dc4ab7529b311b14e to your computer and use it in GitHub Desktop.
Save owen800q/c84cf86240abda5dc4ab7529b311b14e to your computer and use it in GitHub Desktop.
Add any cert to android 7.0 or above system store

Here I use the cert issued by charles proxy as example

openssl x509 -inform PEM -subject_hash_old -in ~/.charlesproxy/charles.pem | head -1

returned hash code -> 38fd165b

cat ~/.charlesproxy/charles.pem > 38fd165b.0 
openssl x509 -inform PEM -text -in ~/.charlesproxy/charles.pem -out /dev/null >> 38fd165b.0

save content of pem cert to the file named 38fd165b.0

openssl x509 -inform PEM -text -in ~/.mitmproxy/mitmproxy-ca.pem -out /dev/null >> c8750f0d.0

push cert to android

./adb root
./adb push 38fd165b.0 /storage/emulated/0/Download
./adb shell

in the Android shell

mount -o rw,remount /system
cp /storage/emulated/0/Download/38fd165b.0 /system/etc/security/cacerts/
chmod 644 /system/etc/security/cacerts/38fd165b.0
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment