Package org.wildfly.security.keystore
Class KeyStoreUtil
java.lang.Object
org.wildfly.security.keystore.KeyStoreUtil
Utility functions for manipulating KeyStores.
- Author:
- Martin Mazanek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyStoreloadKeyStore(Supplier<Provider[]> providers, String providerName, FileInputStream is, String filename, char[] password) Tries to parse a keystore based on known recognizable patterns.static KeyStoreloadPemAsKeyStore(InputStream is, char[] password)
-
Constructor Details
-
KeyStoreUtil
public KeyStoreUtil()
-
-
Method Details
-
loadKeyStore
public static KeyStore loadKeyStore(Supplier<Provider[]> providers, String providerName, FileInputStream is, String filename, char[] password) throws IOException, KeyStoreException Tries to parse a keystore based on known recognizable patterns.This method can parse JKS, JCEKS, PKCS12, BKS, BCFKS and UBER key stores as well as PEM files. At first the method looks for recognizable patterns of JKS, JCEKS, PKCS12 and BKS key store types and tries to parse them if found. If the pattern recognition fails, brute force is used to load the key store.
The provider supplier is used for loading the key stores.
- Parameters:
providers- provider supplier for loading the keystore (must not benull)providerName- if specified only providers with this name will be usedis- the key store file input stream (must not benull)filename- the filename for prioritizing brute force checks using the file extensionpassword- password of the key store. Should be the empty string for PEM files.- Returns:
- loaded key store if recognized
- Throws:
IOExceptionKeyStoreException
-
loadPemAsKeyStore
public static KeyStore loadPemAsKeyStore(InputStream is, char[] password) throws KeyStoreException, IOException - Throws:
KeyStoreExceptionIOException
-