How to install a root certificate on Android, and which apps trust it

Three certificates with a seal and the Android robot

A root certificate, also called CA certificate, identifies a certificate authority that a device trusts: the device accepts an encrypted connection only if the certificate of the server leads back to one of its root certificates. On Android 17 with the standard settings of the Android Open Source Project (AOSP), a root certificate is installed under Security & privacy > More security & privacy > Encryption & credentials > Install a certificate > CA certificate. Other Android versions and the interfaces of manufacturers such as Samsung or Xiaomi arrange these menus differently. Android places the certificate in the user certificate store. Chrome and other Chromium-based browsers trust this store, but most apps ignore it unless their developers decided otherwise. A certificate that every app trusts has to be in the system store, and the system store only changes with a new OS image.

This article shows how to install a root certificate, where Android stores it, which apps trust it and how a company certificate reaches a whole fleet of devices. We tested every step on a Raspberry Pi 4 with Android 17 built by Emteria (release 17.2.0), which uses the AOSP settings without a manufacturer's interface. The test used our own certificate authority and our own server.

A root certificate decides which servers a device trusts

Before a device sends data over an encrypted connection, it checks the certificate of the server. A certificate authority (CA) has signed this certificate, often through one or more intermediate CAs. At the top of the chain stands the root certificate, which the CA has signed itself. The device accepts the connection only if the chain ends at a root certificate in its own list of trusted certificates, the root store.

Chain of trust: the client checks the server certificate and the intermediate CA certificate against the root certificates in its root store

Installing a root certificate therefore makes the device trust every certificate that this CA issues. Companies need this for internal servers and test systems that use certificates from a company CA, and for debugging proxies that inspect encrypted traffic. Whoever controls the CA can impersonate any server to the device and read its encrypted traffic, so a root certificate should only come from the device owner's own organization.

Android has two certificate stores: system and user

Android separates the trusted certificates into two stores:

  • The system store comes with the OS and holds the root certificates of the public certificate authorities. On our Android 17 build, it holds 145 certificates. Every app trusts it. Since Android 14, the certificates are stored in /apex/com.android.conscrypt/cacerts; the older folder /system/etc/security/cacerts still holds a copy.

  • The user store holds the certificates that a user or a device management system has added. Android saves them in /data/misc/user/0/cacerts-added as separate files.

The settings show both stores on the tabs System and User under Encryption & credentials > Trusted credentials.

How to install a CA certificate in the Android settings

The certificate has to be on the device as a file, for example in the Downloads folder. In our test, Android accepted the same certificate as a PEM file (.crt) and as a DER file (.cer). These are the steps on Android 17 with the AOSP settings:

  1. Open Settings > Security & privacy > More security & privacy > Encryption & credentials.

  2. Tap Install a certificate and then CA certificate.

  3. Android warns that the owner of the certificate could read private data. Confirm with Install anyway.

  4. Select the certificate file. Android confirms with the message "CA certificate installed".

Android 17 settings, Install a certificate: the entries CA certificate, VPN & app user certificate and Wi-Fi certificate

Android 17 offers three kinds of certificates to install

Android 17 warning before installing a CA certificate: Your data won't be private, with the buttons Install anyway and Don't install

The warning that Android shows before it installs a CA certificate

The certificate now appears under Trusted credentials > User, and Android shows the permanent notification "Certificate authority installed". In our test, the device needed no screen lock for the installation, and the certificate was still in place after a restart. We did not test other Android versions or manufacturer interfaces, where the entries are named and placed differently.

The other two entries of the menu install other kinds of certificates. A VPN & app user certificate identifies the device itself to a server and includes a private key. A Wi-Fi certificate is used to log in to a company Wi-Fi network.

Most apps ignore an installed certificate

For the test, we set up an HTTPS server with a certificate from our own CA and opened it on the device, first in the preinstalled Chromium-based browser and then in two small apps built for this test.

Before the installation, the browser refused the page with the error NET::ERR_CERT_AUTHORITY_INVALID. After the installation, the same page loaded and the browser showed "Connection is secure".

The first test app used the default settings of an Android app and still failed even though the CA was installed:

SSLHandshakeException: java.security.cert.CertPathValidatorException:
Trust anchor for certification path not found.

Android behaves this way on purpose: since Android 7, an app trusts only the system store unless its developer allows more in the network security configuration of the app. The second test app contained this configuration:

<network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
</network-security-config>

With it, the second app reached the same server without an error. The configuration can also limit the trust to single domains or to a certificate that is included in the app. Google describes all options in the documentation of the network security configuration.

An installed certificate helps with browsers and with apps whose developers support it. Apps from other vendors cannot be made to trust it from the outside.

The system store changes only with a new OS image

For a certificate that every app trusts, the system store is the only place. Older guides copy the certificate into /system/etc/security/cacerts on a rooted device. On current Android versions, this no longer works. In our test, even a root shell could not write to either folder:

cp: /system/etc/security/cacerts/524b354a.0: Read-only file system
cp: /apex/com.android.conscrypt/cacerts/524b354a.0: Read-only file system

Both folders belong to the OS image, and verified boot protects the image against changes. A certificate for the system store has to be added before the image is built. In the Android source code, the certificates of the system store are files in the folder external/conscrypt/apex/ca-certificates/files, and the copy for the older folder is in system/ca-certificates/files. Each file is named after the hash of the certificate, which this command prints:

openssl x509 -subject_hash_old -noout -in company-ca.crt

For our test certificate, the command printed 524b354a, and Android stored the certificate as 524b354a.0. Device makers who work with Emteria get such a change as part of their custom Android image, and every device that is flashed with the image trusts the company CA from its first start.

Root certificates are updated with the OS

The list of public certificate authorities changes: new root certificates are added, old ones expire, and a CA that loses its trust is removed. A device with an outdated system store sooner or later fails to connect to servers that use a newer CA.

Since Android 14, the system store is part of an updatable system module. On devices with Google Play, Google can update this module without a full OS update. Devices without Google services, which includes many kiosks, terminals and other dedicated devices, receive a changed system store only with an OS update from the device maker. On our build, the module is loaded from the OS image.

The root store is one more reason why devices in the field need OS updates for their whole service life. Our long-term support delivers these updates to the devices over the air.

How to remove or disable a certificate

A certificate from the user store is removed under Trusted credentials > User: tap the certificate, choose Uninstall and confirm. In our test, the browser and the test app refused the test server again right after this step. Encryption & credentials > Clear credentials removes all certificates of the user store at once.

Certificates of the system store cannot be deleted, but each one can be switched off. Under Trusted credentials > System, a tap on a certificate opens its details with the button Disable. The same dialog later offers Enable.

Company certificates for a fleet of devices

Installing a certificate by hand works for a single device. A fleet gets a company certificate in one of three ways, which differ in the apps that trust the certificate:

  • As part of the OS image, the certificate is in the system store, so every app trusts it. This is the way for device makers who control the OS of their product.

  • With device management, the certificate is installed remotely. The Emteria Hub offers the device command Install certificate, which installs a certificate file that is already on the device. The command Download file brings the file to the device first. Our knowledge base lists both in the overview of device commands.

  • A company that develops its own app can include the company CA in the network security configuration of that app. The devices then need no change.

With Emteria, the company CA is part of the OS image

A product that talks to company servers needs the right certificates on every device, and it needs them to stay current for years. Emteria builds and maintains custom Android OS for device makers: the company CA in the image, OS updates that keep the root store current, and the Emteria Hub to manage the devices in the field. For a device fleet that should trust the right servers from its first start, talk to us.

Raspberry Pi is a trademark of Raspberry Pi Ltd.

Build unique products, boost device performance

See why Emteria is the chosen Android™ customization & management platform for OEM solution builders, and what it can do for your team and customers.

Book live demo
Android-head-use-cases
Back to Blog

Table of contents

emteria Demo
See emteria in action