Class KeyStoreMgt


  • public class KeyStoreMgt
    extends Object
    Class to manage SSL KeyStore
    Version:
    $Id: KeyStoreMgt.java,v 1.3 2006/07/30 00:57:42 jjanke Exp $
    Author:
    Jorg Janke
    • Field Detail

      • KEYSTORE_DIRECTORY

        public static String KEYSTORE_DIRECTORY
        Directory below IDEMPIERE_HOME
      • KEYSTORE_NAME

        public static String KEYSTORE_NAME
        Name of KeyStore
    • Constructor Detail

      • KeyStoreMgt

        public KeyStoreMgt​(String fileName,
                           char[] password)
        Constructor.
        Parameters:
        fileName - key store file name
        password - - same password for key store and certificate
    • Method Detail

      • verify

        public String verify​(JFrame parent,
                             String alias)
        Verify/Create Key Store
        Parameters:
        parent - frame
        Returns:
        null or error message
      • getCertificate

        public Certificate getCertificate​(String alias)
                                   throws Exception
        Get Certificate
        Parameters:
        alias - alias
        Returns:
        certificate or null
        Throws:
        Exception
      • setCommonName

        public void setCommonName​(String cn)
      • setOrganization

        public void setOrganization​(String o)
      • setOrganizationUnit

        public void setOrganizationUnit​(String o)
      • setLocation

        public void setLocation​(String l)
      • setState

        public void setState​(String s)
      • setCountry

        public void setCountry​(String c)
      • getDname

        public static String getDname​(KeyStoreMgt mgt,
                                      JFrame parent)
        Get Distinguised Name
        Parameters:
        parent - interactive dialog
        Returns:
        dname or null
      • escapeCommas

        public static String escapeCommas​(String in)
        Escape Commas
        Parameters:
        in - input string
        Returns:
        excaped string
      • selfcert

        public static void selfcert​(String alias,
                                    char[] password,
                                    String fileName,
                                    String dname)
        Generate Key and Cert
        Parameters:
        alias - keystore alias
        password - password
        fileName - key store file name (may have spaces)
        dname - distinguished name
      • getKeystoreFileName

        public static String getKeystoreFileName​(String baseDir)
        Get Keystore File Name
        Parameters:
        baseDir - IDEMPIERE_HOME
        Returns:
        file name
      • main

        public static void main​(String[] args)
        Test
        Parameters:
        args - ignored