public static KeyStoreFileType fromFilename(String filename) {
    int i = filename.lastIndexOf('.');
    if (i >= 0) {
      String extension = filename.substring(i);
      for (KeyStoreFileType storeFileType : KeyStoreFileType.values()) {
        if (storeFileType.getDefaultFileExtension().equals(extension)) {
          return storeFileType;
        }
      }
    }
    throw new IllegalArgumentException(
      "Unable to auto-detect store file type from file name: " + filename);
  }
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>. If the file name ends with ".p12", returns
<code>StoreFileType.PKCS12</code>. If the file name ends with ".bckfs", returns
<code>StoreFileType.BCKFS</code>. Otherwise, throws an IllegalArgumentException.
@param filename the filename of the key store or trust store file.
@return a KeyStoreFileType.
@throws IllegalArgumentException if the filename does not end with ".jks", ".pem", "p12" or
                                 "bcfks".
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/tls/KeyStoreFileType.java