File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes SSL code returns HTTPClient.HttpURLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "SSL code returns HTTPClient.HttpURLConnection" Watch "SSL code returns HTTPClient.HttpURLConnection" New topic
Author

SSL code returns HTTPClient.HttpURLConnection

Raj Bk
Greenhorn

Joined: May 16, 2011
Posts: 2
Hi Experts,

Challenge: connect to a secured site to post some data.
Issue: tried several ways, HTTPSURLConnection is not getting obtained, just HTTPClient.HttpURLConnection every time.

Environment: OS - Linux, version 2.6.9.
java.version: 1.5.0_10.
Server: Oracle iAS Apache Jserv.


SSL context is initialized as :
Its provider info when printed in debug is: SunJSSESun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)

Security Provider Name when printed with Security.getProviders()[0].getName() is SUN

Security providers list when printed with a loop:

SUN-1.5-sun.security.provider.Sun-SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
SunRsaSign-1.5-sun.security.rsa.SunRsaSign-Sun RSA signature provider
SunJSSE-1.5-com.sun.net.ssl.internal.ssl.Provider-Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
SunJCE-1.5-com.sun.crypto.provider.SunJCE-SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
SunJGSS-1.0-sun.security.jgss.SunProvider-Sun (Kerberos v5)
SunSASL-1.5-com.sun.security.sasl.Provider-Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)


default environment property value for java.protocol.handler.pkgs is HTTPClient

(Is there anything need to be done to change this so that it can check the standard JSSE packages from javax ?)

https.proxyHost and https.proxyPort are set to proper network proxy server.

Keystroke is initialized as follows:

KeyManagerFactory is initialized as follows:

TrustManager is initialized as follows:

SSLContext is obtained as:

Finally, defaults for HTTPS are set (before any urlconnection is opened) as below.

Now, url is opened as (with proper https:// url)

and url.openConnection() is not resulting in HTTPS.

May I Please know how to fix this please !
Thanks a lot in advance for any kind help here!
Raj Bk
Greenhorn

Joined: May 16, 2011
Posts: 2
Do I need to dump any additional information to check this ?
 
 
subject: SSL code returns HTTPClient.HttpURLConnection
 
Similar Threads
about HTTPS connection
How can I bypass CertificateExpiredException while using Axis 1.4?
KeyStore
Invalidate trusting certificate control
PFX to JKS Conversion error