Prior to Android KitKat you have to root your device to install new certificates.

From Android KitKat (4.0) up to Marshmallow (6.0) it's possible and easy. I was able to install the Charles Web Debbuging Proxy cert on my un-rooted device and successfully sniff SSL traffic.

Extract from http://wiki.cacert.org/FAQ/ImportRootCert

Before Android version 4.0, with Android version Gingerbread & Froyo, there was a single read-only file ( /system/etc/security/cacerts.bks ) containing the trust store with all the CA ('system') certificates trusted by default on Android. Both system apps and all applications developed with the Android SDK use this. Use these instructions on installing CAcert certificates on Android Gingerbread, Froyo, ...

Starting from Android 4.0 (Android ICS/'Ice Cream Sandwich', Android 4.3 'Jelly Bean' & Android 4.4 'KitKat'), system trusted certificates are on the (read-only) system partition in the folder '/system/etc/security/' as individual files. However, users can now easily add their own 'user' certificates which will be stored in '/data/misc/keychain/certs-added'.

System-installed certificates can be managed on the Android device in the Settings -> Security -> Certificates -> 'System'-section, whereas the user trusted certificates are manged in the 'User'-section there. When using user trusted certificates, Android will force the user of the Android device to implement additional safety measures: the use of a PIN-code, a pattern-lock or a password to unlock the device are mandatory when user-supplied certificates are used.

Installing CAcert certificates as 'user trusted'-certificates is very easy. Installing new certificates as 'system trusted'-certificates requires more work (and requires root access), but it has the advantage of avoiding the Android lockscreen requirement.

From Android N (7.0) onwards it gets a littler harder, see this extract from the Charles proxy website:

As of Android N, you need to add configuration to your app in order to have it trust the SSL certificates generated by Charles SSL Proxying. This means that you can only use SSL Proxying with apps that you control.

In order to configure your app to trust Charles, you need to add a Network Security Configuration File to your app. This file can override the system default, enabling your app to trust user installed CA certificates (e.g. the Charles Root Certificate). You can specify that this only applies in debug builds of your application, so that production builds use the default trust profile.

Add a file res/xml/network_security_config.xml to your app:

<network-security-config>    
    <debug-overrides> 
        <trust-anchors> 
            <!-- Trust user added CAs while debuggable only -->
            <certificates src="user" /> 
        </trust-anchors>    
    </debug-overrides>  
</network-security-config>

Then add a reference to this file in your app's manifest, as follows:

<?xml version="1.0" encoding="utf-8"?> 
<manifest>
    <application android:networkSecurityConfig="@xml/network_security_config">
    </application> 
</manifest>
Answer from Dean Wild on Stack Overflow
🌐
Emteria
emteria.com › blog › install-root-certificate-android
Install root certificates on Android: Step up your device security
September 24, 2024 - In this guide, we'll define what Android trusted root certificates are, how to install root certificates on Android, and how to update them.
Top answer
1 of 12
144

Prior to Android KitKat you have to root your device to install new certificates.

From Android KitKat (4.0) up to Marshmallow (6.0) it's possible and easy. I was able to install the Charles Web Debbuging Proxy cert on my un-rooted device and successfully sniff SSL traffic.

Extract from http://wiki.cacert.org/FAQ/ImportRootCert

Before Android version 4.0, with Android version Gingerbread & Froyo, there was a single read-only file ( /system/etc/security/cacerts.bks ) containing the trust store with all the CA ('system') certificates trusted by default on Android. Both system apps and all applications developed with the Android SDK use this. Use these instructions on installing CAcert certificates on Android Gingerbread, Froyo, ...

Starting from Android 4.0 (Android ICS/'Ice Cream Sandwich', Android 4.3 'Jelly Bean' & Android 4.4 'KitKat'), system trusted certificates are on the (read-only) system partition in the folder '/system/etc/security/' as individual files. However, users can now easily add their own 'user' certificates which will be stored in '/data/misc/keychain/certs-added'.

System-installed certificates can be managed on the Android device in the Settings -> Security -> Certificates -> 'System'-section, whereas the user trusted certificates are manged in the 'User'-section there. When using user trusted certificates, Android will force the user of the Android device to implement additional safety measures: the use of a PIN-code, a pattern-lock or a password to unlock the device are mandatory when user-supplied certificates are used.

Installing CAcert certificates as 'user trusted'-certificates is very easy. Installing new certificates as 'system trusted'-certificates requires more work (and requires root access), but it has the advantage of avoiding the Android lockscreen requirement.

From Android N (7.0) onwards it gets a littler harder, see this extract from the Charles proxy website:

As of Android N, you need to add configuration to your app in order to have it trust the SSL certificates generated by Charles SSL Proxying. This means that you can only use SSL Proxying with apps that you control.

In order to configure your app to trust Charles, you need to add a Network Security Configuration File to your app. This file can override the system default, enabling your app to trust user installed CA certificates (e.g. the Charles Root Certificate). You can specify that this only applies in debug builds of your application, so that production builds use the default trust profile.

Add a file res/xml/network_security_config.xml to your app:

<network-security-config>    
    <debug-overrides> 
        <trust-anchors> 
            <!-- Trust user added CAs while debuggable only -->
            <certificates src="user" /> 
        </trust-anchors>    
    </debug-overrides>  
</network-security-config>

Then add a reference to this file in your app's manifest, as follows:

<?xml version="1.0" encoding="utf-8"?> 
<manifest>
    <application android:networkSecurityConfig="@xml/network_security_config">
    </application> 
</manifest>
2 of 12
45

I spent a lot of time trying to find an answer to this (I need Android to see StartSSL certificates). Conclusion: Android 2.1 and 2.2 allow you to import certificates, but only for use with WiFi and VPN. There is no user interface for updating the list of trusted root certificates, but there is discussion about adding that feature. It’s unclear whether there is a reliable workaround for manually updating and replacing the cacerts.bks file.

Details and links: http://www.mcbsys.com/techblog/2010/12/android-certificates/. In that post, see the link to Android bug 11231--you might want to add your vote and query to that bug.

🌐
Google Support
support.google.com › pixelphone › answer › 2844832
Add & remove certificates - Pixel Phone Help
Learn how to check your Android version. Open your device's Settings app. Tap Security & privacy More security settings Encryption & credentials. Tap Install a certificate Wi-Fi certificate.
🌐
GitHub
gist.github.com › pwlin › 8a0d01e6428b7a96e2eb
Android : add cert to system store · GitHub
... Meizu 16s also located here. Thanks :) ... Now we have to place our CA certificate inside the system certificate store located at /system/etc/security/cacerts/ in the Android filesystem.
🌐
Ivanti
help.ivanti.com › ap › help › en_US › fd › 2021 › Content › FileDirector › Admin › Clients › Install_Root_Certificate_on_Android.htm
Install Root Certificate on Android
This procedure is based on installing the root certificate on a Google Nexus phone running Android 4.0.4. It uses Internet Explorer in Windows 7 to download the certificate. You need to connect the phone to the PC using a USB cable in order to transfer the file to the device.
🌐
N4L Support
support.n4l.co.nz › s › article › Installing-an-SSL-Certificate-on-an-Android-Device-Manually
Installing an SSL or TLS Certificate on an Android Device (Manually)
This article describes the step by step process of manual installation of a Trusted Root Certification Authority SSL or TLS Certificate on an individual Android device.
🌐
mitmproxy
docs.mitmproxy.org › stable › howto › install-system-trusted-ca-android
Install System CA Certificate on Android Emulator
Now we have to place our CA certificate inside the system certificate store located at /system/etc/security/cacerts/ in the Android filesystem. By default, the /system partition is mounted as read-only. The following steps describe how to gain write permissions on the /system partition and ...
🌐
Kaspersky
support.kaspersky.com › secure-mobility-management › 2.0 › 241826
Installing root certificates on Android devices
For instructions on how to install certificates in personal profiles, please refer to Installing root certificates on the device. To add a root certificate in Kaspersky Security Center: In the console tree, in the Managed devices folder, select the administration group to which the Android devices ...
Find elsewhere
🌐
IBM
ibm.com › docs › en › mpf › 7.1.0
Installing the root CA on Android
We cannot provide a description for this page right now
Top answer
1 of 8
24

I figured out a way to do this, thus i was able to trust charles proxy certificate. it will be added as trusted SSL root certificate.

First you need to get the certificate hash

openssl x509 -inform PEM -subject_hash_old -in charles-proxy-ssl-proxying-certificate.pem | head -1>hashedCertFile

i use windows, store it in a var in a matter to automate the process

set /p certHash=<hashedCertFile
    

set certHash=%certHash%.0 && DEL toto
cat charles-proxy-ssl-proxying-certificate.pem > %certHash%

openssl x509 -inform PEM -text -in charles-proxy-ssl-proxying-certificate.pem -out nul >> %certHash%

adb shell mount -o rw,remount,rw /system

adb push %certHash% /system/etc/security/cacerts/

adb shell mount -o ro,remount,ro /system

adb reboot

This is the unix version copied from this answer:

PEM_FILE_NAME=logger-charles-cert.pem
hash=$(openssl x509 -inform PEM -subject_hash_old -in $PEM_FILE_NAME | head -1)
OUT_FILE_NAME="$hash.0"

cp $PEM_FILE_NAME $OUT_FILE_NAME
openssl x509 -inform PEM -text -in $PEM_FILE_NAME -out /dev/null >> $OUT_FILE_NAME

echo "Saved to $OUT_FILE_NAME"
adb shell mount -o rw,remount,rw /system
adb push $OUT_FILE_NAME /system/etc/security/cacerts/
adb shell mount -o ro,remount,ro /system
adb reboot
2 of 8
23

Thanks to this answer Install User Certificate Via ADB I was able to adapt a script that works on a bash shell:

PEM_FILE_NAME=logger-charles-cert.pem
hash=$(openssl x509 -inform PEM -subject_hash_old -in $PEM_FILE_NAME | head -1)
OUT_FILE_NAME="$hash.0"

cp $PEM_FILE_NAME $OUT_FILE_NAME
openssl x509 -inform PEM -text -in $PEM_FILE_NAME -out /dev/null >> $OUT_FILE_NAME

echo "Saved to $OUT_FILE_NAME"
adb shell mount -o rw,remount,rw /system
adb push $OUT_FILE_NAME /system/etc/security/cacerts/
adb shell mount -o ro,remount,ro /system
adb reboot

(Yes, I know this should probably be a comment, but I don't have enough reputation to post it as a comment yet)

🌐
Reddit
reddit.com › r/androiddev › adding root ca certs on android 11
r/androiddev on Reddit: Adding Root CA certs on Android 11
February 6, 2024 -

I'm looking for information / instructions on how to add root / trusted CA certs onto a device. All the info I'm seeing is from older versions. We're looking to implement 802.1x EAP authentication for a private network. Dev's are saying w/ v11 it's not possible and point to this https://httptoolkit.com/blog/android-11-trust-ca-certificates/. One of us has a reading comprehension problem as that doesn't mean what they think it does (IMO). Well, I'm from Missouri, you're gonna have to show me.

TLDR:

Is it possible to load a root / trust anchor cert on v11 and have the system use it for trusting a cert for authentication purposes

🌐
Briankhuu
briankhuu.com › blog › 2024 › 04 › 01 › updating-root-ca-certificates-on-citaq-h10-android-device
Updating Root CA Certificates on a very old CITAQ H10 Android Device
# Pre Setup DEVICE_IP=192.168.152.248 # Download the CA certificates archive cd /tmp/ wget -O android-ca.tar.gz https://android.googlesource.com/platform/system/ca-certificates/+archive/refs/heads/main/files.tar.gz # Create a temporary directory to extract the certificates mkdir /tmp/cacerts # Extract the CA certificates to the temporary directory tar -xzvf android-ca.tar.gz -C /tmp/cacerts/ # Connect to the device adb connect ${DEVICE_IP}:5555 # Enter root mode (wait at least X seconds for adbd to restart into root mode) adb root timeout 40 adb wait-for-any-device # Push the temporary directo
🌐
Start9
docs.start9.com › 0.3.4.x › guides › device-guides › dg-android › lan-android
Start9 | Trust Your Root CA on Android
Tap Settings > Security > Advanced > Encryption and Credentials > Install from Storage and select your unique adjective-noun.local.crt certificate. On some devices, it may be necessary to also activate this setting in Firefox / Fennec: Tap Kebab ...
🌐
Medium
splitunknown.medium.com › importing-a-certificate-and-installing-it-on-android-67867b8dcd80
Importing a Certificate and Installing it on Android | by JAY BHATT | System Weakness | android hacking | ssl pinning | burp | SplitUnknow | Medium
September 22, 2023 - Now, copy the PEM certificate to ... ADB (Android Debug Bridge). To install the certificate, you’ll need to mount the system partition as read-write....
🌐
DigiCert
digicert.com › blog › official-list-trusted-root-certificates-android
Official List of Trusted Root Certificates on Android | DigiCert.com
April 18, 2018 - If you want to check the list of trusted roots on a particular Android device, you can do this through the Settings app. This allows you to verify the specific roots trusted for that device. ... Tap “Trusted credentials.” This will display a list of all trusted certs on the device. You can also install, remove, or disable trusted certificates from the “Encryption & credentials” page.
🌐
Medium
pswalia2u.medium.com › install-burpsuites-or-any-ca-certificate-to-system-store-in-android-10-and-11-38e508a5541a
Install Burpsuite’s or any CA certificate to system store in Android 10 and 11.
September 12, 2024 - We will be installing burpsuite’s CA. To do these follow these simple steps: Export Burp CA certificate and Save it as burp.der. But it is encoded we need to convert it to PEM format. ... 2. Open the certificate. Convert it to base64 encoded PEM format. Save it as “burp.cer”. It should look like this. ... Prerequisites: Rooted Android 10/11, Magisk and TWRP.