Class KeystoreUtil

java.lang.Object
org.keycloak.common.util.KeystoreUtil

public class KeystoreUtil extends Object
Version:
$Revision: 1 $
Author:
Bill Burke
  • Constructor Details

    • KeystoreUtil

      public KeystoreUtil()
  • Method Details

    • loadKeyStore

      public static KeyStore loadKeyStore(String filename, String password) throws Exception
      Throws:
      Exception
    • loadKeyStore

      public static KeyStore loadKeyStore(String filename, String password, String preferedType) throws Exception
      Throws:
      Exception
    • loadKeyPairFromKeystore

      public static KeyPair loadKeyPairFromKeystore(String keystoreFile, String storePassword, String keyPassword, String keyAlias, KeystoreUtil.KeystoreFormat format)
    • getKeystoreType

      public static String getKeystoreType(String preferredType, String path, String defaultType)
      Try to return supported keystore type
      Parameters:
      preferredType - The preferred format - usually the one from the configuration. When present, it should be preferred over anything else
      path - Path of the file. We can try to detect keystore type from that (EG. my-keystore.pkcs12 will return "pkcs12") in case that preferredType is not defined
      defaultType - Default format as last fallback when none of the above can be used. Should be non-null
      Returns:
      format as specified above