Note that there are some explanatory texts on larger screens.

plurals
  1. POSSL not working on Android 2.2 (only in 2.3)
    primarykey
    data
    text
    <p>I'm getting this on LogCat when httpsURLConnection.getInputStream() is called</p> <blockquote> <p>SSL handshake failure: Failure in SSL library, usually a protocol error error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate (external/openssl/ssl/s3_pkt.c:1127 0x29eb40:0x00000003)</p> </blockquote> <p>I have tested it on Andorid 2.3 and it works nicely.</p> <p>My server requires client authentication! Maybe FROYO does not support this kind of handshake... I don't know...</p> <p><strong>I tried using httpclient as well. Fail in every case...</strong></p> <pre><code>private void process() throws Exception { char[] pass = "clientpass".toCharArray(); InputStream ksStream = getAssets().open("clientKeyStore.bks"); KeyStore keyStore = KeyStore.getInstance("BKS"); keyStore.load(ksStream, pass); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keyStore, pass); ksStream.close(); X509TrustManager[] tm = new X509TrustManager[] { new X509TrustManager() { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } } }; SSLContext context = SSLContext.getInstance("TLS"); context.init(kmf.getKeyManagers(), tm, null); HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }); URL url = new URL("https://192.168.2.101:8443/RestTomcat/resources/veiculos/KKK1234"); HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection(); BufferedReader br = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) sb.append(line + "\n"); br.close(); Log.e("OUTPUT", sb.toString()); httpsURLConnection.disconnect(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload