Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install certificate on AndroidTV

Tags:

android-tv

I was needing to view the backend https requests made by my androidTV's application, but, as the calls are "https" calls I am needing to install a charles certificate (on my androidTV) to allow charles to decrypt them.

If anyone knows how to install a certificate on androidTV please tell me.

Thanks a lot!

like image 200
Sebastian Corradi Avatar asked Feb 24 '17 18:02

Sebastian Corradi


People also ask

What is certificate Authority installed on Android?

It means that someone installed a public certificate that your phone will trust for all secure (mostly Web) operations like you entering your banking password. Whoever holds the corresponding private certificate can create on-the-fly fake certificates for any domain on the Internet.


2 Answers

I wrote an article on this: https://zahidrasheed.medium.com/charles-proxy-with-androidtv-fedc863e7039

TLDR; 1- Export root certificate from charles app and put it under res/raw by:

Help > SSL Proxying > Save Charles Root Certificate… and save it as charles_ssl_cert.pem file.

2- Embed the certificate in the app through network-security-config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="system" />
            <certificates src="@raw/charles_ssl_cert" />
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

3- Export the root certificate again by:

Help > SSL Proxying > Export Charles Certificate and Private Key

Now share the .p12 file with users who would like to test the app. The need to:

Proxy > SSL Proxying Settings > Root Certificate > Import P12 (Enter the password you used above).
like image 90
Zahid Rasheed Avatar answered Sep 22 '22 16:09

Zahid Rasheed


You can do it programmatically. See here for more details. I haven't found an option to do it from the Android TV UI unfortunately.

EDIT: Even that fails with

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/com.android.settings.CredentialStorage}; have you declared this activity in your AndroidManifest.xml?

So I don't know how to do this...

like image 25
mbonnin Avatar answered Sep 23 '22 16:09

mbonnin