Package net.jsign

Class PrivateKeyUtils


  • public class PrivateKeyUtils
    extends Object
    Helper class for loading private keys (PVK or PEM, encrypted or not).
    Since:
    2.0
    Author:
    Emmanuel Bourg
    • Method Detail

      • load

        public static PrivateKey load​(File file,
                                      String password)
                               throws KeyException
        Load the private key from the specified file. Supported formats are PVK and PEM, encrypted or not. The type of the file is inferred from its extension (.pvk for PVK files, .pem for PEM files).
        Parameters:
        file - the file to load the key from
        password - the password protecting the key
        Returns:
        the private key loaded
        Throws:
        KeyException - if the key cannot be loaded