Class KeyStoreUtil


  • public final class KeyStoreUtil
    extends BouncyCastleSupport
    Utility class for KeyStore operations.
    • Method Detail

      • getKeyStoreLayout

        public static List<KeyStoreEntryInfo> getKeyStoreLayout​(byte[] keystoreData,
                                                                String keyStoreType,
                                                                char[] password,
                                                                boolean analyzeCertificates)
                                                         throws FcCertificateManagementException
        Load a KeyStore and return the KeyStore layout.
        Parameters:
        keystoreData - The data to load the KeyStore from
        keyStoreType - The type of the KeyStore
        password - The password for the KeyStore
        analyzeCertificates - Whether to analyze the certificates for extended usage information
        Returns:
        A list of KeyStore entry information. This includes extended certificate usage information if requested.
        Throws:
        FcCertificateManagementException - If an error occurs while loading the KeyStore
      • getKeyStoreLayout

        public static List<KeyStoreEntryInfo> getKeyStoreLayout​(InputStream ksInputStream,
                                                                String keyStoreType,
                                                                char[] password,
                                                                boolean analyzeCertificates)
                                                         throws FcCertificateManagementException
        Load a KeyStore and return the KeyStore layout.
        Parameters:
        ksInputStream - The input stream to load the KeyStore from
        keyStoreType - The type of the KeyStore
        password - The password for the KeyStore
        analyzeCertificates - Whether to analyze the certificates for extended usage information
        Returns:
        A list of KeyStore entry information. This includes extended certificate usage information if requested.
        Throws:
        FcCertificateManagementException - If an error occurs while loading the KeyStore
      • readKeyStoreEntries

        public static List<KeyStoreEntry> readKeyStoreEntries​(byte[] keyStoreData,
                                                              String keyStoreType,
                                                              char[] keyStorePassword,
                                                              Map<String,​char[]> aliasesWithPasswords)
                                                       throws FcCertificateManagementException
        Read KeyStore entries.
        Parameters:
        aliasesWithPasswords - A map of aliases and their passwords
        keyStoreData - The KeyStore's byte[]
        keyStoreType - The type of the KeyStore
        keyStorePassword - The password for the KeyStore
        Returns:
        A list of KeyStore entries
        Throws:
        FcCertificateManagementException - If an error occurs while reading the KeyStore entries
      • readKeyStoreEntries

        public static List<KeyStoreEntry> readKeyStoreEntries​(InputStream ksInputStream,
                                                              String keyStoreType,
                                                              char[] keyStorePassword,
                                                              Map<String,​char[]> aliasesWithPasswords)
                                                       throws FcCertificateManagementException
        Read KeyStore entries.
        Parameters:
        aliasesWithPasswords - A map of aliases and their passwords
        ksInputStream - The input stream to read the KeyStore from
        keyStoreType - The type of the KeyStore
        keyStorePassword - The password for the KeyStore
        Returns:
        A list of KeyStore entries
        Throws:
        FcCertificateManagementException - If an error occurs while reading the KeyStore entries
        IllegalArgumentException - If an alias is not a valid KeyStore entry
      • readAllCertificates

        public static Set<X509Certificate> readAllCertificates​(InputStream ksInputStream,
                                                               String keyStoreType,
                                                               char[] keyStorePassword)
                                                        throws FcCertificateManagementException
        Read certificates from a KeyStore input stream.
        Parameters:
        ksInputStream - The input stream to read the KeyStore from
        keyStoreType - The type of the KeyStore
        keyStorePassword - The password for the KeyStore
        Returns:
        A set of X509 certificates
        Throws:
        FcCertificateManagementException - If an error occurs while reading the certificates