Forked from cbachert/install_cacert_on_android_via_adb.sh
Created
September 30, 2021 16:44
-
-
Save phanirithvij/2664ba0a5445376d9f4546dca11c04a2 to your computer and use it in GitHub Desktop.
Install CAcert on android via adb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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