How to initialise an SSLContext with trust defined by network_security_config?


Within an Android app I am building an SSLContext in order to use a raw TLS socket to a remote service.

Rather than having to manually load a KeyStore with the necessary trust material in the correct format, I would like to leverage Android's existing security configuration that I am already using to define trust material for regular HTTPS.

However, I don't see any way to programmatically access those keystores or otherwise get a TrustManagerFactory for them. Is this possible, or is there no bridge between these systems and I do indeed have to repeat the configuration in code?

I have seen the AndroidKeyStore provider, but that appears to only access private keys for the specific user('s device), not certificates configured for the app.

2
Feb 4 at 5:50 PM
User AvatarOrangeDog
#android#keystore#jce#sslcontext

No answer found for this question yet.