Is the SSL binding implementation for android implemented correctly and why does this error appear in the logarithm?

I get this error in my logarithm. I applied ssl commit in android app. I think I did something wrong that causes this error.

05-19 17:39:54.998: E/NativeCrypto(30908): ssl=0x5eefaf80 cert_verify_callback x509_store_ctx=0x5dbea940 arg=0x0 05-19 17:39:54.998: E/NativeCrypto(30908): ssl=0x5eefaf80 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA 

Next up is my ssl pinning Android code. Which works, but throws the above error.

 public static HttpClient getHttpClient(HttpParams params, Context context) throws CertificateException, KeyStoreException, NoSuchAlgorithmException, IOException, KeyManagementException, UnrecoverableKeyException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); InputStream caInput = context.getResources().openRawResource(R.raw.abc); Certificate ca; try { ca = cf.generateCertificate(caInput); } finally { try { caInput.close(); } catch (IOException e) { Log.e("Error","Closing the cert file",e); } } String keyStoreType = KeyStore.getDefaultType(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(null, null); keyStore.setCertificateEntry("ca", ca); SSLSocketFactory sf = new TrustSelectCertsSSLSocketFactory(keyStore,context); sf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.UTF_8); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https", sf, 443)); ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry); DefaultHttpClient client = new DefaultHttpClient(ccm, params); DefaultHttpRequestRetryHandler defaultHttpRequestRetryHandler = new DefaultHttpRequestRetryHandler(0, false); client.setHttpRequestRetryHandler(defaultHttpRequestRetryHandler); return client; } 

Code TrustSelectCertSSLFactory.java

 public class TrustSelectCertSSLSocketFactory extends SSLSocketFactory { SSLContext sslContext = SSLContext.getInstance("TLS"); public TrustSelectCertSSLFactory(KeyStore truststore, Context context) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException, CertificateException { super(truststore); String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm); tmf.init(truststore); sslContext.init(null, tmf.getTrustManagers(), null); } @Override public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException { return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); } @Override public Socket createSocket() throws IOException { return sslContext.getSocketFactory().createSocket(); } } 

Code calling getHttpClient

 .... HttpClient client = getHttpClient(params,context); .... httpResponse = client.execute(post); .... 

Is the SSL binding implementation implemented correctly and why does this error appear in the logarithm? If you need more information, please indicate this in the comments section.

I searched on google, but this gave me solutions that are not a solution to this problem. Is there anything else I should look for?

reference 1

reference 2

+7
android ssl-certificate x509certificate pinning
source share

No one has answered this question yet.

See similar questions:

2
are nativecrypto error messages error messages?

or similar:

3295
Why is the Android emulator so slow? How can we speed up Android emulator development?
1858
"Debug certificate expired" error in Android Eclipse plugins
964
Download the file from Android and show the progress in ProgressDialog
935
R cannot be resolved - Android error
687
Android error: Failed to install * .apk on device *: timeout
242
Why is nothing displayed on my Android?
0
How to implement SSL SSL proxy in Java, which overcomes certificate errors in browsers?
0
Encryption and decryption in FingerPrint
0
Implementing Websocket Server Android

All Articles