web services - SSLHandshakeException: Certificate Exception using HttpURLConnetion with Android 4.2.2 -


i struggling strange issue, while using httpurlconnection webservice api call in android. getting below exception only android version 4.2.2. working fine in android 4.0.3, 4.3 , 4.4 , above. using below code service api call.

httpurlconnection mconn = (httpurlconnection)murl.openconnection(); mconn.addrequestproperty("connection", "close"); mconn.setconnecttimeout(connection_timeout); mconn.setreadtimeout(socket_timeout); mconn.setusecaches(true); mconn.setrequestmethod("post"); string param = utils.appendqueryparams(null,this.stringparams); mconn.setdoinput(true); mconn.setdooutput(true); mconn.setfixedlengthstreamingmode(param.getbytes().length); mconn.setrequestproperty("content-type", "application/x-www-form-urlencoded"); mconn.setrequestproperty("accept", "application/json"); mconn.connect(); printwriter out = new printwriter(mconn.getoutputstream()); out.print(param); out.close(); 

here exception (only in android sdk version 4.2.2)

08-18 11:43:22.663  26427-26485/com.abc.xyz w/system.err﹕ javax.net.ssl.sslhandshakeexception: com.android.org.bouncycastle.jce.exception.extcertpathvalidatorexception: issuername(cn=go daddy root certificate authority - g2, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) not match subjectname(cn=go daddy root certificate authority - g2, ou=https://certs.godaddy.com/repository/, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) of signing certificate. 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.opensslsocketimpl.starthandshake(opensslsocketimpl.java:381) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpconnection.setupsecuresocket(httpconnection.java:209) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpsurlconnectionimpl$httpsengine.makesslconnection(httpsurlconnectionimpl.java:478) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpsurlconnectionimpl$httpsengine.connect(httpsurlconnectionimpl.java:433) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpengine.sendsocketrequest(httpengine.java:290) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpengine.sendrequest(httpengine.java:240) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:81) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ libcore.net.http.httpsurlconnectionimpl.connect(httpsurlconnectionimpl.java:165) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ com.halomem.android.utils.servicecall.executerequest(servicecall.java:86) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ com.halomem.android.impl.session$1.run(session.java:161) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ caused by: java.security.cert.certificateexception: com.android.org.bouncycastle.jce.exception.extcertpathvalidatorexception: issuername(cn=go daddy root certificate authority - g2, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) not match subjectname(cn=go daddy root certificate authority - g2, ou=https://certs.godaddy.com/repository/, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) of signing certificate. 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.trustmanagerimpl.checktrusted(trustmanagerimpl.java:296) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.trustmanagerimpl.checkservertrusted(trustmanagerimpl.java:197) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.opensslsocketimpl.verifycertificatechain(opensslsocketimpl.java:597) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.nativecrypto.ssl_do_handshake(native method) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.opensslsocketimpl.starthandshake(opensslsocketimpl.java:378) 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ ... 9 more 08-18 11:43:22.833  26427-26485/com.abc.xyz w/system.err﹕ caused by: com.android.org.bouncycastle.jce.exception.extcertpathvalidatorexception: issuername(cn=go daddy root certificate authority - g2, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) not match subjectname(cn=go daddy root certificate authority - g2, ou=https://certs.godaddy.com/repository/, o="godaddy.com, inc.", l=scottsdale, st=arizona, c=us) of signing certificate. 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ @ com.android.org.bouncycastle.jce.provider.rfc3280certpathutilities.processcerta(rfc3280certpathutilities.java:1525) 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ @ com.android.org.bouncycastle.jce.provider.pkixcertpathvalidatorspi.enginevalidate(pkixcertpathvalidatorspi.java:305) 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ @ com.sec.android.security.pkix.seccertpathvalidatorspi.enginevalidate(seccertpathvalidatorspi.java:99) 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ @ java.security.cert.certpathvalidator.validate(certpathvalidator.java:190) 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ @ org.apache.harmony.xnet.provider.jsse.trustmanagerimpl.checktrusted(trustmanagerimpl.java:283) 08-18 11:43:22.843  26427-26485/com.abc.xyz w/system.err﹕ ... 13 more 

please suggest in regard.

thanks himanshu.

important note

check device time correct or not ?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -