Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phanirithvij/2664ba0a5445376d9f4546dca11c04a2 to your computer and use it in GitHub Desktop.
Save phanirithvij/2664ba0a5445376d9f4546dca11c04a2 to your computer and use it in GitHub Desktop.
Install CAcert on android via adb
#!/bin/bash
# Compiled by following instructions on https://wiki.cacert.org/FAQ/ImportRootCert
ADB="/home/christian/android-sdk-linux/platform-tools/adb"
ROOT_CRT="cacert-root.crt"
INT_CRT="cacert-class3.crt"
curl -o "$ROOT_CRT" "https://www.cacert.org/certs/root.crt"
curl -o "$INT_CRT" "https://www.cacert.org/certs/class3.crt"
ROOT_CRT_ID="$(openssl x509 -inform PEM -subject_hash_old -in $ROOT_CRT | head -1).0"
INT_CRT_ID="$(openssl x509 -inform PEM -subject_hash_old -in $INT_CRT | head -1).0"
cat $ROOT_CRT > $ROOT_CRT_ID
cat $INT_CRT > $INT_CRT_ID
openssl x509 -inform PEM -text -in $ROOT_CRT -out /dev/null >> $ROOT_CRT_ID
openssl x509 -inform PEM -text -in $INT_CRT -out /dev/null >> $INT_CRT_ID
$ADB root
$ADB shell mount -o remount,rw /system
$ADB push $ROOT_CRT_ID /system/etc/security/cacerts/
$ADB push $INT_CRT /system/etc/security/cacerts/
rm $ROOT_CRT
rm $INT_CRT
rm $ROOT_CRT_ID
rm $INT_CRT_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment