Package org.compiere.install
Class KeyStoreMgt
- java.lang.Object
-
- org.compiere.install.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 Summary
Fields Modifier and Type Field Description static String
KEYSTORE_DIRECTORY
Directory below IDEMPIERE_HOMEstatic String
KEYSTORE_NAME
Name of KeyStore
-
Constructor Summary
Constructors Constructor Description KeyStoreMgt(String fileName, char[] password)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
escapeCommas(String in)
Escape CommasCertificate
getCertificate(String alias)
Get Certificatestatic String
getDname(KeyStoreMgt mgt, JFrame parent)
Get Distinguised NameKeyStore
getKeyStore()
Get KeyStorestatic String
getKeystoreFileName(String baseDir)
Get Keystore File Namestatic void
main(String[] args)
Teststatic void
selfcert(String alias, char[] password, String fileName, String dname)
Generate Key and Certvoid
setCommonName(String cn)
void
setCountry(String c)
void
setLocation(String l)
void
setOrganization(String o)
void
setOrganizationUnit(String o)
void
setState(String s)
String
verify(JFrame parent, String alias)
Verify/Create Key Store
-
-
-
Constructor Detail
-
KeyStoreMgt
public KeyStoreMgt(String fileName, char[] password)
Constructor.- Parameters:
fileName
- key store file namepassword
- - 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
-
getKeyStore
public KeyStore getKeyStore() throws Exception
Get KeyStore- Returns:
- KeyStore or null
- Throws:
Exception
-
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 aliaspassword
- passwordfileName
- 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
-
-