Class KeyStoreUtils


  • public final class KeyStoreUtils
    extends Object
    Author:
    Hakan Altindag
    • Method Detail

      • loadKeyStore

        public static KeyStore loadKeyStore​(String keystorePath,
                                            char[] keystorePassword)
      • 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)
      • 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)
      • 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 CertificateKeyStore createIdentityStore​(Key privateKey,
                                                                           char[] privateKeyPassword,
                                                                           T... certificateChain)
      • createKeyStore

        public static KeyStore createKeyStore()
      • createKeyStore

        public static KeyStore createKeyStore​(char[] keyStorePassword)
      • createKeyStore

        public static KeyStore createKeyStore​(String keyStoreType,
                                              char[] keyStorePassword)
      • loadJdkKeyStore

        public static KeyStore loadJdkKeyStore()
      • loadSystemKeyStores

        public static List<KeyStore> loadSystemKeyStores()
      • loadSystemPropertyDerivedKeyStore

        public static KeyStore loadSystemPropertyDerivedKeyStore()
      • loadSystemPropertyDerivedTrustStore

        public static KeyStore loadSystemPropertyDerivedTrustStore()
      • containsCertificate

        public static <T extends Certificate> boolean containsCertificate​(KeyStore keyStore,
                                                                          T certificate)
      • write

        public static void write​(Path destination,
                                 KeyStore keyStore,
                                 char[] password)
      • 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.
      • 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)