java.security.NoSuchAlgorithmException: Default SSLContext not available
843811Apr 12 2010 — edited Apr 14 2010I'm very stuck on this exception and hope someone has seen it before: java.security.NoSuchAlgorithmException: Default SSLContext not available
I'm trying to use NSS and JSSE in FIPS-Compliant mode to access the VM Ware SDK.
The error seems obvious enough, but the protocols I am trying are supposed to be supported ... TLS, SSLv3 etc.
Here is my code:
<Main user client which sets things up>
(The other conflicting providers have been taken out of my java.security file per Andreas Sterbenz blogs)
String configFileName = "C:\\devel\\libs\\nss3.12.4\\ddmi-nss.cfg";
java.security.Provider testFips = new sun.security.pkcs11.SunPKCS11(configFileName);
Security.addProvider(testFips);
KeyStore ks = KeyStore.getInstance("PKCS11",testFips);
ks.load(null, "RealPasswordIsHere".toCharArray());
<Later in 3rd party ViJava library I am editing WSClient.java -- just in case this is helpful info>
Original line from file is:
SSLContext sc = SSLContext.getInstance("SSL");
I've tried:
SSLContext sc = SSLContext.getInstance("TLS");
SSLContext sc = SSLContext.getInstance("SSLv3");
etc etc with just about every possibility I could find in the standard names in the Java documentation.
The actual exception is triggered later when we try to get a stream.... some more relevant code...
HttpURLConnection postCon = (HttpURLConnection) baseUrl.openConnection();
OutputStream os = postCon.getOutputStream(); <---- THIS IS WHAT THROWS THE EXCEPTION
This is the stack trace:
java.net.SocketException: java.security.NoSuchAlgorithmException: Default SSLContext not available
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:179)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:186)
at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:362)
at sun.net.NetworkClient.doConnect(NetworkClient.java:145)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:904)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
at com.vmware.vim25.ws.WSClient.post(WSClient.java:238)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:174)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:122)
at com.vmware.vim25.ws.VimStub.retrieveServiceContent(VimStub.java:1341)
at com.vmware.vim25.mo.ServiceInstance.<init>(ServiceInstance.java:85)
Thanks in advance for any help. Seems like someone else must have run into this before :-)