Hi,

there is an official port on http://hc.apache.org/httpcomponents-client-4.3.x/android-port.html

You "forgot" to give usage instructions for it, as it seems. What needs to be done for this to work? For example, is it enough to just place the jar file in the libs dir, and it will automatically use the new 4.3 code base when using "... = new DefaultHttpClient()" ? Or do I need to instantiate it the "new way", i.e. using "HttpClients.createDefault()" ?

In that regard, I'm also wondering how to teach the Http-client a custom certificate chain, given that I'm using a Root CA which isn't known to all Android devices by default. So far I was able to do that using Android's old HttpClient implementation, by creating a new SchemeRegistry and registering a SSLSocketFactory which accepts a KeyStore reference.

So far I have some code and I believe it is correct, but you're not providing any examples and there also aren't any on the net:

CloseableHttpClient testClient = null;
                    SSLContextBuilder builder = new SSLContextBuilder();
                    KeyStore trusted;
            try {
                trusted = KeyStore.getInstance("BKS");
InputStream in = MainActivity.this.getResources().openRawResource(R.raw.mykeystorefileWithCertificates);
                try {
                    trusted.load(in, "mobile360".toCharArray());
                } finally {
                    in.close();
                }
                builder.loadTrustMaterial(trusted);
                SSLContext sslContext = builder.build();
SSLConnectionSocketFactory test = new SSLConnectionSocketFactory(sslContext); testClient = HttpClientBuilder.create().setSSLSocketFactory(test).build();
            } catch (Exception e) {
                e.printStackTrace();
            }

Maybe some tutorials are in order?
Best regards!
Marius
--
Marius Shekow
Mixed and Augmented Reality Solutions, Fraunhofer FIT
http://www.fit.fraunhofer.de/mars
Tel.: +49 (0)2241 - 14-2184

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to