Package org.keycloak.common.util
Class KeystoreUtil
- java.lang.Object
-
- org.keycloak.common.util.KeystoreUtil
-
public class KeystoreUtil extends Object
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KeystoreUtil.KeystoreFormat
-
Constructor Summary
Constructors Constructor Description KeystoreUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getKeystoreType(String preferredType, String path, String defaultType)
Try to return supported keystore typestatic KeyPair
loadKeyPairFromKeystore(String keystoreFile, String storePassword, String keyPassword, String keyAlias, KeystoreUtil.KeystoreFormat format)
static KeyStore
loadKeyStore(String filename, String password)
-
-
-
Method Detail
-
loadKeyStore
public static KeyStore loadKeyStore(String filename, String password) 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 elsepath
- 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 defineddefaultType
- Default format as last fallback when none of the above can be used. Should be non-null- Returns:
- format as specified above
-
-