Package at.gv.egovernment.moaspss.util
Class KeyStoreUtils
java.lang.Object
at.gv.egovernment.moaspss.util.KeyStoreUtils
Utility for creating and loading key stores.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyStorecreateKeyStore(String keyStoreType, String[] certFilenames) Creates a key store from X509 certificate files, aliasing them with the index in theString[], starting with"0".static KeyStorecreateKeyStoreFromCertificateDirectory(String keyStoreType, String certDirURLString) Creates a key store from a directory containg X509 certificate files, aliasing them with the index in theString[], starting with"0".static KeyStoreloadKeyStore(InputStream is, String password) Loads a keyStore without knowing the keyStore typestatic KeyStoreloadKeyStore(String keystoreType, InputStream in, String password) Loads a key store from anInputStream, and closes theInputStream.static KeyStoreloadKeyStore(String keyStorePath, String password) Loads a keyStore without knowing the keyStore typestatic KeyStoreloadKeyStore(String keystoreType, String urlString, String password) Loads a key store from file.
-
Constructor Details
-
KeyStoreUtils
public KeyStoreUtils()
-
-
Method Details
-
loadKeyStore
public static KeyStore loadKeyStore(String keystoreType, String urlString, String password) throws IOException, GeneralSecurityException Loads a key store from file.- Parameters:
keystoreType- key store typeurlString- URL of key storepassword- password protecting the key store- Returns:
- key store loaded
- Throws:
IOException- thrown while reading the key store from fileGeneralSecurityException- thrown while creating the key store
-
loadKeyStore
public static KeyStore loadKeyStore(String keystoreType, InputStream in, String password) throws IOException, GeneralSecurityException Loads a key store from anInputStream, and closes theInputStream.- Parameters:
keystoreType- key store typein- input streampassword- password protecting the key store- Returns:
- key store loaded
- Throws:
IOException- thrown while reading the key store from the streamGeneralSecurityException- thrown while creating the key store
-
createKeyStore
public static KeyStore createKeyStore(String keyStoreType, String[] certFilenames) throws IOException, GeneralSecurityException Creates a key store from X509 certificate files, aliasing them with the index in theString[], starting with"0".- Parameters:
keyStoreType- key store typecertFilenames- certificate filenames- Returns:
- key store created
- Throws:
IOException- thrown while reading the certificates from fileGeneralSecurityException- thrown while creating the key store
-
createKeyStoreFromCertificateDirectory
public static KeyStore createKeyStoreFromCertificateDirectory(String keyStoreType, String certDirURLString) throws IOException, GeneralSecurityException Creates a key store from a directory containg X509 certificate files, aliasing them with the index in theString[], starting with"0". All the files in the directory are considered to be certificates.- Parameters:
keyStoreType- key store typecertDirURLString- file URL of directory containing certificate filenames- Returns:
- key store created
- Throws:
IOException- thrown while reading the certificates from fileGeneralSecurityException- thrown while creating the key store
-
loadKeyStore
public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, IOException Loads a keyStore without knowing the keyStore type- Parameters:
keyStorePath- URL to the keyStorepassword- Password protecting the keyStore- Returns:
- keyStore loaded
- Throws:
KeyStoreException- thrown if keyStore cannot be loadedFileNotFoundExceptionIOException
-
loadKeyStore
public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException Loads a keyStore without knowing the keyStore type- Parameters:
is- input streampassword- Password protecting the keyStore- Returns:
- keyStore loaded
- Throws:
KeyStoreException- thrown if keyStore cannot be loadedFileNotFoundExceptionIOException
-