Author: markt Date: Fri Jun 29 12:04:21 2018 New Revision: 1834672 URL: http://svn.apache.org/viewvc?rev=1834672&view=rev Log: First pass at adding DKS support (no docs)
Modified: tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java Modified: tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java?rev=1834672&r1=1834671&r2=1834672&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java Fri Jun 29 12:04:21 2018 @@ -81,14 +81,7 @@ public class ConfigFileLoader { } // File didn't work so try URI. - // Using resolve() enables the code to handle relative paths that did - // not point to a file - URI uri; - if (CATALINA_BASE_URI != null) { - uri = CATALINA_BASE_URI.resolve(location); - } else { - uri = URI.create(location); - } + URI uri = getURI(location); // Obtain the input stream we need try { @@ -98,4 +91,17 @@ public class ConfigFileLoader { throw new IOException(sm.getString("configFileLoader.cannotObtainURL", location), e); } } + + + public static URI getURI(String location) { + // Using resolve() enables the code to handle relative paths that did + // not point to a file + URI uri; + if (CATALINA_BASE_URI != null) { + uri = CATALINA_BASE_URI.resolve(location); + } else { + uri = URI.create(location); + } + return uri; + } } Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java?rev=1834672&r1=1834671&r2=1834672&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java Fri Jun 29 12:04:21 2018 @@ -19,9 +19,12 @@ package org.apache.tomcat.util.net; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.security.DomainLoadStoreParameter; import java.security.KeyStore; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Set; @@ -126,17 +129,22 @@ public abstract class SSLUtilBase implem } else { ks = KeyStore.getInstance(type, provider); } - if(!("PKCS11".equalsIgnoreCase(type) || - "".equalsIgnoreCase(path)) || - "NONE".equalsIgnoreCase(path)) { - istream = ConfigFileLoader.getInputStream(path); - } + if ("DKS".equalsIgnoreCase(type)) { + URI uri = ConfigFileLoader.getURI(path); + ks.load(new DomainLoadStoreParameter(uri, Collections.emptyMap())); + } else { + if(!("PKCS11".equalsIgnoreCase(type) || + "".equalsIgnoreCase(path)) || + "NONE".equalsIgnoreCase(path)) { + istream = ConfigFileLoader.getInputStream(path); + } - char[] storePass = null; - if (pass != null && !"".equals(pass)) { - storePass = pass.toCharArray(); + char[] storePass = null; + if (pass != null && !"".equals(pass)) { + storePass = pass.toCharArray(); + } + ks.load(istream, storePass); } - ks.load(istream, storePass); } catch (FileNotFoundException fnfe) { throw fnfe; } catch (IOException ioe) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org