Clean up the default algorithm handling, now that JSSE 1.0 is no longer supported.
authorbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Apr 2006 00:37:32 +0000 (00:37 +0000)
committerbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Apr 2006 00:37:32 +0000 (00:37 +0000)
At least now, you should be able to run SSL on a non-Sun JVM out of the box :).

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@396357 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java

index 0d317df..e997339 100644 (file)
@@ -82,7 +82,6 @@ public class JSSESocketFactory
 \r
     // defaults\r
     static String defaultProtocol = "TLS";\r
-    static String defaultAlgorithm = "SunX509";\r
     static boolean defaultClientAuth = false;\r
     static String defaultKeystoreType = "JKS";\r
     private static final String defaultKeystoreFile\r
@@ -361,7 +360,7 @@ public class JSSESocketFactory
             // Certificate encoding algorithm (e.g., SunX509)\r
             String algorithm = (String) attributes.get("algorithm");\r
             if (algorithm == null) {\r
-                algorithm = defaultAlgorithm;\r
+                algorithm = KeyManagerFactory.getDefaultAlgorithm();;\r
             }\r
 \r
             String keystoreType = (String) attributes.get("keystoreType");\r
@@ -371,7 +370,7 @@ public class JSSESocketFactory
 \r
         String trustAlgorithm = (String)attributes.get("truststoreAlgorithm");\r
         if( trustAlgorithm == null ) {\r
-        trustAlgorithm = algorithm;\r
+            trustAlgorithm = TrustManagerFactory.getDefaultAlgorithm();\r
         }\r
             // Create and init SSLContext\r
             SSLContext context = SSLContext.getInstance(protocol); \r
@@ -433,10 +432,6 @@ public class JSSESocketFactory
      */\r
     protected TrustManager[] getTrustManagers(String keystoreType, String algorithm)\r
         throws Exception {\r
-        if (attributes.get("truststoreAlgorithm") == null) {\r
-            // in 1.5, the Trust default isn't the same as the Key default.\r
-            algorithm = TrustManagerFactory.getDefaultAlgorithm();\r
-        }\r
         String crlf = (String) attributes.get("crlFile");\r
         \r
         TrustManager[] tms = null;\r