Package net.jsign

Class KeyStoreUtils


  • public class KeyStoreUtils
    extends Object
    Helper class for loading KeyStores (JKS, JCEKS, PKCS#12 or PKCS#11).
    Since:
    2.0
    Author:
    Emmanuel Bourg
    • Method Detail

      • load

        public static KeyStore load​(File keystore,
                                    String storetype,
                                    String storepass,
                                    Provider provider)
                             throws KeyStoreException
        Load the keystore from the specified file.
        Parameters:
        keystore - the file containing the keystore
        storetype - the type of the keystore (either JKS, JCEKS, PKCS12 or PKCS11). If null the type is inferred from the extension of the file (.p12 or .pfx for PKCS#12 keystores)
        storepass - The password of the keystore
        provider - The security provider used to load the keystore (must be specified for PKCS#11 keystores)
        Returns:
        the keystore loaded
        Throws:
        KeyStoreException - thrown if the keystore cannot be loaded
      • load

        public static KeyStore load​(String keystore,
                                    String storetype,
                                    String storepass,
                                    Provider provider)
                             throws KeyStoreException
        Load the keystore from the specified path.
        Parameters:
        keystore - the path to the keystore
        storetype - the type of the keystore (either JKS, JCEKS, PKCS12 or PKCS11). If null the type is inferred from the extension of the file (.p12 or .pfx for PKCS#12 keystores)
        storepass - The password of the keystore
        provider - The security provider used to load the keystore (must be specified for PKCS#11 keystores)
        Returns:
        the keystore loaded
        Throws:
        KeyStoreException - thrown if the keystore cannot be loaded