Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stuck in Charles Proxy Certificate Installation for Android TV / Fire TV

We started working on Android TV recently and we need to connect charles proxy tool for ease of development process. We were able to set proxy on tv using same wifi connection.

But we are not getting any way to install the charles trusted certificate in Android tv. We tried various approach but could not get any working one:

  1. We tried pushing certificate to android tv, but there was no way ahead to install certificate kept in tv storage.

  2. We could not find "Install Certificate" option in advanced wifi which is available in android phones. We used this option in mobiles to install certificate kept in local device storage.

  3. We tried setting proxy and then we were trying to open www.charlesproxy.com/getssl on chrome to download and install certificate, but this approach was also not working. We were not able to launch chrome via google assistance because of proxy enabled.

  4. We tried approach provided in the url:

how to install CA certificate programmatically on Android without user interaction

But the above approach was not working. The commands were giving permission denied issues. We don't want our android tv to be rooted.

Kindly help us with a way to install the trust certificate. Any help would be really appreciated.!!

like image 238
ajay Avatar asked Oct 16 '22 06:10

ajay


1 Answers

I think that you probably already solved your problem, but for somebody else that is still struggling with this you can try:

  1. Export the certificate from Charles app. usually named 'charles_ssl_proxying_certificate.pem'

  2. Add that certificate as a raw file to you android project. (src/res/raw)

  3. Create a new resources folder 'xml' (probably you already have it)

  4. Create a new xml file called 'network_security_config.xml'

  5. Paste this content within that new file

    <network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
    <debug-overrides>
        <trust-anchors> 
            <certificates src="@raw/charles_ssl_proxying_certificate"/>
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
    </network-security-config>
    
  6. Add this line to you androidManifest for the application tag

    android:networkSecurityConfig="@xml/network_security_config"
    

If you have already configure the proxy on your AndroidTV this should be enough

like image 152
David Alejandro Burgos Rodas Avatar answered Oct 29 '22 15:10

David Alejandro Burgos Rodas