Installing system certificates

  • Due to default network security config rules, most apps only support “system” certificates.

  • To install our certificates in system store we need a rooted android device.

  • First install certificate as a regular user certificate.

  • Then ensure that you are root (adb -s <emulator_name> root).

    • To see the emulator name use adb devices

  • Then do adb -s <emulator_name> shell

1) Backup the existing system certificates to the user certs folder

cp /system/etc/security/cacerts/* /data/misc/user/0/cacerts-added/

2) Create the in-memory mount on top of the system certs folder

mount -t tmpfs tmpfs /system/etc/security/cacerts

3) copy all system certs and our user cert into the tmpfs system certs folder

cp /data/misc/user/0/cacerts-added/* /system/etc/security/cacerts/

4) Fix any permissions & selinux context labels

chown root:root /system/etc/security/cacerts/*
chmod 644 /system/etc/security/cacerts/*
chcon u:object_r:system_file:s0 /system/etc/security/cacerts/*

Last updated

Was this helpful?