Skip to content

Instantly share code, notes, and snippets.

@trofimovdigital
Last active September 23, 2020 18:40
Show Gist options
  • Save trofimovdigital/d1cc3217f9e09511f1b5714ac5b8bed9 to your computer and use it in GitHub Desktop.
Save trofimovdigital/d1cc3217f9e09511f1b5714ac5b8bed9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# path to PEM or CRT file
IN="/path-to-cert/file.crt"
OUT="$(openssl x509 -inform PEM -subject_hash_old -in $IN | head -1).0"
cat $IN > $OUT
openssl x509 -inform PEM -text -in $IN -out /dev/null >> $OUT
# adb root
# adb shell mount -o remount,rw /system
# adb shell mount -o rw,remount,rw /system
adb remount
adb push $OUT /system/etc/security/cacerts/
adb shell chmod 644 /system/etc/security/cacerts/$OUT
adb reboot
rm $OUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment