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!