Package nl.altindag.ssl.util
Class KeyStoreUtils
- java.lang.Object
-
- nl.altindag.ssl.util.KeyStoreUtils
-
public final class KeyStoreUtils extends Object
- Author:
- Hakan Altindag
-
-
Field Summary
Fields Modifier and Type Field Description static StringDUMMY_PASSWORD
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Certificate>
voidadd(Path keystorePath, char[] password, String keystoreType, List<T> certificates)Adds the provides list of certificates to the given keystore path on the filesystem if exists.static <T extends Certificate>
voidadd(KeyStore keyStore, List<T> certificates)static <T extends Certificate>
booleancontainsCertificate(KeyStore keyStore, T certificate)static booleancontainsIdentityMaterial(KeyStore keyStore)static booleancontainsTrustMaterial(KeyStore keyStore)static intcountAmountOfIdentityMaterial(KeyStore keyStore)static intcountAmountOfTrustMaterial(KeyStore keyStore)static KeyStorecreateIdentityStore(Key privateKey, char[] privateKeyPassword, String alias, List<? extends Certificate> certificateChain)static <T extends Certificate>
KeyStorecreateIdentityStore(Key privateKey, char[] privateKeyPassword, String alias, T... certificateChain)static KeyStorecreateIdentityStore(Key privateKey, char[] privateKeyPassword, List<? extends Certificate> certificateChain)static <T extends Certificate>
KeyStorecreateIdentityStore(Key privateKey, char[] privateKeyPassword, T... certificateChain)static KeyStorecreateKeyStore()static KeyStorecreateKeyStore(char[] keyStorePassword)static KeyStorecreateKeyStore(String keyStoreType, char[] keyStorePassword)static <T extends Certificate>
KeyStorecreateTrustStore(List<T> certificates)static <T extends X509TrustManager>
KeyStorecreateTrustStore(T... trustManagers)static List<String>getAliases(KeyStore keyStore)static Map<String,Certificate>getAliasToCertificate(KeyStore keyStore)static List<Certificate>getCertificates(KeyStore keyStore)static KeyStoreloadJdkKeyStore()static KeyStoreloadKeyStore(InputStream keystoreInputStream, char[] keystorePassword)static KeyStoreloadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType)static KeyStoreloadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType, String providerName)static KeyStoreloadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType, Provider provider)static KeyStoreloadKeyStore(String keystorePath, char[] keystorePassword)static KeyStoreloadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType)static KeyStoreloadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType, String providerName)static KeyStoreloadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType, Provider provider)static KeyStoreloadKeyStore(Path keystorePath, char[] keystorePassword)static KeyStoreloadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType)static KeyStoreloadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType, String providerName)static KeyStoreloadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType, Provider provider)static List<KeyStore>loadSystemKeyStores()static KeyStoreloadSystemPropertyDerivedKeyStore()static KeyStoreloadSystemPropertyDerivedTrustStore()static voidwrite(Path destination, KeyStore keyStore, char[] password)
-
-
-
Field Detail
-
DUMMY_PASSWORD
public static final String DUMMY_PASSWORD
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadKeyStore
public static KeyStore loadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType)
-
loadKeyStore
public static KeyStore loadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType, String providerName)
-
loadKeyStore
public static KeyStore loadKeyStore(String keystorePath, char[] keystorePassword, String keystoreType, Provider provider)
-
loadKeyStore
public static KeyStore loadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType)
-
loadKeyStore
public static KeyStore loadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType, String providerName)
-
loadKeyStore
public static KeyStore loadKeyStore(Path keystorePath, char[] keystorePassword, String keystoreType, Provider provider)
-
loadKeyStore
public static KeyStore loadKeyStore(InputStream keystoreInputStream, char[] keystorePassword)
-
loadKeyStore
public static KeyStore loadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType)
-
loadKeyStore
public static KeyStore loadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType, String providerName)
-
loadKeyStore
public static KeyStore loadKeyStore(InputStream keystoreInputStream, char[] keystorePassword, String keystoreType, Provider provider)
-
createIdentityStore
public static KeyStore createIdentityStore(Key privateKey, char[] privateKeyPassword, String alias, List<? extends Certificate> certificateChain)
-
createIdentityStore
public static KeyStore createIdentityStore(Key privateKey, char[] privateKeyPassword, List<? extends Certificate> certificateChain)
-
createIdentityStore
@SafeVarargs public static <T extends Certificate> KeyStore createIdentityStore(Key privateKey, char[] privateKeyPassword, T... certificateChain)
-
createIdentityStore
@SafeVarargs public static <T extends Certificate> KeyStore createIdentityStore(Key privateKey, char[] privateKeyPassword, String alias, T... certificateChain)
-
createKeyStore
public static KeyStore createKeyStore()
-
createKeyStore
public static KeyStore createKeyStore(char[] keyStorePassword)
-
createTrustStore
@SafeVarargs public static <T extends X509TrustManager> KeyStore createTrustStore(T... trustManagers)
-
createTrustStore
@SafeVarargs public static <T extends Certificate> KeyStore createTrustStore(T... certificates)
-
createTrustStore
public static <T extends Certificate> KeyStore createTrustStore(List<T> certificates)
-
loadJdkKeyStore
public static KeyStore loadJdkKeyStore()
-
loadSystemPropertyDerivedKeyStore
public static KeyStore loadSystemPropertyDerivedKeyStore()
-
loadSystemPropertyDerivedTrustStore
public static KeyStore loadSystemPropertyDerivedTrustStore()
-
getCertificates
public static List<Certificate> getCertificates(KeyStore keyStore)
-
getAliasToCertificate
public static Map<String,Certificate> getAliasToCertificate(KeyStore keyStore)
-
containsCertificate
public static <T extends Certificate> boolean containsCertificate(KeyStore keyStore, T certificate)
-
add
public static <T extends Certificate> void add(Path keystorePath, char[] password, String keystoreType, List<T> certificates)
Adds the provides list of certificates to the given keystore path on the filesystem if exists. If the keystore is absent it will create it with the given password and also add the certificates.
-
add
public static <T extends Certificate> void add(KeyStore keyStore, List<T> certificates)
-
countAmountOfTrustMaterial
public static int countAmountOfTrustMaterial(KeyStore keyStore)
-
countAmountOfIdentityMaterial
public static int countAmountOfIdentityMaterial(KeyStore keyStore)
-
containsTrustMaterial
public static boolean containsTrustMaterial(KeyStore keyStore)
-
containsIdentityMaterial
public static boolean containsIdentityMaterial(KeyStore keyStore)
-
-