Github user ivmaykov commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/678#discussion_r229012448
--- Diff:
zookeeper-server/src/main/java/org/apache/zookeeper/common/X509Util.java ---
@@ -360,4 +476,26 @@ private void configureSSLServerSocket(SSLServerSocket
sslServerSocket) {
LOG.debug("Using Java8-optimized cipher suites for Java version
{}", javaVersion);
return DEFAULT_CIPHERS_JAVA8;
}
+
+ /**
+ * Detects the type of KeyStore / TrustStore file from the file
extension. If the file name ends with
+ * ".jks", returns <code>StoreFileType.JKS</code>. If the file name
ends with ".pem", returns
+ * <code>StoreFileType.PEM</code>. Otherwise, throws an IOException.
+ * @param filename the filename of the key store or trust store file.
+ * @return a StoreFileType.
+ * @throws IOException if the filename does not end with ".jks" or
".pem".
+ */
+ public static StoreFileType detectStoreFileTypeFromFileExtension(File
filename) throws IOException {
--- End diff --
How about I make it package-private and add a unit test?
---