java - Certificate chain different between HTTPSURLconnection and Apache (System) DefaultHttpClient -


i facing weird issue wrto apache https client. trying connect external https website has basic authentication turned on (ssl server authenticaion only). here summary of tests , conclusions.

  • use either of chrome/firefox/ie connect website -> success

  • use javax.net.ssl.httpsurlconnection -> success

  • use either of defaulthttpclient or systemdefaulthttpclient -> failure

i tried debug enabling "javax.net.debug" "ssl". noticed both clients pick same trust store (default jdk trust store) , use same protocol (tlsv1). however, differences here

i noticed following extension returned jdk

extension server_name, server_name: [host_name: websitehostname]

while above extension missing in apache web client debug log.

also, 1 more difference saw in certficate chain

the below response jdk native

* certificate chain chain [0] = [ [ version: v3 subject: **cn=websitename, ou=domain control validated - rapidssl(r), ou=see www.rapidssl.com/resources/cps (c)13, ou=gt17702541, serialnumber=q2la1fpflfdny4kuciehylmvw6bq64ch signature algorithm: sha1withrsa, oid = 1.2.840.113549.1.1.5

while in apache client following

chain [0] = [ [ version: v3 subject: emailaddress=root@i4319, cn=i4319, ou=someorganizationalunit, o=someorganization, l=somecity, st=somestate, c=-- signature algorithm: sha1withrsa, oid = 1.2.840.113549.1.1.5

and following exception apache https client.

exception in thread "main" javax.net.ssl.sslpeerunverifiedexception: peer not authenticated 

before go , redo work use jdk native client, know happening. insight on behaviour appreciated.

after lot of searching looks weird issue because of lack of sni support in apache client. here jira discusses problem , possible solution here

https://issues.apache.org/jira/browse/httpclient-1119

and possible work around here

https://wiki.apache.org/httpcomponents/snisupport


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -