diff options
Diffstat (limited to 'pki/base/console/src/com/netscape/admin/certsrv/security')
53 files changed, 0 insertions, 10100 deletions
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java b/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java deleted file mode 100644 index ec330fc0c..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipher.java +++ /dev/null @@ -1,82 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.nmclf.*; - -/** - * - * Representation of a cipher under cipher preference. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * @see com.netscape.admin.certsrv.security.AbstractCipher - * @see com.netscape.admin.certsrv.security.IAbstractCipherSet - * @see com.netscape.admin.certsrv.security.AbstractCipher - */ - -public final class AbstractCipher extends JCheckBox { - - /** - * - * Symbolic name, used for storage purpose - * for example we currently use ssl2-RC4EXPORT to represent: - * "RC4 with 40 bit encryption and MD5 message authentication" - */ - private String symbolicName = ""; - - /** - * Create an abstric cipher - * - * @param displayName cipher representation to be displayed - * @param symbolicName cipher name used for reference and storage - * - */ - public AbstractCipher(String displayName, String symbolicName) { - this(displayName, symbolicName, false); - } - - /** - * Create an abstric cipher - * - * @param displayName cipher representation to be displayed - * @param symbolicName cipher name used for reference and storage - * @param enabled enable cipher - * - */ - public AbstractCipher(String displayName, String symbolicName, - boolean enabled) { - super(displayName, enabled); - this.symbolicName = symbolicName; - } - - /** - * - * Get symbolic name - * - * @return string, symbolic name - * - */ - public String getSymbolicName() { - return symbolicName; - } - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java b/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java deleted file mode 100644 index c9e92561f..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/AbstractCipherPreference.java +++ /dev/null @@ -1,279 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.plaf.*; -import java.awt.event.*; -import java.awt.*; -import java.util.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * - * Abstract cipher preference panel. - * Use with AbstractCipher and IAbstractCipherSet to customize server - * specific cipher preference dialog/panel. - * - * @version 1.0 98/07/10 - * @author shihcm@netscape.com - * - * @see com.netscape.admin.certsrv.security.AbstractCipher - * @see com.netscape.admin.certsrv.security.IAbstractCipherSet - * @see com.netscape.admin.certsrv.security.AbstractCipher - */ -public class AbstractCipherPreference extends JPanel { - - /** - * Main listener for all the cipher component under AbstractCipherPreference panel. - * This listener will catch all the cipher event(on/off) occures with in this panel. - */ - CipherPrefActionListener listener = new CipherPrefActionListener(); - - /** - * Other listeners are stored in this vector, event catch in the "listener"(above) will - * also be routed to all the listener store in this vector - * Listener stored here are added by programmer via addActionListener(actionListener) call - */ - Vector listenerList = new Vector(); - - - /** - * This panel holds all the Ciper entry - */ - JPanel cipherPane = new JPanel(); - - /** - * To determain whether if any cipher[s] changed status since last save. - */ - boolean _ismodified = false; - - /** - * Store the old setting, for reset purpose. - */ - Hashtable oldValue = new Hashtable(); - - /** - * Create an abstract cipher preference - * - * - */ - public AbstractCipherPreference() {} - - /** - * Create an abstract cipher preference - * - * @param cipherList Interface to getCipherList() - * - * - */ - public AbstractCipherPreference(IAbstractCipherSet cipherList) { - super(); - initialize(cipherList); - } - - - class CipherPrefActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - _ismodified = true; - Enumeration l = listenerList.elements(); - while (l.hasMoreElements()) { - ((ActionListener)(l.nextElement())).actionPerformed(e); - } - } - } - - - /** - * Initializer for cipher preference. - * Cipher are obtain via getCipherList() from IAbstractCipherSet - * - * @param cipherList Interface to getCipherList() - * - * - */ - protected void initialize(IAbstractCipherSet cipherList) { - - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - cipherPane.setLayout(new BoxLayout(cipherPane, BoxLayout.Y_AXIS)); - add(cipherPane); - - Vector ciphers = cipherList.getCipherList(); - for (Enumeration e = ciphers.elements(); e.hasMoreElements();) { - addCipher((AbstractCipher)(e.nextElement())); - } - } - - /** - * - * Adds an ActionListener to all the ciphers - * - * @param l - * - */ - public void addActionListener(ActionListener l) { - if (!(listenerList.contains(l))) { - listenerList.addElement(l); - } - } - - - /** - * - * Adds cipher ui - * - * @param l - * - */ - public void addCipher(AbstractCipher cipher) { - oldValue.put(cipher.getSymbolicName(), - cipher.isSelected() ? "1":"0"); - cipherPane.add(cipher); - cipher.addActionListener(listener); - } - - - /** - * - * Call setEnable(enabled) on each cipher. - * This is different then set cipher selected state. - * if cipher selected state on all cipher is required try - * getCipherList() then setCipherEnabled(boolean) on each - * cipher. - * - * @param enabled enable/disable all ciphers - * - */ - public void setEnableAll(boolean enabled) { - Component[] c = cipherPane.getComponents(); - for (int i = c.length - 1; i >= 0; i--) { - c[i].setEnabled(enabled); - } - } - - - - /** - * - * Get entire cipher list - * - * - */ - public String[] getCipherList() { - Component[] c = cipherPane.getComponents(); - String[] ciphers = new String[c.length]; - for (int i = c.length - 1; i >= 0; i--) { - ciphers[i] = ((AbstractCipher) c[i]).getSymbolicName(); - } - return ciphers; - } - - private AbstractCipher findCipher(String symbolicName) { - Component[] c = cipherPane.getComponents(); - - AbstractCipher cipher = null; - - for (int i = c.length - 1; i >= 0; i--) { - if (((AbstractCipher) c[i]).getSymbolicName(). - equalsIgnoreCase(symbolicName)) { - cipher = (AbstractCipher) c[i]; - } - } - - return cipher; - } - - - /** - * - * Set cipher to selected state - * - * @param cipher Cipher to enable/disable - * @param enabled enable cipher if true - * - */ - public void setCipherEnabled(String cipher, boolean enabled) { - AbstractCipher c = findCipher(cipher); - if (c != null) { - c.setSelected(enabled); - } - } - - /** - * - * Check weather a cipher is enabled or disabled - * - * @param cipher Cipher to check - * - */ - public boolean isCipherEnabled(String cipher) { - AbstractCipher c = findCipher(cipher); - if (c != null) { - return c.isSelected(); - } - return false; - } - - /** - * Check weather any ciphers has been modified - * - * @see #isModified - * @see #setSaved - * - */ - public boolean isModified() { - return _ismodified; - } - - /** - * Reset all changes since last save - * - * @see #setSaved - */ - public void reset() { - Enumeration keys = oldValue.keys(); - while (keys.hasMoreElements()) { - String cipherName = (String)(keys.nextElement()); - setCipherEnabled(cipherName, - "1".equals(oldValue.get(cipherName)) ? true : false); - } - _ismodified = false; - } - - - /** - * Set the state to saved. - * - * @see #reset - */ - public void setSaved() { - oldValue.clear(); - - Component[] c = cipherPane.getComponents(); - for (int i = c.length - 1; i >= 0; i--) { - AbstractCipher cipher = (AbstractCipher)(c[i]); - oldValue.put(cipher.getSymbolicName(), - cipher.isSelected() ? "1":"0"); - } - - _ismodified = false; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java deleted file mode 100644 index 7982d310d..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLAddCertDialog.java +++ /dev/null @@ -1,226 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.console.ConsoleInfo; - - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CRLAddCertDialog extends AbstractDialog implements SuiConstants { - - ConsoleInfo _consoleInfo; - - KeyCertTaskInfo _taskInfo; - static boolean modified = false; - - String _sie; - String _filename; - String _listtype; - - JButton bClose; - JButton bAction; - JButton bHelp; - - CertInfo _certInfo; - ResourceSet _resource; - - - CRLCertInfoPane _crlCertInfoPane; - - - class CRLAddCertActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - modified = false; - if (e.getActionCommand().equals("ACTION")) { - //call delete cert cgi - _taskInfo.clear(); - _taskInfo.put("crl_file", _filename); - _taskInfo.put("sie", _sie); - _taskInfo.put( - (_certInstInfo.get("crl_action").equals("add")) - ? "addbutton":"repbutton", "1"); - _taskInfo.put("list_type", _listtype); - - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_ICRL); - } catch (Exception error) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - error.getMessage()); - return; - } - - if (!(((Message)(response.getMessages().elementAt(0))). - isFailure())) { - if (_certInstInfo.get("crl_action").equals("add") || - _certInstInfo.get("crl_action").equals("replace")) { - modified = true; - } - setVisible(false); - } else { - try { - MessageDialog.messageDialog( (Message) - (response.getMessages().elementAt(0))); - } catch (Exception e2) { - //shouldn't even be here in the first place. if cgi fail or return nothing - //then it should be handle right after KeyCertTaskInfo.exec(...) is called - //If exception occure here here then something is really mess up. - Debug.println("Error in decoding server messages"); - } - } - } else if (e.getActionCommand().equals("CLOSE")) { - setVisible(false); - } else if (e.getActionCommand().equals("HELP")) { - Help help = new Help(_resource); - help.help("CRLDeleteCertDialog", "help"); - } - - } - } - - - public boolean isModified() { - return modified; - } - - public CertInfo getCertInfo() { - return _certInfo; - } - - Hashtable _certInstInfo = new Hashtable(); - public void show(String filename, String list_type) { - _filename = filename; - _listtype = list_type; - - _taskInfo.clear(); - _taskInfo.put("crl_file", filename); - _taskInfo.put("sie", _sie); - _taskInfo.put("list_type", list_type); - - try { - _taskInfo.exec(_taskInfo.SEC_ICRL); - } catch (Exception error) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - error.getMessage()); - return; - } - - if (_taskInfo.getResponse().hasCertInstInfo()) { - _certInstInfo = _taskInfo.getResponse().getCertInstInfo(); - } else { - _certInstInfo.put("crl_action", "add"); - _certInstInfo.put("crl_file", filename); - } - if (_taskInfo.getResponse().hasCertInfo()) { - setInfo(_taskInfo.getResponse().getCertInfo()); - super.show(); - } else { - try { - MessageDialog.messageDialog( (Message) - (_taskInfo.getResponse().getMessages(). - elementAt(0))); - } catch (Exception e2) { - //shouldn't even be here in the first place. if cgi fail or return nothing - //then it should be handle right after KeyCertTaskInfo.exec(...) is called - //If exception occure here here then something is really mess up. - Debug.println("Error in decoding server messages"); - } - } - } - - private void setInfo(CertInfo certInfo) { - _certInfo = certInfo; - _crlCertInfoPane.setCertInfo(certInfo); - - try { - if (((String)(_certInstInfo.get("crl_action"))).equals("add")) { - bAction.setText( - _resource.getString("CRLAddCertDialog", "add")); - } else { - bAction.setText( - _resource.getString("CRLAddCertDialog", "replace")); - } - JButtonFactory.resizeGroup(bHelp, bClose, bAction); - } catch (Exception e) { - } - } - - public CRLAddCertDialog(ConsoleInfo consoleInfo, ResourceSet resource) { - super(null, "", true, NO_BUTTONS); - - _consoleInfo = consoleInfo; - _sie = KeyCertUtility.createTokenName(_consoleInfo); - _resource = resource; - _taskInfo = new KeyCertTaskInfo(consoleInfo); - - _crlCertInfoPane = new CRLCertInfoPane(resource); - - Container mainPane = getContentPane(); - mainPane.setLayout(new GridBagLayout()); - - GridBagUtil.constrain(mainPane, _crlCertInfoPane, 0, 0, 4, 1, - 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.DIFFERENT_COMPONENT_SPACE, 0); - - CRLAddCertActionListener listener = new CRLAddCertActionListener(); - - bClose = JButtonFactory.createCloseButton(listener); - GridBagUtil.constrain(mainPane, bClose, 1, 1, 1, 1, 1.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, SuiConstants.COMPONENT_SPACE); - - - bAction = JButtonFactory.create(""); - bAction.addActionListener(listener); - bAction.setActionCommand("ACTION"); - GridBagUtil.constrain(mainPane, bAction, 2, 1, 1, 1, 0.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, SuiConstants.SEPARATED_COMPONENT_SPACE); - - - bHelp = JButtonFactory.createHelpButton(listener); - GridBagUtil.constrain(mainPane, bHelp, 3, 1, 1, 1, 0.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, 0); - - setMinimumSize(400, 225); - setResizable(false); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.setSize(400,400); - f.show(); - - CRLAddCertDialog d = new CRLAddCertDialog(new ConsoleInfo(), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"), "buddha.txt"); - d.show(); - }*/ -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java deleted file mode 100644 index 8e1b99b22..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLCertInfoPane.java +++ /dev/null @@ -1,112 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.console.ConsoleInfo; - - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CRLCertInfoPane extends JPanel implements SuiConstants { - - - JLabel _certName; - MultilineLabel _issuer; - //MultilineLabel _subject; - MultilineLabel _valid; - ResourceSet _resource; - - public void setCertInfo(CertInfo certInfo) { - _certName.setText(certInfo.getCertName()); - _issuer.setText(certInfo.getIssuer()); - //_subject.setText(certInfo.getSubject()); - _valid.setText( KeyCertUtility.replace( KeyCertUtility.replace( - _resource.getString("CRLDetailInfoDialog", - "validFromTo"), "%FROM", certInfo.getValidFrom()), "%TO", - certInfo.getValidTo())); - - } - - public CRLCertInfoPane(ResourceSet resource) { - setLayout(new GridBagLayout()); - - _resource = resource; - - _certName = new JLabel(); - _issuer = new MultilineLabel(); - //_subject = new MultilineLabel(); - _valid = new MultilineLabel(); - - - setBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE))); - - - - GridBagUtil.constrain(this, - new JLabel( - _resource.getString("CRLInfoDialog", "issuer")), 0, 0, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0); - - JScrollPane issuerScrollPane = new JScrollPane(_issuer, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - issuerScrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - GridBagUtil.constrain(this, issuerScrollPane, 0, 1, 1, 1, 1.0, - 1.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, _valid, 0, 2, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, 0, 0); - - GridBagUtil.constrain(this, Box.createGlue(), 0, 3, 1, 1, 1.0, - 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - public CRLCertInfoPane(CertInfo certInfo, ResourceSet resource) { - this(resource); - - setCertInfo(certInfo); - } - - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.setSize(400,400); - f.getContentPane().add(new CRLCertInfoPane(new CertInfo("Buddha", "Netscape", "Netscape", null, null, "Jan 1, 1998", "Jan 1, 2000", null, null, null, null), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"))); - f.show(); - - }*/ -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java deleted file mode 100644 index 6b1132ced..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLDeleteCertDialog.java +++ /dev/null @@ -1,201 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.console.ConsoleInfo; - - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CRLDeleteCertDialog extends AbstractDialog implements SuiConstants { - - - - ConsoleInfo _consoleInfo; - - KeyCertTaskInfo _taskInfo; - static boolean delete = false; - - String _sie; - - JButton bClose; - JButton bDelete; - JButton bHelp; - - CertInfo _certInfo; - ResourceSet _resource; - String _crlname; - String _listtype; - - CRLCertInfoPane _crlCertInfoPane; - - - class CRLDeleteCertActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("DELETE")) { - //call delete cert cgi - _taskInfo.clear(); - _taskInfo.put("formop", "D"); - _taskInfo.put("crlname", _crlname); - _taskInfo.put("sie", _sie); - _taskInfo.put("list_type", _listtype); - - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_ECRL); - } catch (Exception error) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - error.getMessage()); - return; - } - if (!(((Message)(response.getMessages().elementAt(0))). - isFailure())) { - delete = true; - setVisible(false); - } else { - try { - MessageDialog.messageDialog( (Message) - (response.getMessages().elementAt(0))); - } catch (Exception e2) { - //shouldn't even be here in the first place. if cgi fail or return nothing - //then it should be handle right after KeyCertTaskInfo.exec(...) is called - //If exception occure here here then something is really mess up. - Debug.println("Error in decoding server messages"); - } - } - } else if (e.getActionCommand().equals("CLOSE")) { - setVisible(false); - } else if (e.getActionCommand().equals("HELP")) { - Help help = new Help(_resource); - help.help("CRLDeleteCertDialog", "help"); - } - } - } - - public boolean isDeleted() { - return delete; - } - - protected void show(String crlname, String list_type) { - delete = false; - _crlname = crlname; - _listtype = list_type; - - _taskInfo.clear(); - _taskInfo.put("sie", _sie); - _taskInfo.put("crlname", crlname); - _taskInfo.put("list_type", list_type); - try { - _taskInfo.exec(_taskInfo.SEC_ECRL); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - return; - } - - if (_taskInfo.getResponse().hasCertInfo()) { - setInfo(_taskInfo.getResponse().getCertInfo()); - super.show(); - } else { - Object[] message = new Object[2]; - message[0] = _resource.getString("CRLDeleteCertDialog", "error"); - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), message); - } - } - - private void setInfo(CertInfo certInfo) { - _certInfo = certInfo; - - _crlCertInfoPane.setCertInfo(certInfo); - } - - - public CRLDeleteCertDialog(ConsoleInfo consoleInfo, - ResourceSet resource) { - super(null, "", true, NO_BUTTONS); - - _consoleInfo = consoleInfo; - _sie = KeyCertUtility.createTokenName(_consoleInfo); - _resource = resource; - _taskInfo = new KeyCertTaskInfo(consoleInfo); - - _crlCertInfoPane = new CRLCertInfoPane(resource); - - Container mainPane = getContentPane(); - mainPane.setLayout(new GridBagLayout()); - - GridBagUtil.constrain(mainPane, _crlCertInfoPane, 0, 0, 4, 1, - 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.DIFFERENT_COMPONENT_SPACE, 0); - - - CRLDeleteCertActionListener listener = - new CRLDeleteCertActionListener(); - - bClose = JButtonFactory.createCloseButton(listener); - GridBagUtil.constrain(mainPane, bClose, 1, 1, 1, 1, 1.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, SuiConstants.COMPONENT_SPACE); - - - bDelete = JButtonFactory.createDeleteButton(listener); - GridBagUtil.constrain(mainPane, bDelete, 2, 1, 1, 1, 0.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, SuiConstants.SEPARATED_COMPONENT_SPACE); - - - bHelp = JButtonFactory.createHelpButton(listener); - GridBagUtil.constrain(mainPane, bHelp, 3, 1, 1, 1, 0.0, 0.0, - GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, - 0, 0, 0, 0); - - - - JButtonFactory.resizeGroup(bHelp, bClose, bDelete); - - setSize(400, 225); - setResizable(false); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.setSize(400,400); - f.show(); - - try { - UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); - SwingUtilities.updateComponentTreeUI(f.getContentPane()); - } catch (Exception e) {} - - - CRLDeleteCertDialog d = new CRLDeleteCertDialog(new ConsoleInfo(), new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource")); - d.show(); - }*/ -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java deleted file mode 100644 index f284fbb9c..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLManagementDialog.java +++ /dev/null @@ -1,309 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.table.*; -import javax.swing.event.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import netscape.ldap.*; - -import com.netscape.management.nmclf.*; - -/** - * - * Certificate Revocation List management dialog. - * This is a self contain dialog, that allow use to - * add/remove certificate fron a certificate revocation - * list. This is only the front end, the actuall work - * of removing and adding certificate will be handled - * by the server - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class CRLManagementDialog extends AbstractDialog { - - JButton bClose; - JButton bView; - JButton bAdd; - JButton bHelp; - - ConsoleInfo _consoleInfo; - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - - AddCRLCertificateDialog addCRLCertificateDialog; - - CRLTable _crlTable; - - - private void parseCRLInfo(String response) { - } - - //since can't over load protected and I don't - //want the interface to show so... - private void privateHelpInvoked() { - Help help = new Help(resource); - help.help("CRLManagementDialog", "help"); - } - - - //since can't over load protected and I don't - //want the interface to show so... - private void privateCloseInvoked() { - super.okInvoked(); - } - - class CertManagementActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("CLOSE")) { - privateCloseInvoked(); - } else if (e.getActionCommand().equals("HELP")) { - privateHelpInvoked(); - } else if (e.getActionCommand().equals("VIEW")) { - _crlTable.showCert(); - } else if (e.getActionCommand().equals("ADD")) { - addCRLCertificateDialog.show(); - } - } - } - - - private JPanel getCertListPane() { - JPanel certListPane = new JPanel(); - certListPane.setLayout(new GridBagLayout()); - certListPane.setBorder( new TitledBorder( - new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CRLManagementDialog", "certificate"))); - - - GridBagUtil.constrain(certListPane, - new JLabel( - resource.getString("CRLManagementDialog", "certDB")), - 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(certListPane, - new JLabel( - resource.getString("CRLManagementDialog", "defaultToken"), - JLabel.RIGHT), 1, 0, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - _crlTable = new CRLTable(_consoleInfo, resource); - GridBagUtil.constrain(certListPane, _crlTable, 0, 1, 2, 1, 1.0, - 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - - return certListPane; - } - - class AddCRLCertificateDialog extends AbstractDialog { - KeyCertTaskInfo _taskInfo; - JTextField _filename; - JRadioButton _ckl; - JRadioButton _crl; - - public AddCRLCertificateDialog(ConsoleInfo consoleInfo) { - super(null, - CRLManagementDialog.this.resource.getString("AddCRLCertificateDialog", - "dialogTitle"), true, OK | CANCEL | HELP); - _taskInfo = new KeyCertTaskInfo(consoleInfo); - - Container p = getContentPane(); - p.setLayout(new GridBagLayout()); - - _crl = new JRadioButton( - resource.getString("AddCRLCertificateDialog", - "crlfiletype"), true); - _ckl = new JRadioButton( - resource.getString("AddCRLCertificateDialog", - "cklfiletype"), false); - - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(_crl); - buttonGroup.add(_ckl); - - GridBagUtil.constrain(p, - new JLabel( - resource.getString("AddCRLCertificateDialog", - "filename")), 0, 0, 2, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - 0, 0, SuiConstants.COMPONENT_SPACE, 0); - - _filename = new JTextField(30); - GridBagUtil.constrain(p, _filename, 0, 1, 2, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - 0, 0, 0, 0); - - GridBagUtil.constrain(p, (Component)_crl, 0, 2, 2, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(p, (Component)_ckl, 0, 3, 2, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - pack(); - setResizable(false); - } - - - CRLAddCertDialog _crlAddCertDialog = - new CRLAddCertDialog(_consoleInfo, resource); - protected void okInvoked() { - _crlAddCertDialog.show(_filename.getText(), - _ckl.isSelected() ? "CKL" : "CRL"); - setVisible(false); - if (_crlAddCertDialog.isModified()) { - CertInfo certInfo = _crlAddCertDialog.getCertInfo(); - //only need the first line where the issuer's name locate - String issuer = certInfo.getIssuer(); - _crlTable.addCert( - issuer.substring(0, issuer.indexOf("\n")), - certInfo.getValidTo(), - _ckl.isSelected() ? "CKL" : "CRL"); - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - _crlTable.update(); - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - } - } - - protected void helpInvoked() { - Help help = new Help(resource); - help.help("AddCRLCertificateDialog", "help"); - } - } - - - private JPanel getControlButtons() { - JPanel controlPanel = new JPanel(); - controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - controlPanel.setBorder( - new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0)); - - CertManagementActionListener listener = - new CertManagementActionListener(); - - bClose = JButtonFactory.createCloseButton(listener); - controlPanel.add(bClose); - - controlPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.COMPONENT_SPACE, 0))); - - bView = JButtonFactory.create( - resource.getString("CRLManagementDialog", "view")); - bView.addActionListener(listener); - bView.setActionCommand("VIEW"); - controlPanel.add(bView); - - controlPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.COMPONENT_SPACE, 0))); - - bAdd = JButtonFactory.create( - resource.getString("CRLManagementDialog", "add")); - bAdd.addActionListener(listener); - bAdd.setActionCommand("ADD"); - controlPanel.add(bAdd); - - controlPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0))); - - bHelp = JButtonFactory.createHelpButton(listener); - controlPanel.add(bHelp); - - JButtonFactory.resizeGroup(bHelp, bClose, bView, bAdd); - - return controlPanel; - } - - /** - * Create a Certificate Revocation List Management dialog - * - * @param consoleInfo Console information - * - */ - public CRLManagementDialog(ConsoleInfo consoleInfo) { - super(null, "", true, NO_BUTTONS); - - _consoleInfo = consoleInfo; - addCRLCertificateDialog = new AddCRLCertificateDialog(_consoleInfo); - - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - //_consoleInfo = consoleInfo; - - setTitle(resource.getString("CRLManagementDialog", "title")); - - JPanel mainPane = new JPanel(); - mainPane.setLayout(new BorderLayout()); - - - mainPane.add("Center", getCertListPane()); - - mainPane.add("South", getControlButtons()); - - getContentPane().add(mainPane); - - //pack(); - setMinimumSize(400, 400); - //setResizable(false); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - - if (!(_crlTable.isTableSetup())) { - return; - } - - validate(); - invalidate(); - show(); - } - - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.setSize(200,200); - f.show(); - UtilConsoleGlobals.setActivatedFrame(f); - try { - UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); - SwingUtilities.updateComponentTreeUI(f.getContentPane()); - } catch (Exception e) {} - - CRLManagementDialog d = new CRLManagementDialog(new ConsoleInfo()); - }*/ -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java deleted file mode 100644 index b56a3c585..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTable.java +++ /dev/null @@ -1,235 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -import javax.swing.*; -import javax.swing.table.*; - -import java.awt.event.*; -import java.util.*; -import java.io.*; -import java.awt.*; - - -class CRLTable extends JPanel implements MouseListener { - - ResourceSet _resource; - KeyCertTaskInfo _taskInfo; - String _sie; - ConsoleInfo _consoleInfo; - - CRLDeleteCertDialog _crlDeleteCertDialog = null; - - String startCRL = "-----BEGIN CRL LIST-----"; - String endCRL = "-----END CRL LIST-----"; - String startCKL = "-----BEGIN CKL LIST-----"; - String endCKL = "-----END CKL LIST-----"; - - String certName; - boolean setupComplete; - - private Vector getRowData(String data) { - Vector rowData = new Vector(); - BufferedReader stream = new BufferedReader(new StringReader(data)); - - // First, read CRL's - try { - while (!(stream.readLine().equals(startCRL))) { - } - - String line; - while (!((line = stream.readLine()).equals(endCRL))) { - StringTokenizer token = - new StringTokenizer(line, ";", false); - Vector row = new Vector(); - //get cert name and expire date and setup a row - row.addElement(token.nextToken()); - row.addElement(token.nextToken()); - row.addElement((String)"CRL"); - rowData.addElement(row); - } - } catch (IOException e) { /*error message here */ - } - - // Next, read CKL's - try { - while (!(stream.readLine().equals(startCKL))) { - } - - String line; - while (!((line = stream.readLine()).equals(endCKL))) { - StringTokenizer token = - new StringTokenizer(line, ";", false); - Vector row = new Vector(); - //get cert name and expire date and setup a row - row.addElement(token.nextToken()); - row.addElement(token.nextToken()); - row.addElement((String)"CKL"); - rowData.addElement(row); - } - } catch (IOException e) { /*error message here */ - } - - return rowData; - } - - private Vector getColumnHeader() { - Vector column = new Vector(); - column.addElement(_resource.getString("CRLTable", "column1")); - column.addElement(_resource.getString("CRLTable", "column2")); - column.addElement(_resource.getString("CRLTable", "column3")); - return column; - } - - public void showCert() { - if (_crlTable.getSelectedRow() != -1) { - _crlDeleteCertDialog.show( (String) - (_crlTable.getValueAt(_crlTable.getSelectedRow(), - 0)), (String) - (_crlTable.getValueAt(_crlTable.getSelectedRow(), 2))); - if (_crlDeleteCertDialog.isDeleted()) { - _crlTableModel.deleteRow(_crlTable.getSelectedRow()); - repaint(); - } - } - - } - - JTable _crlTable; - public void mouseClicked(MouseEvent e) { - int row = _crlTable.rowAtPoint(e.getPoint()); - - if (e.getClickCount() < 2) - return; - if (row == -1) { - _crlTable.clearSelection(); - } else { - showCert(); - } - } - public void mouseEntered(MouseEvent e) { } - public void mouseExited(MouseEvent e) { } - public void mousePressed(MouseEvent e) { } - public void mouseReleased(MouseEvent e) { } - - - public void update() { - _taskInfo = new KeyCertTaskInfo(_consoleInfo); - _sie = KeyCertUtility.createTokenName(_consoleInfo); - _crlDeleteCertDialog = - new CRLDeleteCertDialog(_consoleInfo, _resource); - - _taskInfo.put("sie", _sie); - try { - _taskInfo.exec(_taskInfo.SEC_MGCRL); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - setupComplete = false; - return; - } - - if (_crlTableModel == null) { - _crlTableModel = new CRLTableModel( getRowData( - _taskInfo.getResponse().getServerResponse()), - getColumnHeader()); - } else { - _crlTableModel.update( getRowData( - _taskInfo.getResponse().getServerResponse()), - getColumnHeader()); - } - - } - - public CRLTable(ConsoleInfo consoleInfo, ResourceSet resource) { - setLayout(new BorderLayout()); - - setupComplete = true; - - _resource = resource; - _consoleInfo = consoleInfo; - - update(); - - _crlTable = new SuiTable(); - //_crlTableModel = new CRLTableModel(getRowData(_taskInfo.getResponse().getServerResponse()), getColumnHeader()); - _crlTable.setModel(_crlTableModel); - _crlTable.setAutoResizeMode(_crlTable.AUTO_RESIZE_ALL_COLUMNS); - _crlTable.addMouseListener(this); - //_crlTable.setMultipleSelectionAllowed(false); - _crlTable.getSelectionModel().setSelectionMode( - DefaultListSelectionModel.SINGLE_SELECTION); - //_crlTable.setSelectionModel(new DefaultSingleSelectionModel()); - - - // Put the table and header into a scrollPane - JScrollPane scrollPane = new JScrollPane( - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - JTableHeader tableHeader = _crlTable.getTableHeader(); - - // create and add the column heading to the scrollpane's - // column header viewport - JViewport headerViewport = new JViewport(); - headerViewport.setLayout(new BorderLayout()/*new BoxLayout(headerViewport, BoxLayout.X_AXIS)*/); - headerViewport.add(tableHeader); - scrollPane.setColumnHeader(headerViewport); - - // add the table to the viewport - JViewport mainViewPort = scrollPane.getViewport(); - mainViewPort.add(_crlTable); - - // speed up resizing repaints by turning off live cell updates - tableHeader.setUpdateTableInRealTime(false); - - add(scrollPane); - - } - - CRLTableModel _crlTableModel; - - public void repaint() { - _crlTable.validate(); - _crlTable.repaint(); - super.repaint(); - } - - public void addCert(String issuer, String expires, String type) { - _crlTableModel.addRow(issuer, expires, type); - repaint(); - } - - public boolean isTableSetup() { - return setupComplete; - - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - //f.setSize(400,400); - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - f.getContentPane().add(new CRLTable(new ConsoleInfo(), resource)); - f.pack(); - f.show(); - }*/ -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java deleted file mode 100644 index 4fe7ded08..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CRLTableModel.java +++ /dev/null @@ -1,94 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.*; -import java.awt.event.*; - -import javax.swing.*; -import javax.swing.table.*; -import javax.swing.event.*; - - -class CRLTableModel extends AbstractTableModel { - - Vector _header; - Vector _rowData = new Vector(); - Vector _tableModelListener = new Vector(); - - public CRLTableModel(Vector CRL, Vector columnIdentifier) { - update(CRL, columnIdentifier); - } - - public void update(Vector CRL, Vector columnIdentifier) { - _header = columnIdentifier; - _rowData = CRL; - } - - public void addRow(String issuer, String expires, String type) { - Vector row = new Vector(); - row.addElement(issuer); - row.addElement(expires); - row.addElement(type); - _rowData.addElement(row); - } - - public int getRowCount() { - return _rowData.size(); - } - - public int getColumnCount() { - return _header.size(); - } - - public String getColumnName(int columnIndex) { - return (columnIndex >= _header.size() ? "": - (String)(_header.elementAt(columnIndex))); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - Object o = null; - - try { - o = ((Vector)(_rowData.elementAt(rowIndex))).elementAt( - columnIndex); - } catch (Exception e) {} - - return o; - } - - - public void deleteRow(int rowIndex) { - try { - _rowData.removeElementAt(rowIndex); - } catch (Exception e) {} - } - - public void deleteAllRows() { - _rowData.removeAllElements(); - } - - public void addTableModelListener(TableModelListener l) { - _tableModelListener.addElement(l); - } - - public void removeTableModelListener(TableModelListener l) { - _tableModelListener.removeElement(l); - } -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java deleted file mode 100644 index 0d746324d..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertBasicInfo.java +++ /dev/null @@ -1,83 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.*; - -import com.netscape.management.client.util.ResourceSet; - -class CertBasicInfo { - String _certName; - String _certType; - String _certExpiration; - - String _certNameLabel; - String _certTypeLabel; - String _certExpirationLabel; - - public CertBasicInfo(String certName, String certType, - String certExpiration) { - _certName = certName; - _certType = certType; - _certExpiration = certExpiration; - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - _certNameLabel = resource.getString("CertBasicInfo", "labelName"); - _certTypeLabel = resource.getString("CertBasicInfo", "lableType"); - _certExpirationLabel = resource.getString("CertBasicInfo", "labelExpire"); - } - - public String getCertName() { - return _certName; - } - - public String getCertType() { - return _certType; - } - - public String getCertExpiration() { - return _certExpiration; - } - - - public String getCertInfo(String headerIndex) { - String nReturn = ""; - - if (headerIndex.equals(_certNameLabel)) { - nReturn = getCertName(); - } else if (headerIndex.equals(_certTypeLabel)) { - nReturn = getCertType(); - } else if (headerIndex.equals(_certExpirationLabel)) { - nReturn = getCertExpiration(); - } - - return nReturn; - } - - static public Vector getCertTitleLabels() { - Vector title = new Vector(); - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - title.addElement(resource.getString("CertBasicInfo", "labelName")); - title.addElement(resource.getString("CertBasicInfo", "lableType")); - title.addElement(resource.getString("CertBasicInfo", "labelExpire")); - - return title; - } -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java deleted file mode 100644 index 3c1e39821..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertDetailInfoDialog.java +++ /dev/null @@ -1,111 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.console.ConsoleInfo; - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CertDetailInfoDialog extends AbstractDialog implements SuiConstants { - - - JLabel serialNumber = new JLabel(); - JLabel valid = new JLabel(); - JLabel fingerprint = new JLabel(); - JLabel trust = new JLabel(); - JPanel mainPane = new JPanel(); - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - - void setCertInfo(CertInfo certInfo) { - - serialNumber.setText(certInfo.getSerialNumber()); - valid.setText( KeyCertUtility.replace( KeyCertUtility.replace( - resource.getString("CertDetailInfoDialog", - "validFromTo"), "%FROM", certInfo.getValidFrom()), "%TO", - certInfo.getValidTo())); - fingerprint.setText(certInfo.getFingerPrint()); - trust.setText(certInfo.trusted() ? - resource.getString("CertDetailInfoDialog", "trustString") : - resource.getString("CertDetailInfoDialog", "notTrustString")); - - mainPane.doLayout(); - mainPane.repaint(); - - pack(); - } - - public CertDetailInfoDialog(JFrame parent, CertInfo certInfo) { - super(parent, "", true, CLOSE); - - setTitle(resource.getString("CertDetailInfoDialog", "title")); - - mainPane.setLayout(new GridBagLayout()); - mainPane.setBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE))); - - int y = 0; - GridBagUtil.constrain(mainPane, - new JLabel( resource.getString("CertDetailInfoDialog", - "serialNumberLabel")), 0, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, serialNumber, 0, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, valid, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, - new JLabel( resource.getString("CertDetailInfoDialog", - "fingerprintLabel")), 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, fingerprint, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, trust, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - getContentPane().add(mainPane); - - setCertInfo(certInfo); - - pack(); - setMinimumSize(getSize()); - setResizable(false); - } -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java deleted file mode 100644 index 40cd071d4..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfo.java +++ /dev/null @@ -1,87 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - - -class CertInfo { - - String _certName; - String _issuer; - String _subject; - String _serialNumber; - String _version; - String _validFrom; - String _validTo; - String _fingerPrint; - boolean _trustCert; - boolean _certDeleted; - String _certTitle; - - - public CertInfo(String certName, String issuer, String subject, - String serialNumber, String version, String validFrom, - String validTo, String fingerPrint, String trustCert, - String certDeleted, String certTitle) { - _certName = certName; - _issuer = issuer; - _subject = subject; - _serialNumber = serialNumber; - _version = version; - _validFrom = validFrom; - _validTo = validTo; - _fingerPrint = fingerPrint; - _trustCert = (trustCert != null) ? trustCert.equals("1") : false; - _certDeleted = - (certDeleted != null) ? certDeleted.equals("1") : false; - _certTitle = certTitle; - } - - public String getCertName() { - return _certName; - } - public String getIssuer() { - return _issuer; - } - public String getSubject() { - return _subject; - } - public String getSerialNumber() { - return _serialNumber; - } - public String getVersion() { - return _version; - } - public String getValidFrom() { - return _validFrom; - } - public String getValidTo() { - return _validTo; - } - public String getFingerPrint() { - return _fingerPrint; - } - public boolean trusted() { - return _trustCert; - } - public boolean getCertDeleted() { - return _certDeleted; - } - public String getCertTitle() { - return _certTitle; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java deleted file mode 100644 index 910d38a9c..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInfoDialog.java +++ /dev/null @@ -1,528 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.console.ConsoleInfo; - - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * - * UI to display subject and issuer of the certificate, and - * allow user to change trust, delete, or view detail information - * of this certificate - * - * @version 1.0 98/07/10 - * @author shihcm@netscape.com - * @see com.netscape.admin.certsrv.security.CertDetailInfoDialog - * @see com.netscape.admin.certsrv.security.CertInfo - * - */ -class CertInfoDialog extends AbstractDialog implements SuiConstants { - - - /** - * String for trust and none trusted status of the certificate - * String is localized and will be retrived from the properties file - */ - String trustString, notTrustString; - - /** - * Task info, the communication channel that calls the server to execute the cgi - */ - KeyCertTaskInfo _taskInfo; - - - /** - * Certificate information, certificate info used to populate this gui - */ - CertInfo _certInfo; - - /** - * cn of the sie. ie. admin-serv-buddha - * Note that the key & cert db file are named using the sie. - */ - String alias; - - /** - * Properties file, contain all the localized string - */ - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - - /** - * After this dilaog is disposed, the routine(CertManagementDialog) that opens this ui will - * need to know whether the cert presented has been deleted and update it's gui accordingly. - */ - static boolean delete = false; - - /** - * Owner of this dialog - */ - JFrame _parent; - - JLabel certName = new JLabel(); - MultilineLabel issuer = new MultilineLabel(6, 5); - MultilineLabel subject = new MultilineLabel(6, 5); - - JButton bDetail; - JButton bDelete; - JButton bTrust; - - JLabel _issuerLabel; - JLabel _subjectLabel; - - /** - * Trust status of the cert that is presented - */ - boolean trustedCert; - - - private boolean promptBeforeDelete() { - return SuiOptionPane.showConfirmDialog(this, - resource.getString("CertInfoDialog", "areYouSure"), - resource.getString("CertInfoDialog", "confirmTitle"), - SuiOptionPane.YES_NO_OPTION) == SuiOptionPane.YES_OPTION; - } - - private void deleteSuccess() { - SuiOptionPane.showMessageDialog(this, - resource.getString("CertInfoDialog", "certDeleted")); - } - - /** - * - * Inner class, where all the action will execute. - * 3 action can be taken on the certificate: Detail, Delete, [Trust|Reject] - * - * Detail: vew other certificate information that is not currently been - * displayed by this dialog - * Delete: Delete certificate from the certificate database - * Trust: Change the certificate's trust status to trust - * Reject: Change the certificate's trust status to do not trust - * - * @see com.netscape.admin.certsrv.security.CertDetailInfoDialog - */ - class CertInfoActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - delete = false; - - if (_taskInfo == null) { - if (e.getActionCommand().equals("CLOSE")) { - CertInfoDialog.this.closeInvoked(); - } else if (e.getActionCommand().equals("DELETE")) { - if (promptBeforeDelete()) { - deleteSuccess(); - delete = true; - setVisible(false); - } - } else if (e.getActionCommand().equals("HELP")) { - helpInvoked(); - } - - } else { - if (e.getActionCommand().equals("DETAIL")) { - (new CertDetailInfoDialog(_parent, _certInfo)).show(); - } else if (e.getActionCommand().equals("DELETE")) { - if (!promptBeforeDelete()) { - return; - } - //call delete cert cgi - _taskInfo.clear(); - _taskInfo.put("certnn", _certInfo.getCertName()); - _taskInfo.put("formop", "D"); - _taskInfo.put("alias", alias); - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_ECRT); - } catch (Exception error) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - error.getMessage()); - return; - } - - //if (response.hasCertInfo()) { - if (!(((Message)(response.getMessages().elementAt(0))). - isFailure())) { - deleteSuccess(); - delete = true; - setVisible(false); - } else { - try { - MessageDialog.messageDialog( (Message) - (response.getMessages().elementAt(0))); - } catch (Exception e2) { - //shouldn't even be here in the first place. if cgi fail or return nothing - //then it should be handle right after KeyCertTaskInfo.exec(...) is called - //If exception occure here here then something is really mess up - Debug.println("Error in decoding server messages"); - } - } - } - else if (e.getActionCommand().equals("TRUST")) { - //call trust cert cgi - //need to display a warning message first - _taskInfo.clear(); - _taskInfo.put("certnn", _certInfo.getCertName()); - _taskInfo.put("formop", "C"); - _taskInfo.put("alias", alias); - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_ECRT); - } catch (Exception error2) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - error2.getMessage()); - return; - } - /*if (response.hasCertInfo()) { - setCertInfo(response.getCertInfo()); - }*/ - - try { - if (!(((Message) - (response.getMessages().elementAt(0))). - isFailure())) { - trustedCert = !trustedCert; - bTrust.setText(trustedCert ? - resource.getString("CertInfoDialog", - "reject") : - resource.getString("CertInfoDialog", - "trust")); - } - - MessageDialog.messageDialog( (Message) - (response.getMessages().elementAt(0))); - } catch (Exception e3) { - //shouldn't even be here in the first place. if cgi fail or return nothing - //then it should be handle right after KeyCertTaskInfo.exec(...) is called - //If exception occure here here then something is really mess up. - Debug.println("Error in decoding server messages"); - } - } - } - } - } - - /** - * - * Update certificate information. - * Without disposing the dialog this method allows the reuse the the same dialog - * by repopulating it with new certificate information - * - * @param certInfo contain certificate information to be displayed - * - */ - void setCertInfo(CertInfo certInfo) { - _certInfo = certInfo; - - certName.setText(certInfo.getCertName()); - issuer.setText(certInfo.getIssuer()); - subject.setText(certInfo.getSubject()); - - if (_taskInfo != null) { - trustedCert = certInfo.trusted(); - bTrust.setText(trustedCert ? - resource.getString("CertInfoDialog", "reject") : - resource.getString("CertInfoDialog", "trust")); - } - } - - - /** - * - * Invoke on-line help - * - */ - protected void helpInvoked() { - Help help = new Help(resource); - help.help("CertInfoDialog", "help"); - } - - protected void closeInvoked() { - super.closeInvoked(); - } - - - /** - * - * @return a panel contain subject and issuer - * - * [Panel] - * [Subject] [Issuer] - * [Panel] - * - */ - private JPanel getSubjectIssuerPane() { - JPanel subjectIssuerPane = new JPanel(); - subjectIssuerPane.setLayout(new GridBagLayout()); - - _issuerLabel = - new JLabel(resource.getString("CertInfoDialog", "issuer")); - _subjectLabel = - new JLabel(resource.getString("CertInfoDialog", "subject")); - - //issuer.getCaret().setVisible(false); - //issuer.setSelectionColor(issuer.getBackground()); - //issuer.setEditable(false); - //subject.getCaret().setVisible(false); - //subject.setSelectionColor(issuer.getBackground()); - //subject.setEditable(false); - - GridBagUtil.constrain(subjectIssuerPane, _subjectLabel, 0, 0, - 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(subjectIssuerPane, _issuerLabel, 2, 0, 1, - 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(subjectIssuerPane, - Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0)) - , 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - - JScrollPane subjectScrollPane = new JScrollPane(subject, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - subjectScrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - GridBagUtil.constrain(subjectIssuerPane, subjectScrollPane, 0, - 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - JScrollPane issuerScrollPane = new JScrollPane(issuer, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - issuerScrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - GridBagUtil.constrain(subjectIssuerPane, issuerScrollPane, 2, - 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - return subjectIssuerPane; - } - - /** - * - * @return a panel contain certificate name and what ever was return by getSubjectIssuerPane() - * [PANEL] - * Certificate Name - * getSubjectIssuerPane() - * [PANEL] - * - * @see #getSubjectIssuerPane - */ - private JPanel getInfoPane() { - JPanel infoPane = new JPanel(); - infoPane.setLayout(new GridBagLayout()); - - int y = 0; - - - GridBagUtil.constrain(infoPane, certName, 0, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - COMPONENT_SPACE, 0, COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(infoPane, getSubjectIssuerPane(), 0, ++y, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - return infoPane; - } - - - - /** - * - * @return Panel contain a row of button(Delete, View, [Trust|Reject]) - * [PANEL] - * [bDetail] [bDelete] [bTrust|bReject] - * [PANEL] - * - */ - private JPanel getControlPane() { - - JPanel controlPane = new JPanel(); - controlPane.setLayout(new GridBagLayout()); - CertInfoActionListener listener = new CertInfoActionListener(); - - if (_taskInfo == null) { - - GridBagUtil.constrain(controlPane, - JButtonFactory.createCloseButton(listener), 0, 0, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, - DIFFERENT_COMPONENT_SPACE, 0, 0, COMPONENT_SPACE); - - GridBagUtil.constrain(controlPane, - JButtonFactory.create( - resource.getString("CertInfoDialog", "delete"), - listener, "DELETE"), 1, 0, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - DIFFERENT_COMPONENT_SPACE, 0, 0, COMPONENT_SPACE); - - GridBagUtil.constrain(controlPane, - JButtonFactory.createHelpButton(listener), 2, 0, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, - DIFFERENT_COMPONENT_SPACE, 0, 0, 0); - } else { - JPanel certButtonPane = new JPanel(); - //certButtonPane.setLayout(new BoxLayout(certButtonPane, BoxLayout.X_AXIS)); - certButtonPane.setLayout(new GridBagLayout()); - - certButtonPane.setBorder( new TitledBorder( - new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertInfoDialog", "certificate"))); - - bDetail = JButtonFactory.create( - resource.getString("CertInfoDialog", "detail")); - bDetail.addActionListener(listener); - bDetail.setActionCommand("DETAIL"); - - bDelete = JButtonFactory.create( - resource.getString("CertInfoDialog", "delete")); - bDelete.addActionListener(listener); - bDelete.setActionCommand("DELETE"); - - JButtonFactory.resizeGroup(bDetail, bDelete); - - setTitle(resource.getString("CertInfoDialog", "certificate")); - - //certButtonPane.add(bDetail); - //certButtonPane.add(Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0))); - //certButtonPane.add(bDelete); - GridBagUtil.constrain(certButtonPane, bDetail, 0, 0, 1, 1, - 1.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, 0, 0, 0, 0); - GridBagUtil.constrain(certButtonPane, bDelete, 1, 0, 1, 1, - 1.0, 0.0, GridBagConstraints.EAST, - GridBagConstraints.BOTH, 0, COMPONENT_SPACE, 0, 0); - - JPanel trustCAButtonPane = new JPanel(); - trustCAButtonPane.setLayout(new GridBagLayout()); - trustCAButtonPane.setBorder( new TitledBorder( - new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertInfoDialog", "trustCA"))); - - - - bTrust = JButtonFactory.create( - resource.getString("CertInfoDialog", "reject")); - bTrust.addActionListener(listener); - bTrust.setActionCommand("TRUST"); - - JButtonFactory.resizeGroup(bTrust, - JButtonFactory.create( - resource.getString("CertInfoDialog", "reject"))); - - //trustCAButtonPane.add(bTrust); - GridBagUtil.constrain(trustCAButtonPane, bTrust, 0, 0, 1, - 1, 1.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(controlPane, certButtonPane, 0, 0, 1, - 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(controlPane, trustCAButtonPane, 1, 0, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - return controlPane; - } - - - void init(CertInfo certInfo) { - JPanel mainPane = new JPanel(); - mainPane.setBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE))); - mainPane.setLayout(new BorderLayout()); - - mainPane.add("Center", getInfoPane()); - - if (_taskInfo == null) { - getContentPane().add("South", getControlPane()); - } else { - mainPane.add("South", getControlPane()); - } - - getContentPane().add(mainPane); - - setCertInfo(certInfo); - - pack(); - setMinimumSize(getSize()); - setResizable(false); - } - - /** - * - * Construct a certificate information dialog - * - * @param parent the owner of the dialog - * @param certInfo contain certificate information to be displayed - * @param taskInfo task module that carry out the action for change trust, delete, or get certificate information - * - */ - public CertInfoDialog(JFrame parent, CertInfo certInfo, - KeyCertTaskInfo taskInfo) { - super(parent, "", true, CLOSE | HELP); - - _taskInfo = taskInfo; - _parent = parent; - - alias = (String)(taskInfo.get("alias")); - - init(certInfo); - } - - public CertInfoDialog(JFrame parent, CertInfo certInfo) { - super(parent, "", true/*, CLOSE | HELP*/); - - _parent = parent; - - init(certInfo); - } -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java deleted file mode 100644 index 2f43e9f32..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertInfoPane.java +++ /dev/null @@ -1,391 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * - * Step 3 of the certificate installation under Key & Cert wizard. - * This pane display to user the certificate taht is about to be installed. - * - * @version 1.0 98/07/10 - * @author shihcm@netscape.com - * - */ -class CertInstallCertInfoPane extends JPanel implements SuiConstants, -IKeyCertPage { - - - JLabel _subjectLabel; - JLabel _issuerLabel; - - JLabel certName = new JLabel(); - MultilineLabel issuer = new MultilineLabel(6, 5); - MultilineLabel subject = new MultilineLabel(6, 5); - - MultilineLabel serialNum = new MultilineLabel(); - MultilineLabel valid = new MultilineLabel(); - MultilineLabel fingerprint = new MultilineLabel(); - MultilineLabel addReplaceLabel = new MultilineLabel(); - JButton addReplaceButton = new JButton(); - - String certNameLabel; - - /** - * Reference to a copy of WizardObservable that was pass in via pageShow - * WizardObservable contain shared information between all the panels - * under Key & Cert Wizard. - */ - WizardObservable obs; - - /** - * Communication module that does the actually sends the cgi request to install - * the certificate. - */ - KeyCertTaskInfo taskInfo; - - - /** - * Properties file, contain all the localized string - */ - ResourceSet resource; - - /** - * Get the panel that is going to be displayed - * @return a panel to be displayed by the key & cert wizard - */ - public JPanel getPanel() { - return this; - } - - /** - * Checks if this panel can be shown - * @return true if this page can be shown - */ - public boolean pageShow(WizardObservable observable) { - obs = observable; - boolean show = - ((Boolean)(observable.get("installCert"))).booleanValue(); - if (show) { - - StatusPane statusPane = (StatusPane)(obs.get("statusPane")); - statusPane.setLastPage(false); - - taskInfo = observable.getTaskInfo(); - - Hashtable certInstInfo = (Hashtable)(observable.get("certInstInfo")); - certInstInfo.put("tokenName", observable.get("tokenName")); - - if (certInstInfo.get("repbutton") != null) { - try { - addReplaceLabel.setText( - resource.getString("CertInstallCertInfoPane", - "replaceCert")); - addReplaceButton.setText( - resource.getString("CertInstallCertInfoPane", - "replace")); - } catch (Exception e) {} - } else { - try { - addReplaceLabel.setText( - resource.getString("CertInstallCertInfoPane", - "addCert")); - addReplaceButton.setText( - resource.getString("CertInstallCertInfoPane", - "add")); - } catch (Exception e) {} - } - CertInfo certInfo = (CertInfo)(observable.get("certInfo")); - - subject.setText(certInfo.getSubject()); - issuer.setText(certInfo.getIssuer()); - certName.setText(certNameLabel + certInfo.getCertName()); - serialNum.setText(certInfo.getSerialNumber()); - fingerprint.setText(certInfo.getFingerPrint()); - - String validFromToLabel = null; - try { - validFromToLabel = - resource.getString("CertInstallCertInfoPane", - "validFromTo"); - } catch (Exception e) {} - - valid.setText( KeyCertUtility.replace( - KeyCertUtility.replace(validFromToLabel, "%FROM", - certInfo.getValidFrom()), "%TO", - certInfo.getValidTo())); - - - - } - return show; - } - - /** - * Checks if this panel can be hidden - * @return true if this page can be hide - */ - public boolean pageHide(WizardObservable observable) { - return true; - } - - - /** - * - * Inner class to handle add/replace certificate. - * If add/replace action occure method within this inner - * class will call the cgi to do the work. - * - */ - class CertInfoActionListener implements ActionListener { - public void actionPerformed(ActionEvent event) { - if (event.getActionCommand().equals("add_replace")) { - Hashtable certInstInfo = (Hashtable)(obs.get("certInstInfo")); - Enumeration keys = certInstInfo.keys(); - while (keys.hasMoreElements()) { - String key = (String)(keys.nextElement()); - taskInfo.put(key, certInstInfo.get(key)); - } - - try { - taskInfo.put("keyfilepw", obs.get("keyfilepw")); - taskInfo.exec(taskInfo.SEC_ICRT); - taskInfo.clear(); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - //((IWizardControl)(obs.get("Wizard"))).cancelInvoked(); - return; - } - - Vector messages = taskInfo.getResponse().getMessages(); - //int nMessages = messages.size(); - - StatusPane statusPane = (StatusPane)(obs.get("statusPane")); - statusPane.setMessage(messages); - statusPane.setShow(true); - statusPane.setLastPage(true); - - ((IWizardControl)(obs.get("Wizard"))).setIsLastPage(false); - ((IWizardControl)(obs.get("Wizard"))).setCanGoForward( - false); - ; - ((IWizardControl)(obs.get("Wizard"))).nextInvoked(); - } - } - } - - - - - /** - * - * @return a panel contain subject and issuer - * - * [Panel] - * [Subject] [Issuer] - * [Panel] - * - */ - private JPanel getSubjectIssuerPane() { - JPanel subjectIssuerPane = new JPanel(); - subjectIssuerPane.setLayout(new GridBagLayout()); - - addReplaceButton.setActionCommand("add_replace"); - addReplaceButton.addActionListener(new CertInfoActionListener()); - - GridBagUtil.constrain(subjectIssuerPane, _subjectLabel, 0, 0, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(subjectIssuerPane, _issuerLabel, 2, 0, 1, - 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(subjectIssuerPane, - Box.createRigidArea(new Dimension(COMPONENT_SPACE, 0)) - , 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - - JScrollPane subjectScrollPane = new JScrollPane(subject, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - subjectScrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - - GridBagUtil.constrain(subjectIssuerPane, subjectScrollPane, 0, - 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - JScrollPane issuerScrollPane = new JScrollPane(issuer, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - issuerScrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - GridBagUtil.constrain(subjectIssuerPane, issuerScrollPane, 2, - 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - return subjectIssuerPane; - } - - - /** - * - * A panel contain a string telling user whether a add or a replace can - * take place for this certificate - * [panel] - * [string telling use if they can add or replace] [add|replace button] - * [panel] - * - */ - private JPanel getAddReplacePane() { - JPanel addReplacePane = new JPanel(); - addReplacePane.setLayout(new GridBagLayout()); - - GridBagUtil.constrain(addReplacePane, addReplaceLabel, 0, 0, 1, - 1, 1.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(addReplacePane, addReplaceButton, 1, 0, - 1, 1, 1.0, 0.0, GridBagConstraints.EAST, - GridBagConstraints.NONE, 0, 0, 0, 0); - - return addReplacePane; - } - - /** - * - * This panel contain certificate informations, serial number, finger print, - * validation date. Also make a cal to getSubjectIssuerPanel() to obtain - * subject and issuer ui - * [panel] - * [subject] [issuer] - * [serial number[ - * [finger print] - * [validation] - * [panel] - * - */ - private JPanel getInfoPane() { - JPanel infoPane = new JPanel(); - infoPane.setLayout(new GridBagLayout()); - - int y = 0; - - GridBagUtil.constrain(infoPane, certName, 0, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(infoPane, getSubjectIssuerPane(), 0, ++y, - 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SEPARATED_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, - new JLabel( resource.getString("CertInstallCertInfoPane", - "serialLabel")), 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - GridBagUtil.constrain(infoPane, serialNum, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, - new JLabel( resource.getString("CertInstallCertInfoPane", - "fingerprintLabel")), 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - GridBagUtil.constrain(infoPane, fingerprint, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, valid, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - return infoPane; - } - - - - /** - * - * Constructor, create a certificate information pane and a action button allow - * user to add or replace certificate. - * - */ - public CertInstallCertInfoPane() { - super(); - setLayout(new GridBagLayout()); - - resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - certNameLabel = resource.getString("CertInstallCertInfoPane", "certNameLabel"); - - _subjectLabel = new JLabel( - resource.getString("CertInstallCertInfoPane", "subjectLabel")); - _issuerLabel = new JLabel( - resource.getString("CertInstallCertInfoPane", "issuerLabel")); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertInstallCertInfoPane", "title"))); - - int y = 0; - - GridBagUtil.constrain(this, getInfoPane(), 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, getAddReplacePane(), 0, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertInstallCertInfoPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java deleted file mode 100644 index 210cfc9bf..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallCertPane.java +++ /dev/null @@ -1,236 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CertInstallCertPane extends JPanel implements SuiConstants, -IKeyCertPage { - - JRadioButton certInFile; - JTextField certFilename = new JTextField(20); - JRadioButton certInText; - JTextArea certText = new JTextArea(7, 10); - JButton paste; - - IWizardControl control = null; - boolean modified = false; - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - - if (control == null) { - control = (IWizardControl)(observable.get("Wizard")); - setEnableNextButton(); - } - - return ((Boolean)(observable.get("installCert"))).booleanValue(); - } - - public boolean pageHide(WizardObservable observable) { - boolean hide = true; - - if (modified) { - observable.put("CertInstModified", new Boolean(true)); - modified = false; - } - - if (((Boolean)(observable.get("CertInstModified"))).booleanValue()) { - CertInstallTypePane.param.put("inputtype" , - certInFile.isSelected() ? "0":"1"); - CertInstallTypePane.param.put("cert_file", - certFilename.getText()); - CertInstallTypePane.param.put("cert_txt" , certText.getText()); - CertInstallTypePane.param.put("tokenName", observable.get("tokenName")); - - KeyCertTaskInfo taskInfo = observable.getTaskInfo(); - Enumeration cgiParam = CertInstallTypePane.param.keys(); - while (cgiParam.hasMoreElements()) { - String key = (String)(cgiParam.nextElement()); - taskInfo.put(key, CertInstallTypePane.param.get(key)); - } - - Response response = null; - try { - response = taskInfo.exec(taskInfo.SEC_ICRT); - taskInfo.clear(); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - hide = false; - } - - if (response.hasCertInstInfo() && response.hasCertInfo()) { - observable.put("certInstInfo", response.getCertInstInfo()); - observable.put("certInfo", response.getCertInfo()); - observable.put("CertInstModified", new Boolean(false)); - } else { - //hide = false; - //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0))); - StatusPane statusPane = (StatusPane)(observable.get("statusPane")); - - statusPane.setMessage( (Message) - (taskInfo.getResponse().getMessages(). - elementAt(0))); - statusPane.setShow(true); - } - } - - return hide; - } - - - class CertPaneActionListener implements ActionListener, KeyListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - setEnableNextButton(); - } - - public void actionPerformed(ActionEvent event) { - modified = true; - - if (event.getActionCommand().equals("PASTE")) { - certText.paste(); - } - - setEnableNextButton(); - } - } - - void setEnableNextButton() { - if ((certInFile.isSelected() && - (certFilename.getText().length() != 0)) || - (certInText.isSelected() && - (certText.getText().length() != 0))) { - control.setCanGoForward(true); - } else { - control.setCanGoForward(false); - } - - if (certInFile.isSelected()) { - certText.setEnabled(false); - certFilename.setEnabled(true); - } else { - certText.setEnabled(true); - certFilename.setEnabled(false); - } - } - - - public CertInstallCertPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - certInFile = new JRadioButton( - resource.getString("CertInstallCertPane", - "certInFileLabel"), false); - certInText = new JRadioButton( - resource.getString("CertInstallCertPane", - "certInTextLabel"), true); - paste = new JButton(resource.getString("CertInstallCertPane", "pasteLabel")); - - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(certInFile); - buttonGroup.add(certInText); - - int y = 0; - - CertPaneActionListener listener = new CertPaneActionListener(); - certFilename.addKeyListener(listener); - - //certText.addActionListener(listener); - certText.addKeyListener(listener); - - certInText.addActionListener(listener); - certInFile.addActionListener(listener); - - paste.setActionCommand("PASTE"); - paste.addActionListener(listener); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertInstallCertPane", "title"))); - - - GridBagUtil.constrain(this, certInFile, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, certFilename, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, - 0, 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, certInText, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("CertInstallCertPane", - "certTextExplain")), 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - - JScrollPane scrollPane = new JScrollPane(certText, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setBorder(UITools.createLoweredBorder()); - GridBagUtil.constrain(this, scrollPane, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, paste, 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.WEST, GridBagConstraints.NONE, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - - JLabel _next = new JLabel(resource.getString(null, "clickNextToContinue")); - GridBagUtil.constrain(this, _next, 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertInstallCertPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java deleted file mode 100644 index a55fce2ec..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertInstallTypePane.java +++ /dev/null @@ -1,296 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CertInstallTypePane extends JPanel implements SuiConstants, -IKeyCertPage { - - JRadioButton thisServer; - JRadioButton certChain; - JRadioButton ca; - - JLabel tokenName = new JLabel(); - SingleBytePasswordField passwd = new SingleBytePasswordField(20); - JLabel certName = new JLabel(); - - JLabel _certnameLabel; - JLabel _tokenLabel; - JLabel _certType; - JLabel _passwordLabel; - - public static Hashtable param = new Hashtable(); - - IWizardControl control; - boolean modified = true; - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - boolean show = - ((Boolean)(observable.get("installCert"))).booleanValue(); - - control = (IWizardControl)(observable.get("Wizard")); - - passwd.setText((String)(observable.get("keyPasswd"))); - if (passwd.getText().length() == 0) { - control = (IWizardControl)(observable.get("Wizard")); - setEnableNextButton(); - } - - if (show) { - tokenName.setText((String)(observable.get("tokenName"))); - certName.setText((String)(observable.get("certName"))); - } - - return show; - } - - public boolean pageHide(WizardObservable observable) { - - - if (modified) { - observable.put("keyfilepw", passwd.getText()); - - observable.put("CertInstModified", new Boolean(true)); - - param.put("certtype" , - thisServer.isSelected() ? "0": - (certChain.isSelected() ? "1":"2")); - param.put("alias" , observable.get("sie")); - param.put("keyfilepw", passwd.getText()); - observable.put("keyPasswd", passwd.getText()); - - if (thisServer.isSelected()) { - param.put("certname", (String)(observable.get("certName"))); - } else { - param.remove("certname"); - } - - modified = false; - } - - return true; - } - - void setEnableNextButton() { - if (passwd.getText().length() == 0) { - control.setCanGoForward(false); - } else { - control.setCanGoForward(true); - } - } - - class TypeActionListener implements ActionListener, KeyListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - modified = true; - setEnableNextButton(); - } - - public void actionPerformed(ActionEvent event) { - modified = true; - - if (thisServer.isSelected()) { - certName.setVisible(true); - _certnameLabel.setVisible(true); - - _passwordLabel.setVisible(true); - passwd.setVisible(true); - - setEnableNextButton(); - } else { - certName.setVisible(false); - _certnameLabel.setVisible(false); - - _passwordLabel.setVisible(false); - passwd.setVisible(false); - - control.setCanGoForward(true); - } - } - } - - - - private JPanel getCertTypePane() { - JPanel certTypePane = new JPanel(); - certTypePane.setLayout(new GridBagLayout()); - int y = 0, x = 0; - - TypeActionListener listener = new TypeActionListener(); - thisServer.addActionListener(listener); - certChain.addActionListener(listener); - ca.addActionListener(listener); - passwd.addKeyListener(listener); - - GridBagUtil.constrain(certTypePane, - Box.createRigidArea( - new Dimension(DIFFERENT_COMPONENT_SPACE, 0)), x, y, 1, - 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(certTypePane, new JLabel("1. "), ++x, - ++y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.NONE, 0, 0, 0, 0); - - GridBagUtil.constrain(certTypePane, _certType, ++x, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(certTypePane, thisServer, x, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(certTypePane, certChain, x, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(certTypePane, ca, x, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - return certTypePane; - } - - - - private JLabel createRightAlignLabel(String label) { - return new JLabel(label, JLabel.RIGHT); - } - - - private JPanel getTokenInfoPane() { - JPanel tokenInfoPane = new JPanel(); - tokenInfoPane.setLayout(new GridBagLayout()); - int y = 0; - - - GridBagUtil.constrain(tokenInfoPane, _tokenLabel, 0, y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(tokenInfoPane, tokenName, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(tokenInfoPane, _passwordLabel, 0, ++y, 1, - 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(tokenInfoPane, passwd, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(tokenInfoPane, _certnameLabel, 0, ++y, 1, - 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(tokenInfoPane, certName, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - return tokenInfoPane; - } - - - public CertInstallTypePane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - thisServer = new JRadioButton( - resource.getString("CertInstallTypePane", - "thisServerLabel"), true); - certChain = new JRadioButton( - resource.getString("CertInstallTypePane", - "certChainLabel"), false); - ca = new JRadioButton( - resource.getString("CertInstallTypePane", "caLabel"), - false); - - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(thisServer); - buttonGroup.add(certChain); - buttonGroup.add(ca); - - - _certnameLabel = - new JLabel(resource.getString("CertInstallTypePane", "certnameLabel")); - _tokenLabel = createRightAlignLabel( - resource.getString("CertInstallTypePane", "tokenLabel")); - _certType = - new JLabel(resource.getString("CertInstallTypePane", "certType")); - _passwordLabel = createRightAlignLabel( - resource.getString("CertInstallTypePane", "passwordLabel")); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertInstallTypePane", "title"))); - - int y = 0; - - GridBagUtil.constrain(this, getCertTypePane(), 0, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString("CertInstallTypePane", "promptPasswd")) - , 0, ++y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, getTokenInfoPane(), 0, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertInstallTypePane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java deleted file mode 100644 index 62f58d9c2..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTable.java +++ /dev/null @@ -1,316 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - - -import com.netscape.management.client.console.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -import java.util.*; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; -import javax.swing.table.*; -import javax.swing.event.*; - -//import crysec.SSL.DBManager; -//import crysec.X509; -//import crysec.X500Name; -//import crysec.Utils; - -class CertListTable extends JPanel implements MouseListener, Runnable { - JTable _table; - CertListTableModel _dataModel; - KeyCertTaskInfo _taskInfo; - - String alias; - String _certName; - boolean local = false; - boolean setupComplete; - Vector certList; - // DBManager trustdb; - - //IBackgroundLoaderCallback _callback; - - ConsoleInfo _consoleInfo; - - private String formatLineString(String val, String option, - boolean newLine) { - if (val != null) { - return val + (newLine ? option + "\n":option); - } else { - return ""; - } - } - - public void showCert() { -// to get it compile -/* - int row = _table.getSelectedRow(); - if (row == -1) - return; - - //show cert here - - if (local) { - X509 cert = (X509)(certList.elementAt(row)); - X500Name holder = (X500Name)(cert.getHolder()); - X500Name issuer = (X500Name)(cert.getIssuer()); - - StringBuffer subjectString = new StringBuffer(); - StringBuffer issuerString = new StringBuffer(); - - subjectString.append( - formatLineString(holder.getName(), "", true)); - subjectString.append( - formatLineString(holder.getEmail(), "", true)); - subjectString.append( - formatLineString(holder.getOrganizationName(), "", - true)); - subjectString.append( - formatLineString(holder.getOrgUnitName(), "", true)); - subjectString.append( - formatLineString(holder.getLocalityName(), "", true)); - subjectString.append( - formatLineString(holder.getStateName(), ", ", - false) + holder.getCountryName()); - - issuerString.append( - formatLineString(issuer.getName(), "", true)); - issuerString.append( - formatLineString(issuer.getEmail(), "", true)); - issuerString.append( - formatLineString(issuer.getOrganizationName(), "", - true)); - issuerString.append( - formatLineString(issuer.getOrgUnitName(), "", true)); - issuerString.append( - formatLineString(issuer.getLocalityName(), "", true)); - issuerString.append( - formatLineString(issuer.getStateName(), ", ", - false) + issuer.getCountryName()); - - CertInfo ci = new CertInfo(holder.getName(), - issuerString.toString(), subjectString.toString(), - "", "", cert.getNotBeforeDate().toString(), - cert.getNotAfterDate().toString(), - new String(cert.getFingerprint()), "1", "0", - holder.getOrganizationName()); - - CertInfoDialog infoDialog = new CertInfoDialog(null, ci); - infoDialog.show(); - - if (CertInfoDialog.delete) { - deleteRow(row); - - trustdb.remove(Utils.toHexString(cert.getFingerprint())); - trustdb.save(); - } - } else { - _taskInfo.clear(); - _taskInfo.put("certnn", getRow(row).getCertName()); - _taskInfo.put("alias", alias); - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_ECRT); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - return; - } - - if (response.hasCertInfo()) { - CertInfoDialog infoDialog = - new CertInfoDialog(null, - response.getCertInfo(), _taskInfo); - ModalDialogUtil.setDialogLocation(infoDialog, this); - infoDialog.show(); - //since CertInfoDialog is a modal dialog we will wait until it comes back to check wheather the cer - //has been deleted if it is deleted then we need to refresh the table - if (CertInfoDialog.delete) { - deleteRow(row); - } - } - - //MessageDialog.messageDialog((Message)(response.getMessages().elementAt(0))); - } - */ - } - - - public void mouseClicked(MouseEvent e) { - int row = _table.rowAtPoint(e.getPoint()); - - if (e.getClickCount() < 2) - return; - - if (row == -1) { - _table.clearSelection(); - } else { - showCert(); - } - } - - public void mouseEntered(MouseEvent e) {} - public void mouseExited(MouseEvent e) {} - public void mousePressed(MouseEvent e) {} - public void mouseReleased(MouseEvent e) {} - - public boolean isTableSetup() { - return setupComplete; - } - - - public CertListTable() { - super(true); - local = true; - - setLayout(new BorderLayout()); - - setupComplete = true; - - // trustdb = new DBManager(); - // Enumeration e = trustdb.elements(); - Enumeration e = null; - certList = new Vector(); - Vector v = new Vector(); - // while (e.hasMoreElements()) { - // X509 cert = (X509)(e.nextElement()); - // certList.addElement(cert); -// v.addElement( - // new CertBasicInfo(cert.getHolder().getName(), "Trust Server Certificate", - // cert.getNotAfterDate().toString())); - // } - - _dataModel = new CertListTableModel( - CertBasicInfo.getCertTitleLabels(), v); - setupTable(_dataModel); - } - - - public CertListTable(String certName, ConsoleInfo consoleInfo/*, IBackgroundLoaderCallback callback*/) { - super(true); - _consoleInfo = consoleInfo; - _certName = certName; - //_callback = callback; - setLayout(new BorderLayout()); - - setupComplete = true; - - run(); - - /*setBackground( Color.white );*/ - } - - - - private void setupTable(CertListTableModel _tableModel) { - // Create the table - _table = new SuiTable(_tableModel); - _table.addMouseListener(this); - _table.setColumnSelectionAllowed(false); - /*_table.setMultipleSelectionAllowed(false);*/ - - // Put the table and header into a scrollPane - JScrollPane scrollpane = new JScrollPane(); - JTableHeader tableHeader = _table.getTableHeader(); - - // create and add the column heading to the scrollpane's - // column header viewport - JViewport headerViewport = new JViewport(); - headerViewport.setLayout( - new BoxLayout(headerViewport, BoxLayout.X_AXIS)); - headerViewport.add(tableHeader); - scrollpane.setColumnHeader(headerViewport); - - // add the table to the viewport - JViewport mainViewPort = scrollpane.getViewport(); - mainViewPort.add(_table); - - // speed up resizing repaints by turning off live cell updates - tableHeader.setUpdateTableInRealTime(false); - - add("Center", scrollpane); - - setPreferredSize(new Dimension(0, 0)); - //_callback.classLoaded(this, "CertListTable"); - } - - //public void setCertList(String certName) { - public void run() { - - _taskInfo = new KeyCertTaskInfo(_consoleInfo); - _dataModel = new CertListTableModel( - CertBasicInfo.getCertTitleLabels(), new Vector()); - //setCertList(certName); - - //_dataModel.deleteAllRows(); - //call cgi here to get the cert information - _taskInfo.put("alias", _certName); - alias = _certName; - Response response = null; - try { - response = _taskInfo.exec(_taskInfo.SEC_MGCRT); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - setupComplete = false; - return; - } - - if (response.hasCertList()) { - _dataModel.setRowData(response.getCertList()); - //repaint(); - } - - setupTable(_dataModel); - } - - /** - * - * @return LDAPEntry at specified index, null if index > number of rows - * - */ - public CertBasicInfo getRow(int index) { - return _dataModel.getRow(index); - } - - /** - * - * @return the number of rows in the table. - * - */ - public int getRowCount() { - return _dataModel.getRowCount(); - } - - /** - * - * Removes the first occurrence of the LDAPEntry from this table. If the object is found. - * - * @param ldapEntry LDAPEntry to delete from this table. - * - */ - public void deleteRow(int rowIndex) { - _dataModel.deleteRow(rowIndex); - repaint(); - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java deleted file mode 100644 index fb9423093..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertListTableModel.java +++ /dev/null @@ -1,91 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.*; -import java.awt.event.*; - -import javax.swing.*; -import javax.swing.table.*; -import javax.swing.event.*; - - -class CertListTableModel extends AbstractTableModel { - - Vector _header; - - Vector _rowData = new Vector(); - - Vector _tableModelListener = new Vector(); - - public CertListTableModel(Vector columnIdentifier, Vector certList) { - _header = columnIdentifier; - _rowData = certList; - } - - public void setRowData(Vector rowData) { - _rowData = rowData; - } - - public int getRowCount() { - return _rowData.size(); - } - - public int getColumnCount() { - return _header.size(); - } - - public String getColumnName(int columnIndex) { - return (columnIndex >= _header.size() ? "": - (String)(_header.elementAt(columnIndex))); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - Object o = null; - - try { - o = ((CertBasicInfo)(_rowData.elementAt(rowIndex))). - getCertInfo((String)(_header.elementAt(columnIndex))); - } catch (Exception e) {} - - return o; - } - - public void deleteRow(int rowIndex) { - try { - _rowData.removeElementAt(rowIndex); - } catch (Exception e) {} - } - - public void deleteAllRows() { - _rowData.removeAllElements(); - } - - public CertBasicInfo getRow(int index) { - return index < _rowData.size() ? - (CertBasicInfo)(_rowData.elementAt(index)) : null; - } - - public void addTableModelListener(TableModelListener l) { - _tableModelListener.addElement(l); - } - - public void removeTableModelListener(TableModelListener l) { - _tableModelListener.removeElement(l); - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java deleted file mode 100644 index f780314cd..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertManagementDialog.java +++ /dev/null @@ -1,220 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.table.*; -import javax.swing.event.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.nmclf.*; - -/** - * - * Certificate management dialog. - * This is a self contain dialog, that allow use to - * view, delete, and change the trut status of a certificate. - * This is only the front end, the actuall work - * of looking up, delete, and modified certificate are handled - * at the server side. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class CertManagementDialog extends AbstractDialog { - - CertListTable certListTable; - KeyCertTaskInfo taskInfo; - ConsoleInfo _consoleInfo; - - JButton bClose; - JButton bEdit; - JButton bHelp; - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.CertManagementResource"); - - //since can't over load protected and I don't - //want the interface to show so... - private void privateHelpInvoked() { - Help help = new Help(resource); - help.help("CertManagementDialog", "help"); - } - - - //since can't over load protected and I don't - //want the interface to show so... - private void privateCloseInvoked() { - super.okInvoked(); - } - - class CertManagementActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("CLOSE")) { - privateCloseInvoked(); - } else if (e.getActionCommand().equals("HELP")) { - privateHelpInvoked(); - } else if (e.getActionCommand().equals("EDIT")) { - certListTable.showCert(); - } - } - } - - - private JPanel getCertListPane() { - JPanel certListPane = new JPanel(); - certListPane.setLayout(new GridBagLayout()); - certListPane.setBorder( new TitledBorder( - new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertManagementDialog", "certificate"))); - - - GridBagUtil.constrain(certListPane, - new JLabel( - resource.getString("CertManagementDialog", "certDB")), - 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(certListPane, - new JLabel( resource.getString("CertManagementDialog", - "defaultToken"), JLabel.RIGHT), 1, 0, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(certListPane, certListTable, 0, 1, 2, 1, - 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - - return certListPane; - } - - - private JPanel getControlButtons() { - JPanel controlPanel = new JPanel(); - controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - controlPanel.setBorder( - new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0)); - - CertManagementActionListener listener = - new CertManagementActionListener(); - - bClose = JButtonFactory.createCloseButton(listener); - controlPanel.add(bClose); - - controlPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.COMPONENT_SPACE, 0))); - - bEdit = JButtonFactory.create( - resource.getString("CertManagementDialog", "edit")); - bEdit.addActionListener(listener); - bEdit.setActionCommand("EDIT"); - controlPanel.add(bEdit); - - controlPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0))); - - bHelp = JButtonFactory.createHelpButton(listener); - controlPanel.add(bHelp); - - JButtonFactory.resizeGroup(bHelp, bClose, bEdit); - - return controlPanel; - } - - - - /** - * Create an certificate management dialog to - * manage remote certificate database - * - * @param consoleInfo Console information - * - */ - public CertManagementDialog(ConsoleInfo consoleInfo) { - super(null, "", true, NO_BUTTONS); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - _consoleInfo = consoleInfo; - - setTitle(resource.getString("CertManagementDialog", "title")); - - JPanel mainPane = new JPanel(); - mainPane.setLayout(new BorderLayout()); - - certListTable = new CertListTable( - KeyCertUtility.createTokenName(_consoleInfo), consoleInfo); - mainPane.add("Center", getCertListPane()); - mainPane.add("South", getControlButtons()); - - getContentPane().add(mainPane); - - //pack(); - setMinimumSize(400, 400); - //setResizable(false); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - - if (!(certListTable.isTableSetup())) { - return; - } - - show(); - } - - /** - * Create an certificate management dialog to - * manage local trust database. - * - * - */ - public CertManagementDialog() { - super(null, "", true, NO_BUTTONS); - - setTitle(resource.getString("CertManagementDialog", "title")); - - JPanel mainPane = new JPanel(); - mainPane.setLayout(new BorderLayout()); - - certListTable = new CertListTable(); - mainPane.add("Center", getCertListPane()); - mainPane.add("South", getControlButtons()); - - getContentPane().add(mainPane); - - setSize(400, 400); - - if (!(certListTable.isTableSetup())) { - return; - } - - show(); - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java deleted file mode 100644 index 46ae3852f..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestCertPane.java +++ /dev/null @@ -1,197 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.util.*; -import java.net.*; -import java.io.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.text.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; -import com.netscape.management.client.comm.HttpChannel; - -class CertRequestCertPane extends JPanel implements SuiConstants, -IKeyCertPage { - - JTextArea certReq = new JTextArea(7, 10); - JScrollPane scrollPane = new JScrollPane(certReq, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - String explainEMail, explainURL; - JButton copy; - String oldUrl = ""; - - - - public JPanel getPanel() { - return this; - } - - - - class CertPaneActionListener implements ActionListener { - public void actionPerformed(ActionEvent event) { - if (event.getActionCommand().equals("COPY")) { - certReq.selectAll(); - certReq.copy(); - certReq.setSelectionEnd(certReq.getSelectionEnd()); - } - } - } - - public boolean pageHide(WizardObservable observable) { - return true; - } - - public boolean pageShow(WizardObservable observable) { - boolean show = - ((Boolean)(observable.get("requestCert"))).booleanValue(); - - - Hashtable param = (Hashtable)(observable.get("CertReqCGIParam")); - if (show && param.get("xmt_select").equals("1")) { - - Hashtable urlParam = new Hashtable(); - urlParam.put("op" , "submitCSR"); - urlParam.put("csrCertType" , "server"); - urlParam.put("csrRequestorName" , param.get("requestor_name")); - urlParam.put("csrRequestorEmail" , param.get("email_address")); - urlParam.put("csrRequestorPhone" , param.get("telephone")); - urlParam.put("csrRequestorComments", ""); - urlParam.put("pkcs10Request" , observable.get("CertReq")); - - if (((Boolean)(observable.get("newCertReq"))).booleanValue() - && !(oldUrl.equals(param.get("url")))) { - try { - //attempt to contect cms - oldUrl = (String)(param.get("url")); - Comm cmsUrl = new Comm(oldUrl, /*null*/urlParam, true); - cmsUrl.run(); - /*System.out.println(cmsUrl.getData());*/ - //explain.setVisible(false); - explain.setText(explainURL); - if (cmsUrl.getError() != null) { - //cms didn't respond - certReq.setText( - resource.getString("CertRequestCertPane", - "cmsNotResponding")); - Debug.println("CertRequestCertPane:"+ - cmsUrl.getError()); - } else if ((cmsUrl.getData() != null) && - (cmsUrl.getData().trim().length() != 0)) { - //cms return a message - - JEditorPane editor = new JEditorPane(); - editor.setBorder(new EmptyBorder(0, 0, 0, 0)); - editor.setEditable(false); - //editor.setOpaque(false); - - //display cms's message - Debug.println(cmsUrl.getData()); - StringReader reader = - new StringReader(cmsUrl.getData()); - editor.setEditorKit( - editor.createEditorKitForContentType("text/html")); - Document dstDoc = editor.getDocument(); - editor.getEditorKit().read(reader, dstDoc, 0); - - certReq.setText(editor.getText()); - } - - observable.put("newCertReq", new Boolean(false)); - } catch (Exception e) { - certReq.setText( - resource.getString("CertRequestCertPane", "unableToParse")); - Debug.println("CertRequestCertPane:"+e); - - } - } - - } else if (show) { - //if request via e-mail - explain.setText(explainEMail); - certReq.setText((String)(observable.get("CertReq"))); - explain.setVisible(true); - } - - scrollPane.validate(); - - return show; - } - - MultilineLabel explain; - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - public CertRequestCertPane() { - super(); - setLayout(new GridBagLayout()); - - - copy = JButtonFactory.create( - resource.getString("CertRequestCertPane", "copyLabel")); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertRequestCertPane", "title"))); - - int y = 0; - - explainEMail = resource.getString("CertRequestCertPane", "explain"); - explainURL = resource.getString("CertRequestCertPane", "explain2"); - - - explain = new MultilineLabel(explainEMail); - GridBagUtil.constrain(this, explain, 0, ++y, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, scrollPane, 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - - copy.setActionCommand("COPY"); - copy.addActionListener(new CertPaneActionListener()); - GridBagUtil.constrain(this, copy, 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.WEST, GridBagConstraints.NONE, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertRequestCertPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java deleted file mode 100644 index d051ee167..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestEnterPasswordPane.java +++ /dev/null @@ -1,217 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.util.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CertRequestEnterPasswordPane extends JPanel implements SuiConstants, -IKeyCertPage { - - - JLabel _passwdLabel; - JLabel _tokenLabel; - - JLabel _selectedToken = new JLabel(); - SingleBytePasswordField _passwd = new SingleBytePasswordField(20); - - IWizardControl control; - boolean modified = false; - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - boolean show = - ((Boolean)(observable.get("requestCert"))).booleanValue(); - if (show) { - _passwd.setText((String)(observable.get("keyPasswd"))); - control = (IWizardControl)(observable.get("Wizard")); - if (_passwd.getText().length() == 0) { - control.setCanGoForward(false); - } - - boolean isInternal = ((Boolean)(observable.get("isInternal"))). - booleanValue(); - - _selectedToken.setText((String)(observable.get("tokenName"))); - } - - return show; - } - - public boolean pageHide(WizardObservable observable) { - boolean hide = true; - KeyCertTaskInfo taskInfo = observable.getTaskInfo(); - - if (modified || ((Boolean)(observable.get("CertReqModified"))). - booleanValue()) { - observable.put("CertReqModified", new Boolean(true)); - Hashtable param = (Hashtable)(observable.get("CertReqCGIParam")); - //param.put("alias" , ((Boolean)(observable.get("isInternal"))).booleanValue()?observable.get("sie"):observable.get("tokenName")); - param.put("alias" , observable.get("sie")); - - param.put("keyfilepw" , _passwd.getText()); - observable.put("keyPasswd", _passwd.getText()); - - - Enumeration cgiParam = param.keys(); - while (cgiParam.hasMoreElements()) { - String key = (String)(cgiParam.nextElement()); - taskInfo.put(key, param.get(key)); - } - - Response response = null; - - try { - response = taskInfo.exec(taskInfo.SEC_GCRT); - taskInfo.clear(); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - hide = false; - } - - if (!(response.hasCert())) { - //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0))); - StatusPane statusPane = (StatusPane)(observable.get("statusPane")); - statusPane.setMessage( (Message) - (taskInfo.getResponse().getMessages(). - elementAt(0))); - statusPane.setShow(true); - modified = true; - } else { - observable.put("CertReq", - ((Message)(response.getMessages().elementAt(0)) - ).getExtraMessage()); - observable.put("CertReqModified", new Boolean(false)); - modified = false; - - //Need this inorder to know if a new request has been issued, so - //request via url can execute again - observable.put("newCertReq", new Boolean(true)); - } - - - } - return hide; - } - - class KeyActionListener implements KeyListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - if (_passwd.getText().length() > 0) { - control.setCanGoForward(true); - } else { - control.setCanGoForward(false); - } - modified = true; - } - } - - private JPanel getPasswdPane() { - JPanel passwdPane = new JPanel(); - passwdPane.setLayout(new GridBagLayout()); - int y = 0; - - - GridBagUtil.constrain(passwdPane, _tokenLabel, 0, ++y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, _selectedToken, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, _passwdLabel, 0, ++y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - _passwd.addKeyListener(new KeyActionListener()); - GridBagUtil.constrain(passwdPane, _passwd, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - - return passwdPane; - } - - public CertRequestEnterPasswordPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - _passwdLabel = new JLabel( - resource.getString("CertRequestEnterPasswordPane", - "passwdLabel"), JLabel.RIGHT); - _tokenLabel = new JLabel( - resource.getString("CertRequestEnterPasswordPane", - "tokenLabel"), JLabel.RIGHT); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertRequestEnterPasswordPane", "title"))); - - int y = 0; - - - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("CertRequestEnterPasswordPane", - "explain")), 0, ++y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, getPasswdPane(), 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().setLayout(new BorderLayout()); - f.getContentPane().add("Center", new CertRequestEnterPasswordPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java deleted file mode 100644 index 0bc25ea1a..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestInfoPane.java +++ /dev/null @@ -1,403 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CertRequestInfoPane extends JPanel implements SuiConstants, -IKeyCertPage { - - boolean modified = false; - - JTextField name = new JTextField(); - JTextField phone = new JTextField(); - SingleByteTextField dn = new SingleByteTextField(); - SingleByteTextField email = new SingleByteTextField(); - JTextField o = new JTextField(); - JTextField ou = new JTextField(); - JTextField l = new JTextField(); - JComboBox st; - JComboBox c; - - - JLabel _nameLabel; - JLabel _phoneLabel; - JLabel _dnLabel; - JLabel _emailLabel; - JLabel _oLabel; - JLabel _ouLabel; - JLabel _lLabel; - JLabel _stLabel; - JLabel _cLabel; - JLabel _requiredLabel; - - JLabel _dnExample; - - IWizardControl control; - - ResourceSet resource; - - JPanel statePanel = new JPanel(); - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - boolean show = - ((Boolean)(observable.get("requestCert"))).booleanValue(); - - if (show) { - control = (IWizardControl)(observable.get("Wizard")); - setEnableNextButton(); - } - return show; - } - - public boolean pageHide(WizardObservable observable) { - - KeyCertTaskInfo taskInfo = observable.getTaskInfo(); - - if (modified) { - observable.put("CertReqModified", new Boolean(true)); - - Hashtable param = (Hashtable)(observable.get("CertReqCGIParam")); - param.put("requestor_name", name.getText()); - param.put("telephone" , phone.getText()); - param.put("common_name" , dn.getText()); - param.put("email_address" , email.getText()); - param.put("organization" , o.getText()); - param.put("org_unit" , ou.getText()); - param.put("locality" , l.getText()); - param.put("state" , - st.getSelectedItem() == null ? "": - st.getSelectedItem()); - param.put("country" , - ((String)(c.getSelectedItem())).substring(0, 2)); - param.put("tokenName" , observable.get("tokenName")); - } - - return true; - } - - void setEnableNextButton() { - if ((name.getText().length() == 0) || - (dn.getText().length() == 0) || - (phone.getText().length() == 0) || - (email.getText().length() == 0) || - (o.getText().length() == 0) || - (((String)(c.getSelectedItem())).length() < 2) || - (dn.getText().indexOf(".") == -1)) { - control.setCanGoForward(false); - } else { - control.setCanGoForward(true); - } - } - - class InfoPaneActionListener implements ActionListener, KeyListener, FocusListener{ - public void actionPerformed(ActionEvent e) { - modified = true; - setEnableNextButton(); - - if (e.getSource() == c) { - setupState(c.getSelectedItem().toString()); - } - } - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - modified = true; - setEnableNextButton(); - - if (e.getSource() == c) { - setupState(c.getSelectedItem().toString()); - } - } - - public void focusGained(FocusEvent e) {} - public void focusLost(FocusEvent e) { - if (!(e.isTemporary()) && (e.getComponent() == dn) && - (dn.getText().indexOf(".") == -1)) { - JOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - resource.getString("CertRequestInfoPane", "invalidFQDN"), - resource.getString("CertRequestInfoPane", - "invalidFQDNDialogTitle"), - JOptionPane.ERROR_MESSAGE); - control.setCanGoForward(false); - } - } - } - - private JLabel rightAlignLabel(String label) { - return new JLabel(label, JLabel.RIGHT); - } - - private JPanel getInfoPane() { - JPanel infoPane = new JPanel(); - infoPane.setLayout(new GridBagLayout()); - - InfoPaneActionListener listener = new InfoPaneActionListener(); - name.addActionListener(listener); - phone.addActionListener(listener); - dn.addActionListener(listener); - email.addActionListener(listener); - o.addActionListener(listener); - ou.addActionListener(listener); - l.addActionListener(listener); - st.addActionListener(listener); - c.addActionListener(listener); - - name.addKeyListener(listener); - phone.addKeyListener(listener); - dn.addKeyListener(listener); - email.addKeyListener(listener); - o.addKeyListener(listener); - ou.addKeyListener(listener); - l.addKeyListener(listener); - st.addKeyListener(listener); - c.addKeyListener(listener); - - dn.addFocusListener(listener); - - st.setEditable(true); - c.setEditable(true); - - - - int y = 0; - - GridBagUtil.constrain(infoPane, _nameLabel, 0, y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, name, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _phoneLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, phone, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _dnLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, 0, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, dn, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - GridBagUtil.constrain(infoPane, _dnExample, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, _emailLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, email, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _oLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, o, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _ouLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, ou, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _lLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, l, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _stLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - - GridBagUtil.constrain(infoPane, statePanel/*st*/, 1, y, 1, 1, - 0.0, 0.0, GridBagConstraints.EAST, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _cLabel, 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, DIFFERENT_COMPONENT_SPACE); - - GridBagUtil.constrain(infoPane, c, 1, y, 1, 1, 0.0, 0.0, - GridBagConstraints.EAST, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(infoPane, _requiredLabel, 1, ++y, 1, 1, - 1.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, - DIFFERENT_COMPONENT_SPACE); - - - return infoPane; - } - - private void setupState(String country) { - String stList; - statePanel.remove(st); - try { - stList = resource.getString("CertRequestInfoPane", - "state-"+country.substring(0, 2).toUpperCase()); - if (stList != null && !(stList.equals(""))) { - - StringTokenizer stateTokens = - new StringTokenizer(stList, ",", false); - Vector states = new Vector(); - while (stateTokens.hasMoreTokens()) { - states.addElement(stateTokens.nextToken()); - } - //this will make it load faster. - //It will do some extra work if we call addItem() one at a time - - st = new JComboBox(states); - } - else { - st.removeAllItems(); - } - } - catch (Exception e) { - st.removeAllItems(); - } - - GridBagUtil.constrain(statePanel, st, 0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - statePanel.validate(); - statePanel.repaint(); - - try { - st.setSelectedItem( resource.getString("CertRequestInfoPane", - "defaultState-"+ - country.substring(0, 1).toUpperCase())); - } catch (Exception e) {} - - } - - public CertRequestInfoPane() { - super(); - setLayout(new GridBagLayout()); - statePanel.setLayout(new GridBagLayout()); - - resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - _nameLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "nameLabel")); - _phoneLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "phoneLabel")); - _dnLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "dnLabel")); - _emailLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "emailLabel")); - _oLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "oLabel")); - _ouLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "ouLabel")); - _lLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "lLabel")); - _stLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "stLabel")); - _cLabel = rightAlignLabel( - resource.getString("CertRequestInfoPane", "cLabel")); - - - _dnExample = rightAlignLabel( - resource.getString("CertRequestInfoPane", "dnExample")); - - _requiredLabel = - new JLabel(resource.getString("CertRequestInfoPane", "requiredLabel")); - - - String cList = resource.getString("CertRequestInfoPane", "country"); - StringTokenizer countryTokens = - new StringTokenizer(cList, ",", false); - Vector countries = new Vector(); - while (countryTokens.hasMoreTokens()) { - countries.addElement(countryTokens.nextToken()); - } - - st = new JComboBox(); - c = new JComboBox(countries); - - try { - c.setSelectedItem( - resource.getString("CertRequestInfoPane", "defaultCountry")); - } catch (Exception e) {} - - setupState(c.getSelectedItem().toString()); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertRequestInfoPane", "title"))); - - int y = 0; - - GridBagUtil.constrain(this, getInfoPane(), 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertRequestInfoPane()); - f.setSize(400,400); - //f.pack(); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java deleted file mode 100644 index cab38e8d3..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestSelectTokenPane.java +++ /dev/null @@ -1,302 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * - * Prompt user to see which token they want to use, and weather or not - * certificate has been installed or not. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -class CertRequestSelectTokenPane extends JPanel implements SuiConstants, -IKeyCertPage { - - JComboBox tokenSelection = new JComboBox(); - JRadioButton _no; - JRadioButton _yes; - JRadioButton _noneed; - - String _defaultToken; - String _internal; - - /** - * Determain whether a cgi need to be call again - */ - boolean modified = true; - - - /** - * Get the panel that is going to be displayed - * @return a panel to be displayed by the key & cert wizard - */ - public JPanel getPanel() { - return this; - } - - /** - * Checks if this panel can be shown - * @return true if this page can be shown - */ - public boolean pageShow(WizardObservable observable) { - //might have to call cgi that loadmodule... - observable.put("sie", - KeyCertUtility.createTokenName( - observable.getConsoleInfo())); - - if (tokenSelection.getItemCount() == 0) { - observable.put("createTrust" , new Boolean(true)); - - KeyCertTaskInfo taskInfo = observable.getTaskInfo(); - taskInfo.put("sie", observable.get("sie")); - - try { - taskInfo.exec(taskInfo.SEC_LSTOKEN); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - return true; - } - - Vector cipherList = taskInfo.getResponse().getFamilyList(); - for (int i = 0; i < cipherList.size(); i++) { - CipherEntry cipher = (CipherEntry)(cipherList.elementAt(i)); - JComboBox tokenNames = cipher.getTokenComboBox(); - for (int j = 0; j < cipher.getTokenCount(); j++) { - tokenSelection.addItem(tokenNames.getItemAt(j)); - } - if (tokenSelection.getItemCount() > 0) { - observable.put("createTrust" , new Boolean(false)); - } - } - - - boolean noDefaultToken = true; - for (int i = tokenSelection.getItemCount() - 1; i >= 0; i--) { - if (tokenSelection.getItemAt(i).equals(_defaultToken)) { - noDefaultToken = false; - } - } - if (noDefaultToken) { - tokenSelection.addItem(_defaultToken); - observable.put("createTrust" , new Boolean(true)); - } - - try { - tokenSelection.setSelectedIndex(0); - } catch (Exception e) {} - } - - return true; - } - - - /** - * Checks if this panel can be hidden - * @return true if this page can be hide - */ - public boolean pageHide(WizardObservable observable) { - /*observable.put("isInternal" , ((TOGGLEPANEeditor)(questionPane.getCtrlByName("isInternal"))).getValue());*/ - - try { - observable.put("isInternal" , new Boolean(true)); - if (!(((String)(tokenSelection.getSelectedItem())). - toLowerCase()).startsWith(_internal.toLowerCase())) { - observable.put("isInternal" , new Boolean(false)); - } - } catch (Exception e) {} - if (modified) { - observable.put("CertReqModified", new Boolean(true)); - observable.put("tokenName" , tokenSelection.getSelectedItem()); - observable.put("requestCert" , new Boolean(_no.isSelected())); - observable.put("installCert" , - new Boolean(!(_noneed.isSelected()))); - observable.put("noneed" , new Boolean(_noneed.isSelected())); - modified = false; - } - - return true; - } - - /** - * Listen to changes to determain if cgi need to be called again - * - */ - class ModifiedActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - modified = true; - } - } - - - - /** - * - * Convinent method for create a numbered component: - * [panel] - * 1. bla bla bla - * 2. bla bla bla - * [panel] - * - */ - private void addNumberedComponent(JPanel p, int count, Component c, - Vector components) { - //JPanel entry = new JPanel(); - //entry.setLayout(new GridBagLayout()); - GridBagUtil.constrain(p, - Box.createRigidArea( - new Dimension(SEPARATED_COMPONENT_SPACE, 0)), 0, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - GridBagUtil.constrain(p, - new JLabel(Integer.toString(count) + ". "), 1, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - - for (int i = 0; i < components.size(); i++) { - GridBagUtil.constrain(p, - (Component)(components.elementAt(i)), 2, - count + i, 1, 1, 1.0, 0.0, - GridBagConstraints.WEST, GridBagConstraints.NONE, - 0, 0, 0, 0); - } - - //p.add(entry); - } - - /** - * - * Create a token selection panel for Key & Cert wizard. - * - */ - public CertRequestSelectTokenPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - _internal = resource.getString("SelectToken", "internal"); - _defaultToken = resource.getString("SelectToken", "defaultToken"); - - _no = new JRadioButton(resource.getString("SelectToken", "no"), - true); - _yes = new JRadioButton(resource.getString("SelectToken", "yes"), - false); - _noneed = - new JRadioButton(resource.getString("SelectToken", "noNeed"), - false); - - JLabel useExt_noneed = - new JLabel(resource.getString("SelectToken", "noNeed_ext")); - Insets b = _noneed.getMargin(); - useExt_noneed.setBorder( new EmptyBorder( new Insets(0, - 12 + b.right + _noneed.getHorizontalTextPosition(), - b.bottom, b.right))); - - - - ModifiedActionListener listener = new ModifiedActionListener(); - _no.addActionListener(listener); - _yes.addActionListener(listener); - _noneed.addActionListener(listener); - tokenSelection.addActionListener(listener); - - - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(_no); - buttonGroup.add(_yes); - buttonGroup.add(_noneed); - - - int y = 0; - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("SelectToken", "title"))); - - - JPanel tokenSelectPane = new JPanel(); - //tokenSelectPane.setLayout(new BoxLayout(tokenSelectPane, BoxLayout.Y_AXIS)); - tokenSelectPane.setLayout(new GridBagLayout()); - - JLabel _pickToken = - new JLabel(resource.getString("SelectToken", "pickToken")); - Vector components = new Vector(); - components.addElement(tokenSelection); - addNumberedComponent(tokenSelectPane, ++y, _pickToken, components); - GridBagUtil.constrain(this, tokenSelectPane, 0, y, 1, 1, 0.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - - JPanel certInstPane = new JPanel(); - //certInstPane.setLayout(new BoxLayout(certInstPane, BoxLayout.Y_AXIS)); - certInstPane.setLayout(new GridBagLayout()); - - components = new Vector(); - components.addElement(_no); - components.addElement(_yes); - //need a radio button that can wrap the string. - components.addElement(_noneed); - components.addElement(useExt_noneed); - addNumberedComponent(certInstPane, ++y, - new MultilineLabel( - resource.getString("SelectToken", "certReadyForInst")), - components); - GridBagUtil.constrain(this, certInstPane, 0, y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - CertRequestSelectTokenPane c = new CertRequestSelectTokenPane(); - f.getContentPane().add("North",c ); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java deleted file mode 100644 index cc36771a6..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CertRequestTypePane.java +++ /dev/null @@ -1,390 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * - * Step 2 of the certificate request under Key & Cert wizard. - * Pompt user to enter which type of certificate they want to request - * and the email address of the CA the request will be sent to. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -class CertRequestTypePane extends JPanel implements SuiConstants, -IKeyCertPage { - - JRadioButton _email; - SingleByteTextField _emailAddr = new SingleByteTextField(); - JRadioButton _url; - SingleByteTextField _urlAddr = new SingleByteTextField(); - - JLabel _caEmailAddr; - - JRadioButton _new; - JRadioButton _renew; - - /** - * Get the panel that is going to be displayed - * @return a panel to be displayed by the key & cert wizard - */ - IWizardControl control; - JButton _caButton; - - MultilineLabel _showCALabel; - - /** - * Determain whether a cgi need to be call again to decode - */ - boolean modified = false; - - public static Hashtable param = new Hashtable(); - - /** - * Get the panel that is going to be displayed - * @return a panel to be displayed by the key & cert wizard - */ - public JPanel getPanel() { - return this; - } - - - /** - * Checks if this panel can be shown - * @return true if this page can be shown - */ - public boolean pageShow(WizardObservable observable) { - - boolean show = - ((Boolean)(observable.get("requestCert"))).booleanValue(); - - if (show) { - control = (IWizardControl)(observable.get("Wizard")); - setEnableNextButton(); - } - - if (observable.get("CertReqCGIParam") == null) { - observable.put("CertReqCGIParam", param); - } - - return show; - } - - - /** - * Checks if this panel can be hidden - * @return true if this page can be hide - */ - public boolean pageHide(WizardObservable observable) { - KeyCertTaskInfo taskInfo = observable.getTaskInfo(); - - //see if this page has been modified. - if (modified) { - observable.put("CertReqModified", new Boolean(true)); - - //radio button in a group will called twice one for the component that is loosing the focus - //and one for the component that is getting the focus - param.put("cert_type" , _new.isSelected() ? "0":"1"); - - //remove url support - param.put("xmt_select" , _email.isSelected() ? "0":"1"); - param.put("url" , _urlAddr.getText()); - param.put("cert_auth" , _emailAddr.getText()); - - //support only e-mail at this moment - //param.put("xmt_select" , "0"); - //param.put("cert_auth" , _emailAddr.getText()); - - modified = false; - } - - return true; - } - - - /** - * Listen to changes (key strokes or change in text area or text field) - * then determain (call setEnableNextButton()) if wizard can proceed - */ - class TypeActionListener implements KeyListener, ActionListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - setEnableNextButton(); - modified = true; - } - public void actionPerformed(ActionEvent e) { - - if (e.getActionCommand().equals("SHOWCA")) { - Browser browser = new Browser(); - browser.open("https://certs.netscape.com/server.html", - browser.NEW_WINDOW); - } else { - if (_email.isSelected()) { - _urlAddr.setEnabled(false); - _emailAddr.setEnabled(true); - } else { - _urlAddr.setEnabled(true); - _emailAddr.setEnabled(false); - } - setEnableNextButton(); - modified = true; - } - } - } - - /** - * Detarmain all the require field has been fill in, if true the - * enable the "Next >" button. - */ - void setEnableNextButton() { - if ((_email.isSelected() && (_emailAddr.getText().length() > 0)) || - (_url.isSelected() && (_urlAddr.getText().length() > 0))) { - control.setCanGoForward(true); - } else { - control.setCanGoForward(false); - } - } - - /** - * - * Convinent method for create a numbered component: - * [panel] - * 1. bla bla bla - * 2. bla bla bla - * [panel] - * - */ - private void addNumberedComponent(JPanel p, int count, Component c, - Vector components) { - //JPanel entry = new JPanel(); - //entry.setLayout(new GridBagLayout()); - GridBagUtil.constrain(p, - Box.createRigidArea( - new Dimension(DIFFERENT_COMPONENT_SPACE, 0)), 0, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - - GridBagUtil.constrain(p, - new JLabel(Integer.toString(count) + ". "), 1, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - - GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - for (int i = 0; i < components.size(); i++) { - GridBagUtil.constrain(p, - (Component)(components.elementAt(i)), 2, - count + i, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - 0, 0, 0, 0); - } - - //p.add(entry); - } - - - - TypeActionListener listener = new TypeActionListener(); - - - /** - * Prompt user to enter e-mail address of the CA where the - * cert request will submit. - * - * Comment out submit by url, will not support in 4.0 but will - * after 4.1 with agree upon standard between kingpin and cert - * server. - * - */ - private JPanel getRequestViaPane() { - JPanel requestViaPane = new JPanel(); - requestViaPane.setLayout(new GridBagLayout()); - - ButtonGroup buttonTypeGroup = new ButtonGroup(); - buttonTypeGroup.add(_new); - buttonTypeGroup.add(_renew); - - ButtonGroup buttonViaGroup = new ButtonGroup(); - buttonViaGroup.add(_email); - buttonViaGroup.add(_url); - - int y = 0; - - _email.addActionListener(listener); - GridBagUtil.constrain(requestViaPane, _email, 0, y, 1, 1, 0.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - /*GridBagUtil.constrain(requestViaPane, _caEmailAddr, - 0, y, 1, 1, - 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - 0, 0, COMPONENT_SPACE, 0);*/ - - _emailAddr.addKeyListener(listener); - GridBagUtil.constrain(requestViaPane, _emailAddr, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, - DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0); - - _url.addActionListener(listener); - GridBagUtil.constrain(requestViaPane, _url, 0, ++y, 1, 1, 0.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - _urlAddr.addKeyListener(listener); - GridBagUtil.constrain(requestViaPane, _urlAddr, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, - DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0); - _urlAddr.setEnabled(false); - - return requestViaPane; - } - - - - /** - * - * return a panel contain a button which if clicked will lunch browser - * and connect to netscape's cert server site. - * The site contain links and information regarding CAs and certificate. - * - */ - private JPanel getCAButtonPane() { - JPanel caButtonPane = new JPanel(); - caButtonPane.setLayout(new GridBagLayout()); - - GridBagUtil.constrain(caButtonPane, _showCALabel, 0, 0, 1, 1, - 1.0, 0.0, GridBagConstraints.WEST, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - _caButton.addActionListener(listener); - _caButton.setActionCommand("SHOWCA"); - GridBagUtil.constrain(caButtonPane, _caButton, 1, 0, 1, 1, 1.0, - 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, - 0, DIFFERENT_COMPONENT_SPACE, COMPONENT_SPACE, 0); - - return caButtonPane; - } - - /** - * - * Create a certificate request type selection pane for key & cert wizard - * - * - */ - public CertRequestTypePane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - _caButton = JButtonFactory.create( - resource.getString("CertRequestTypePane", "showCAButtonLabel")); - _email = new JRadioButton( resource.getString("CertRequestTypePane", - "emailLabel"), true); - _url = new JRadioButton( - resource.getString("CertRequestTypePane", "urlLabel"), - false); - _new = new JRadioButton( resource.getString("CertRequestTypePane", - "newcertLabel"), true); - _renew = new JRadioButton( resource.getString("CertRequestTypePane", - "renewcertLabel"), false); - - _caEmailAddr = - new JLabel(resource.getString("CertRequestTypePane", "caEmailLabel")); - - _showCALabel = new MultilineLabel( - resource.getString("CertRequestTypePane", "showCALabel")); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CertRequestTypePane", "title"))); - - int y = 0; - - JPanel requestTypePane = new JPanel(); - //requestTypePane.setLayout(new BoxLayout(requestTypePane, BoxLayout.Y_AXIS)); - requestTypePane.setLayout(new GridBagLayout()); - Vector components = new Vector(); - _new.addActionListener(listener); - _renew.addActionListener(listener); - components.addElement(_new); - components.addElement(_renew); - addNumberedComponent(requestTypePane, ++y, - new MultilineLabel( - resource.getString("CertRequestTypePane", - "requestType")), components); - GridBagUtil.constrain(this, requestTypePane, 0, y, 1, 1, 0.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - JPanel requestViaPane = new JPanel(); - //requestViaPane.setLayout(new BoxLayout(requestViaPane, BoxLayout.Y_AXIS)); - requestViaPane.setLayout(new GridBagLayout()); - components = new Vector(); - components.addElement(getRequestViaPane()); - addNumberedComponent(requestViaPane, ++y, - new MultilineLabel( - resource.getString("CertRequestTypePane", - "requestVia")), components); - //addNumberedComponent(requestViaPane, ++y, new MultilineLabel(resource.getString("CertRequestTypePane", "requestViaEmail")), components); - GridBagUtil.constrain(this, requestViaPane, 0, y, 1, 1, 0.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, getCAButtonPane(), 0, ++y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CertRequestTypePane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java deleted file mode 100644 index f939dfc89..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/ChangeKeyPasswordDialog.java +++ /dev/null @@ -1,175 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; -import javax.swing.*; -import java.awt.*; - -/** - * - * Change A Key Pair File Password - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class ChangeKeyPasswordDialog extends AbstractDialog { - - KeyCertTaskInfo taskInfo; - ConsoleInfo _consoleInfo; - - String oldPasswdLabel; - String newPasswdLabel; - String confirmPasswdLabel; - - //create password field with default width of 20 characters - SingleBytePasswordField oldPasswd = new SingleBytePasswordField(20); - SingleBytePasswordField newPasswd = new SingleBytePasswordField(20); - SingleBytePasswordField confirmPasswd = new SingleBytePasswordField(20); - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.ChangeKeyPasswordDialogResource"); - - /** - * Called when OK button is pressed, and start the password change process - * - */ - protected void okInvoked() { - - taskInfo = new KeyCertTaskInfo(_consoleInfo); - taskInfo.clear(); - taskInfo.put("sie", KeyCertUtility.createTokenName(_consoleInfo)); - taskInfo.put("oldkfpw", oldPasswd.getText()); - taskInfo.put("keyfilepw", newPasswd.getText()); - taskInfo.put("keyfilepwv", confirmPasswd.getText()); - - if (!KeyCertUtility.validPassword(newPasswd.getText(), - confirmPasswd.getText(), _consoleInfo)) { - return; - } - Response response = null; - try { - response = taskInfo.exec(taskInfo.SEC_CHANGEPW); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - return; - } - - try { - MessageDialog.messageDialog( - (Message)(response.getMessages().elementAt(0))); - } catch (Exception ex) {} - - if (((Message)(response.getMessages().elementAt(0))).getStatus() - == Message.NMC_SUCCESS) - super.okInvoked(); - } - - /** - * Called when HELP button is pressed, invoke online help - */ - protected void helpInvoked() { - Help help = new Help(resource); - help.help("ChangeKeyPasswordDialog", "help"); - } - - - private JLabel createRightAlignLabel(String label) { - return new JLabel(label, JLabel.RIGHT); - } - - private JPanel getPasswdPane() { - JPanel passwdPane = new JPanel(); - passwdPane.setLayout(new GridBagLayout()); - int y = 0; - - GridBagUtil.constrain(passwdPane, - createRightAlignLabel( - resource.getString("ChangeKeyPasswordDialog", - "oldPasswdLabel")), 0, y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - SEPARATED_COMPONENT_SPACE, 0, COMPONENT_SPACE, - COMPONENT_SPACE); - - GridBagUtil.constrain(passwdPane, oldPasswd, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, SEPARATED_COMPONENT_SPACE, 0, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, - createRightAlignLabel( - resource.getString("ChangeKeyPasswordDialog", - "newPasswdLabel")), 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, COMPONENT_SPACE); - - GridBagUtil.constrain(passwdPane, newPasswd, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, - createRightAlignLabel( - resource.getString("ChangeKeyPasswordDialog", - "confirmPasswdLabel")), 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, COMPONENT_SPACE); - - GridBagUtil.constrain(passwdPane, confirmPasswd, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - return passwdPane; - } - - - /** - * Create a dialog with 3 password field, for changing - * trust db password. - * - * @param consoleInfo Console information - * - */ - public ChangeKeyPasswordDialog(ConsoleInfo consoleInfo) { - super(null, "", true, OK | CANCEL | HELP); - - _consoleInfo = consoleInfo; - - JPanel pane = new JPanel(); - pane.setLayout(new BorderLayout()); - - //add some space between the explain text and the password prompt - //pane.add(Box.createRigidArea(new Dimension(0, SEPARATED_COMPONENT_SPACE))); - - //add the password pane - pane.add("Center", getPasswdPane()); - - getContentPane().add(pane); - setTitle(resource.getString("ChangeKeyPasswordDialog", "explainText")); - - pack(); - show(); - } - - /*public static void main(String arg[]) { - ChangeKeyPasswordDialog c = (new ChangeKeyPasswordDialog(new ConsoleInfo())); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java deleted file mode 100644 index 52f23ad4b..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherEntry.java +++ /dev/null @@ -1,190 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.*; -import javax.swing.*; -import java.awt.event.*; -import com.netscape.management.client.util.*; - -class CipherEntry { - private JCheckBox _cipherEnable; - private JComboBox _tokenList; - private JComboBox _certList; - - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.EncryptionPaneResource"); - - private Hashtable _tokenCertList; - public CipherEntry(String cipherName, Hashtable tokenCertList) { - _cipherEnable = new JCheckBox(cipherName); - - Vector tokenList = new Vector(); - Enumeration tokens = tokenCertList.keys(); - while (tokens.hasMoreElements()) { - tokenList.addElement(tokens.nextElement()); - } - - if (tokenList.size() == 0) { - tokenList.addElement(resource.getString("CipherEntry", "noToken")); - } - - _tokenList = new JComboBox(tokenList); - _tokenCertList = tokenCertList; - _tokenList.addItemListener(new TokenListListener()); - - _certList = new JComboBox(); - - try { - _tokenList.setSelectedIndex(0); - } catch (Exception e) {} - - } - - - public int getTokenCount() { - return _tokenCertList.size(); - } - - class TokenListListener implements ItemListener { - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == e.SELECTED) { - //code here to swap in/out cert list - _certList.removeAllItems(); - _certList.setEditable(false); - if (_tokenCertList.get(e.getItem()) != null) { - Vector certList = - (Vector)(_tokenCertList.get(e.getItem())); - if (certList.size() != 0) { - if (((String)(certList.elementAt(0))). - toLowerCase().indexOf("unknown") != -1) { - _certList.addItem( - resource.getString("CipherEntry", "enterCert")); - _certList.setEditable(true); - } else { - for (int i = 0; i < certList.size(); i++) { - _certList.addItem(certList.elementAt(i)); - } - } - } else { - _certList.addItem( - resource.getString("CipherEntry", "noCert")); - } - } else { - _certList.addItem( - resource.getString("CipherEntry", "noCert")); - } - try { - _certList.setSelectedIndex(0); - _certList.validate(); - _certList.repaint(); - } catch (Exception exception) {} - } - } - } - - public JCheckBox getCipherCheckBox() { - return _cipherEnable; - } - public JComboBox getTokenComboBox() { - return _tokenList; - } - public JComboBox getCertComboBox() { - return _certList; - } - public String getCipherName() { - return _cipherEnable.getText(); - } - - public String getSelectedToken() { - String selected = (String)(_tokenList.getSelectedItem()); - if (selected.equalsIgnoreCase( - resource.getString("CipherEntry", "noToken"))) { - selected = ""; - } - return selected; - } - - public String getSelectedCertName() { - String selected = (String)(_certList.getSelectedItem()); - if (selected == null || selected.equalsIgnoreCase( - resource.getString("CipherEntry", "noCert")) || - selected.equalsIgnoreCase( - resource.getString("CipherEntry", "enterCert"))) { - selected = ""; - } - - return selected; - } - - public boolean isEnabled() { - return _cipherEnable.isSelected(); - } - - public void setSelectedToken(String token) { - _tokenList.setSelectedItem(token); - } - - public void setSelectedCert(String cert) { - //if (_certList.getModel().contains(java.lang.Object elem) ) { - _certList.setSelectedItem(cert); - //} - } - - public void setSelected(boolean enabled) { - _cipherEnable.setSelected(enabled); - } - - public void setEnabledAll(boolean enabled) { - _cipherEnable.setEnabled(enabled); - _tokenList.setEnabled(enabled); - _certList.setEnabled(enabled); - } - - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - - Hashtable h = new Hashtable(); - Vector v1 = new Vector(); - Vector v2 = new Vector(); - v1.addElement("v1.1"); - v1.addElement("v1.2"); - v1.addElement("v1.3"); - v1.addElement("v1.4"); - v2.addElement("v2.1"); - v2.addElement("v2.2"); - v2.addElement("v2.3"); - v2.addElement("v2.4"); - h.put("v1", v1); - h.put("v2", v2); - - CipherEntry my = new CipherEntry("my", h); - - JPanel p = new JPanel(); - p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); - p.add(my.getCipherCheckBox()); - p.add(my.getTokenComboBox()); - p.add(my.getCertComboBox()); - - f.getContentPane().add(p); - f.setSize(400,400); - f.show(); - }*/ -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java deleted file mode 100644 index 8a3564de0..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherPreferenceDialog.java +++ /dev/null @@ -1,332 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import javax.swing.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -/** - * General dialog which display the ciper preference. - * - * @author <a href=mailto:shihcm@netscape.com>Chih Ming Shih</a> - * @version 0.2 9/3/97 - */ - -public class CipherPreferenceDialog extends AbstractDialog implements ICipherConstants { - SSL2CipherPreference ssl2CipherPref = null; - SSL3CipherPreference ssl3CipherPref = null; - - /**SSL Version 2*/ - public final static int SSL2 = 1; - /**SSL Version 3*/ - public final static int SSL3 = 2; - - private JPanel cipherPreferencePane; - - boolean modified = true; - Help help; - - - /** - * Constructor, ciphers will default to SSL2 and SSL3 - * - * @param parent The owner of the dialog - * @param isDomestic Software built domestic(allow stonger cipher) or export use - * - */ - public CipherPreferenceDialog(JFrame parent, boolean isDomestic) { - this(parent, isDomestic, false); - } - - /** - * Constructor, ciphers will default to SSL2 and SSL3 - * - * @param parent The owner of the dialog - * @param isDomestic Software built domestic(allow stonger cipher) or export use - * @param hasFortezza Fortezza enabled server - * - */ - public CipherPreferenceDialog(JFrame parent, boolean isDomestic, - boolean hasFortezza) { - this(parent, isDomestic, hasFortezza, SSL2 | SSL3); - } - - - /** - * Constructor - * - * @param parent The owner of the dialog - * @param isDomestic Software built domestic(allow stonger cipher) or export use - * @param hasFortezza Fortezza enabled server - * @param SSLVersion SSL version ciphers to display, SSL2 and/or SSL3 - * - */ - public CipherPreferenceDialog(JFrame parent, boolean isDomestic, - boolean hasFortezza, int SSLVersion) { - super(parent, "", true, OK | CANCEL | HELP); - - ResourceSet r = new CipherResourceSet(); - help = new Help(r); - - - cipherPreferencePane = new JPanel(); - cipherPreferencePane.setLayout( - new BoxLayout(cipherPreferencePane, BoxLayout.Y_AXIS)); - if ((SSL2 & SSLVersion) == SSL2) { - ssl2CipherPref = new SSL2CipherPreference(isDomestic); - cipherPreferencePane.add(ssl2CipherPref); - } - - if ((SSL3 & SSLVersion) == SSL3) { - ssl3CipherPref = - new SSL3CipherPreference(isDomestic, hasFortezza); - cipherPreferencePane.add(ssl3CipherPref); - } - - cipherPreferencePane.add(Box.createRigidArea(new Dimension(0, 4))); - - getContentPane().add(cipherPreferencePane); - - pack(); - } - - /** - * Remove SSL preference pane, currently only support SSL2 and SSL3. - * Will support Fortezza if only Phaos will support it. - * - * @param sslVersion SSL version to be removed - * - */ - public void removeSSLVersion(int sslVersion) { - switch (sslVersion) { - case SSL2: - cipherPreferencePane.remove(ssl2CipherPref); - break; - case SSL3: - cipherPreferencePane.remove(ssl3CipherPref); - break; - } - pack(); - } - - /** - * Determines whether a cipher is enabled. - * @param cipher Cipher name - * - * @see #getSSLPreference - * @see #setCipherEnabled - * - * @return True if a cipher is enabled - */ - public boolean isCipherEnabled(String cipher) { - return ( ((ssl2CipherPref == null) ? false : - ssl2CipherPref.isCipherEnabled(cipher)) || - ((ssl3CipherPref == null) ? false : - ssl3CipherPref.isCipherEnabled(cipher))); - } - - /** - * Enable or disable a cipher. - * @param cipher Cipher name - * @param enable Enable the cipher - * - * @see #isCipherEnabled - * @see #getSSLPreference - */ - public void setCipherEnabled(String cipher, boolean enable) { - if (ssl2CipherPref != null) { - ssl2CipherPref.setCipherEnabled(cipher, enable); - } - if (ssl3CipherPref != null) { - ssl3CipherPref.setCipherEnabled(cipher, enable); - } - } - - /** - * Get a list of supported ciphers. - * @param sslVersion SSL version - * - * @see #isCipherEnabled - * @see #setCipherEnabled - * - * @return An array that contains the name of supported ciphers under SSL version - */ - public String[] getSSLPreference(int sslVersion) { - String[] ciphers = null; - - switch (sslVersion) { - case SSL2: - ciphers = ssl2CipherPref.getCipherList(); - break; - case SSL3: - ciphers = ssl3CipherPref.getCipherList(); - break; - default : - //programmer's fault, do nothing here - Debug.println("Cipher Preference : Invalid ssl version "+ - sslVersion); - break; - } - return ciphers; - } - - - /** - * Determines whether a cipher group(ssl version) is enabled. - * @param sslVersion SSL version - * - * @see #setSSLEnabled - * - * @return True if the speicified SSL version is enabled - */ - public boolean isSSLEnabled(int sslVersion) { - boolean enable = false; - switch (sslVersion) { - case SSL2: - enable = ssl2CipherPref.isEnabled(); - break; - case SSL3: - enable = ssl3CipherPref.isEnabled(); - break; - default: - //programmer's fault, do nothing here - Debug.println("Cipher Preference : Invalid ssl version "+ - sslVersion); - break; - } - return enable; - } - - /** - * Enable or disable a cipher group. - * @param sslVersion SSL Version - * @param enable Enable the SSL version - * - * @see #isSSLEnabled - */ - public void setSSLEnabled(int sslVersion, boolean enable) { - switch (sslVersion) { - case SSL2: - ssl2CipherPref.setEnabled(enable); - break; - case SSL3: - ssl3CipherPref.setEnabled(enable); - break; - default: - //programmer's fault, do nothing here - Debug.println("Cipher Preference : Invalid ssl version "+ - sslVersion); - break; - } - } - - - - /** - * Check weather any ciphers has been modified - * - */ - public boolean isModified() { - return modified; - } - - /** - * Reset all changes since last save - * - * @see #setSaved - */ - public void reset() { - if (ssl2CipherPref != null) { - ssl2CipherPref.reset(); - } - if (ssl3CipherPref != null) { - ssl3CipherPref.reset(); - } - } - - - - /** - * Set the state to save. - * - * @see #reset - */ - public void setSaved() { - if (ssl2CipherPref != null) { - ssl2CipherPref.setSaved(); - } - - if (ssl3CipherPref != null) { - ssl3CipherPref.setSaved(); - } - } - - /** - * Set the state to save. - * - * @see #reset - * @derprecated replaced by setSaved() - */ - public void setSaved(boolean saved) { - - if (saved) { - if (ssl2CipherPref != null) { - ssl2CipherPref.setSaved(); - } - - if (ssl3CipherPref != null) { - ssl3CipherPref.setSaved(); - } - } - } - - protected void cancelInvoked() { - reset(); - modified = false; - super.cancelInvoked(); - } - - protected void okInvoked() { - modified = (((ssl2CipherPref == null) ? false : - ssl2CipherPref.isModified()) || - ((ssl3CipherPref == null) ? false : - ssl3CipherPref.isModified())); - setSaved(); - super.okInvoked(); - } - - - protected void helpInvoked() { - help.help("SSL", "Preference"); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - - try { - UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); - SwingUtilities.updateComponentTreeUI(f.getContentPane()); - } catch (Exception e) {} - - CipherPreferenceDialog c = new CipherPreferenceDialog(f, true, false, SSL3); - - c.show(); - }*/ -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java deleted file mode 100644 index 3adf50548..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CipherResourceSet.java +++ /dev/null @@ -1,26 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.util.ResourceSet; - -class CipherResourceSet extends ResourceSet { - public CipherResourceSet() { - super("com.netscape.admin.certsrv.security.CipherResource"); - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/Comm.java b/pki/base/console/src/com/netscape/admin/certsrv/security/Comm.java deleted file mode 100644 index 1bbd022bf..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/Comm.java +++ /dev/null @@ -1,158 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.io.*; -import java.net.*; -import java.util.*; - -import com.netscape.management.client.comm.*; -import com.netscape.management.client.util.*; - -/** - * - * Extends dt's comm package to do some communication with backend. - * eventually this will be phase out, and key cert related tasks that - * require cgi call will use AdmTask.java instead of this one. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -class Comm implements CommClient, Runnable { - public static final int DEFAULT_TIMEOUT_PERIOD = 30000; // 30 seconds - public boolean finished = false; - public String value = null; - - - static String server_response = null; - - String url_cgi; - Hashtable cgi_arg; - boolean waitForResponse; - - String id = "Admin"; - String pw = "Admin"; - - Exception error = null; - - public Comm(String url_cgi, Hashtable cgi_arg, - boolean waitForResponse) { - this.url_cgi = url_cgi; - this.cgi_arg = cgi_arg; - this.waitForResponse = waitForResponse; - } - - - public void setAuth(String userName, String password) { - this.id = userName; - this.pw = password; - } - - public Exception getError() { - return error; - } - - public static String getData() { - return server_response; - } - - public void run() { - HttpManager h = new HttpManager(); - - try { - ByteArrayInputStream value = HttpChannel.encode(cgi_arg); - h.post(new URL(url_cgi), this, null, value, - value == null ? 0 : value.available(), - CommManager.FORCE_BASIC_AUTH); - awaitValue(); - } catch (InterruptedIOException timeout) { - error = timeout; - } - catch (ConnectException connectError) { - error = connectError; - } - catch (IOException ioError) { - error = ioError; - } - catch (Exception e) { - error = e; - } - } - - public synchronized void awaitValue() { - try { - wait(DEFAULT_TIMEOUT_PERIOD); - } catch (Exception e) { - error = e; - } - if (value == null) { - error = new InterruptedIOException("HTTP response timeout"); - } - } - - - public synchronized void finish() { - finished = true; - notifyAll(); - } - - public synchronized void setValue(String s) { - value = s; - - server_response = s; - - notifyAll(); - } - - public void replyHandler(InputStream response, CommRecord cr) { - try { - InputStreamReader reader = - new InputStreamReader(response, "UTF8"); - int c = reader.read(); - - if (c == 'S') { - finish(); - return; - } - String s = (char) c + ""; - - while ((c = reader.read()) != -1) { - s += (char) c + ""; - } - - setValue(s); - } catch (Exception e) { - error = e; - } - } - - public void errorHandler(Exception exception, CommRecord cr) { - error = exception; - Debug.println("errorHandler: " + exception); - finish(); - } - - public String username(Object auth, CommRecord cr) { - return id; - } - - public String password(Object auth, CommRecord cr) { - return pw; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java deleted file mode 100644 index 03b5c32d6..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/CreateTrustPane.java +++ /dev/null @@ -1,231 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class CreateTrustPane extends JPanel implements SuiConstants, IKeyCertPage { - - SingleBytePasswordField _passwd = new SingleBytePasswordField(20); - SingleBytePasswordField _confirmPasswd = - new SingleBytePasswordField(20); - JLabel _selectedToken = new JLabel(); - - JLabel _passwdLabel; - JLabel _tokenLabel; - JLabel _confirmPasswdLabel; - - IWizardControl control; - - String _noNeedToRequestInstallCert; - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - boolean show = false; - - ((StatusPane)(observable.get("statusPane"))).setShow(false); - if (((Boolean)(observable.get("createTrust"))).booleanValue()) { - show = true; - - if ((_passwd.getText().length() == 0) || - (_confirmPasswd.getText().length() == 0)) { - control = (IWizardControl)(observable.get("Wizard")); - control.setCanGoForward(false); - } - - _selectedToken.setText((String)(observable.get("sie"))); - } else if (((Boolean)(observable.get("noneed"))).booleanValue()) { - StatusPane statusPane = (StatusPane)(observable.get("statusPane")); - statusPane.setMessage(_noNeedToRequestInstallCert); - statusPane.setShow(true); - statusPane.setLastPage(true); - - ((IWizardControl)(observable.get("Wizard"))).setIsLastPage( - true); - } - - return show; - } - - public boolean pageHide(WizardObservable observable) { - boolean hide = false; - - String dbName = (String)(observable.get("sie")); - - if (!KeyCertUtility.validPassword(_passwd.getText(), - _confirmPasswd.getText(), (observable.getConsoleInfo()))) { - hide = false; - } else if ( (_passwd.getText().equals(_confirmPasswd.getText())) && - (!(dbName.equals("")))) { - KeyCertTaskInfo taskInfo = - ((WizardObservable) observable).getTaskInfo(); - taskInfo.put("alias", dbName); - taskInfo.put("keyfilepw", _confirmPasswd.getText()); - observable.put("keyPasswd", _confirmPasswd.getText()); - try { - taskInfo.exec(taskInfo.SEC_TRUST); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - e.getMessage()); - return false; - } - - - //MessageDialog.messageDialog((Message)(taskInfo.getResponse().getMessages().elementAt(0))); - StatusPane statusPane = (StatusPane)(observable.get("statusPane")); - statusPane.setMessage( (Message) - (taskInfo.getResponse().getMessages().elementAt(0))); - statusPane.setShow(true); - - if (((Message) - (taskInfo.getResponse().getMessages().elementAt(0)) - ).getStatus() == Message.NMC_SUCCESS) { - hide = true; - observable.put("createTrust", new Boolean(false)); - - if (((Boolean)(observable.get("noneed"))).booleanValue()) { - statusPane.appendMessage("\n\n"+ - _noNeedToRequestInstallCert); - statusPane.setLastPage(true); - ((IWizardControl)(observable.get("Wizard"))). - setIsLastPage(true); - } - } - } - - return hide; - } - - - class KeyActionListener implements KeyListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) { - if (_passwd.getText().length() > 0) { - control.setCanGoForward(true); - } else { - control.setCanGoForward(false); - } - } - } - - private JPanel getPasswdPane() { - JPanel passwdPane = new JPanel(); - passwdPane.setLayout(new GridBagLayout()); - int y = 0; - - - GridBagUtil.constrain(passwdPane, _tokenLabel, 0, ++y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - - GridBagUtil.constrain(passwdPane, _selectedToken, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, _passwdLabel, 0, ++y, 1, 1, - 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - _passwd.addKeyListener(new KeyActionListener()); - GridBagUtil.constrain(passwdPane, _passwd, 1, y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - GridBagUtil.constrain(passwdPane, _confirmPasswdLabel, 0, ++y, - 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, COMPONENT_SPACE, 0); - - _confirmPasswd.addKeyListener(new KeyActionListener()); - GridBagUtil.constrain(passwdPane, _confirmPasswd, 1, y, 1, 1, - 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, DIFFERENT_COMPONENT_SPACE, - COMPONENT_SPACE, 0); - - return passwdPane; - } - - public CreateTrustPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - _passwdLabel = new JLabel( - resource.getString("CreateTrustPane", "passwdLabel"), - JLabel.RIGHT); - _tokenLabel = new JLabel( - resource.getString("CreateTrustPane", "tokenLabel"), - JLabel.RIGHT); - _confirmPasswdLabel = new JLabel( - resource.getString("CreateTrustPane", "confirmPasswdLabel"), - JLabel.RIGHT); - - _noNeedToRequestInstallCert = - resource.getString("CreateTrustPane", "noNeedToRequestInstallCert"); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("CreateTrustPane", "title"))); - - int y = 0; - - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("CreateTrustPane", "explain")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, getPasswdPane(), 0, ++y, 1, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new CreateTrustPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java deleted file mode 100644 index 1a472ca76..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/EncryptionPane.java +++ /dev/null @@ -1,639 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.util.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; -import com.netscape.management.client.console.*; -import javax.swing.plaf.*; - -import java.io.*; - -/** - * - * Encryption panel used for server configuration. - * - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class EncryptionPane extends JPanel implements ActionListener { - - private JCheckBox on; - String title; - - JPanel top; - JPanel cipherPane; - - private Vector cipherList = new Vector(); - - boolean isFortezza = false; - boolean isDomestic = false; - - ConsoleInfo _consoleInfo; - String certdbName; - - JButton bCipherPref; - JButton wizardButton; - - JLabel cipherTitle; - JLabel tokenTitle; - JLabel certTitle; - - - Vector encryptionPaneListeners = new Vector(); - - EncryptionPaneActionListener actionListener = - new EncryptionPaneActionListener(); - - KeyCertTaskInfo taskInfo; - - ResourceSet resource; - - /** - * - * @deprecated implement IEncryptionPaneListener instead - */ - public void actionPerformed(ActionEvent e) { - } - - - class EncryptionPaneActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals(".doCipherSetting")) { - for (int i = 0; i < encryptionPaneListeners.size(); i++) { - ((IEncryptionPaneListener) - (encryptionPaneListeners.elementAt(i))). - showCipherPreferenceDialog(); - } - } else if (e.getActionCommand().equals("ENABLED")) { - for (int i = 0; i < encryptionPaneListeners.size(); i++) { - ((IEncryptionPaneListener) - (encryptionPaneListeners.elementAt(i))). - sslStateChanged(on.isSelected()); - } - } else { - for (int i = 0; i < encryptionPaneListeners.size(); i++) { - Object cipher = getCipher(e.getActionCommand()); - ((IEncryptionPaneListener) - (encryptionPaneListeners.elementAt(i))). - cipherStateChanged(isEnabled(cipher), - getCipherName(cipher), getToken(cipher), - getCertificateName(cipher)); - } - } - } - } - - /** - * Add a listener to the list that's notified each time a change to the selection occurs. - * - */ - public void addEncryptionPaneListener( - IEncryptionPaneListener listener) { - encryptionPaneListeners.addElement(listener); - } - - - - /** - * - * Create an encryption panel - * - * @param consoleInfo server sepcific information - */ - public EncryptionPane(ConsoleInfo consoleInfo) { - this(consoleInfo, null); - } - - /** - * - * Create an encryption panel - * - * @param consoleInfo server sepcific information - * @param addPanel add customized panel into encryption panel - */ - public EncryptionPane(ConsoleInfo consoleInfo, JPanel addPanel) { - super(); - - //actionListener - - _consoleInfo = consoleInfo; - certdbName = KeyCertUtility.createTokenName(consoleInfo); - - - setLayout(new BorderLayout()); - - //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - JPanel mainPane = new JPanel(); - //mainPane.setLayout(new BorderLayout()); - mainPane.setLayout(new GridBagLayout()); - - - resource = new ResourceSet("com.netscape.admin.certsrv.security.EncryptionPaneResource"); - - on = new JCheckBox(resource.getString("EncryptionPane", "enableSSL"), - false); - on.setActionCommand("ENABLED"); - on.addActionListener(new CipherPaneToggleListener()); - - on.addActionListener(actionListener); - - - top = new JPanel(); - top.setAlignmentX(0.0f); - top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS)); - top.add(on); - - //mainPane.setBorder(new ToggleBorder(top, SwingConstants.TOP)); - mainPane.setBorder( new CompoundBorder( - new ToggleBorder(top, SwingConstants.TOP), - new EmptyBorder(0, SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE, 0))); - - GridBagUtil.constrain(mainPane, top, 0, 0, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, - 0, 0, 0, 0); - - - cipherPane = new JPanel(); - cipherPane.setLayout(new BorderLayout()); - - GridBagUtil.constrain(mainPane, cipherPane, 0, 1, 2, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.COMPONENT_SPACE, 0); - - bCipherPref = JButtonFactory.create( - resource.getString("EncryptionPane", "cipherPrefTitle")); - wizardButton = JButtonFactory.create( - resource.getString("EncryptionPane", "wizardTitle")); - - bCipherPref.setActionCommand(".doCipherSetting"); - bCipherPref.addActionListener(this); - - bCipherPref.addActionListener(actionListener); - - wizardButton.setActionCommand("WIZARD"); - wizardButton.addActionListener(new wizardButtonActionListener()); - - - updateEncryptionUI(); - - add("North", mainPane); - - - //other pane contain server specific pane and a wizrad button. - JPanel otherPane = new JPanel(); - otherPane.setLayout(new BoxLayout(otherPane, BoxLayout.Y_AXIS)); - //otherPane.setLayout(new GridBagLayout()); - - if (addPanel != null) { - otherPane.add(addPanel); - } - - otherPane.add( Box.createRigidArea( - new Dimension(0, SuiConstants.COMPONENT_SPACE))); - - add("Center", otherPane); - - JPanel buttonPane = new JPanel(); - buttonPane.setLayout(new GridBagLayout()); - GridBagUtil.constrain(buttonPane, wizardButton, 0, 0, 1, 1, - 0.0, 0.0, GridBagConstraints.SOUTHWEST, - GridBagConstraints.NONE, 0, 0, 0, 0); - - GridBagUtil.constrain(buttonPane, Box.createHorizontalGlue(), - 1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - //add("South", wizardButton); - add("South", buttonPane); - - } - - /** - * Returns a vector containing cipher objects - * @see #getCipherCount - * @see #getCipherAt - * - * @return a vector contains cipher object as element - */ - public Vector getCipherList() { - return cipherList; - } - - - /** - * Returns the number of cipher objects in encryption pane - * - * @see #getCipherList - * @see #getCipherAt - * - * @return the number of cipher object in encryption pane - */ - public int getCipherCount() { - return cipherList.size(); - } - - /** - * Returns the cipher object at the specified index. - * - * @param index an index into cipher list. - * - * @see #getCipherList - * @see #getCipherCount - * - * @return the number of cipher object in encryption pane - */ - public Object getCipherAt(int index) { - return cipherList.elementAt(index); - } - - private CipherEntry getCipher(String cipherName) { - int count = getCipherCount(); - for (int i = count - 1; i >= 0; i--) { - Object cipher = getCipherAt(i); - if (cipherName.equals(getCipherName(cipher))) { - return ((CipherEntry) cipher); - } - } - return null; - } - - - /** - * Return cipher name - * - * @param cipher cipher object - * - * @return cipher name - */ - public String getCipherName(Object cipher) { - return ((CipherEntry) cipher).getCipherName(); - } - - - /** - * Return selected token name - * - * @param cipher cipher object - * - * @return selected token - */ - public String getToken(Object cipher) { - return ((CipherEntry) cipher).getSelectedToken(); - } - - - /** - * Set token selection. Default will be taken if no selection - * match the token user specified. - * - * @param cipher cipher object - * - */ - public void setToken(Object cipher, String token) { - ((CipherEntry) cipher).setSelectedToken(token); - } - - - - /** - * Return certificate name - * - * @param cipher cipher object - * - * @return certificate name - * - */ - public String getCertificateName(Object cipher) { - return ((CipherEntry) cipher).getSelectedCertName(); - - } - - /** - * Set the certificate field to the specified certificate name - * - * @param cipher cipher object - * @param certificateName certificate name - * - */ - public void setCertificateName(Object cipher, String certificateName) { - ((CipherEntry) cipher).setSelectedCert(certificateName); - } - - /** - * Return cipher state, true a cipher is enabled - * - * @param cipher cipher object - * - * @return true if a cipher is enabled false other wise - */ - public boolean isEnabled(Object cipher) { - return ((CipherEntry) cipher).isEnabled(); - } - - /** - * Set cipher state - * - * @param cipher cipher object - * @param on cipher state - * - */ - public void setEnabled(Object cipher, boolean on) { - ((CipherEntry) cipher).setSelected(on); - } - - - /** - * Return encryption setting - * - * @return true if SSL on/off is on. - */ - public boolean isEncryptionEnabled() { - return on.isSelected(); - //return ((Boolean)(encryptionOnOff.getValue())).booleanValue(); - } - - /** - * Set encryption on/off - * - */ - public void setEncryption(boolean on) { - setEnableAll(on); - this.on.setSelected(on); - //encryptionOnOff.setValue(new Boolean(on)); - } - - /** - * Return certificate database file name - * - * @param certificate database file name - */ - public String getCertificateDBName() { - return certdbName; - } - - /** - * A convenience function to setup an cipher. - * If no matching cipherName found in the encryption - * pane, this function will do nothing. - * - * @param on cipher state - * @param cipherName cipher name - * @param token token name - * @param personality personality name - * - * @see #setEnabled - */ - public void setCipherSetting(boolean on, String cipherName, - String token, String personality) { - int count = getCipherCount(); - for (int i = count - 1; i >= 0; i--) { - Object cipher = getCipherAt(i); - if (cipherName.equals(getCipherName(cipher))) { - setEnabled(cipher, on); - setToken(cipher, token); - setCertificateName(cipher, personality); - } - } - } - - /** - * - * @return true if fortezza is detected on the server - */ - public boolean hasFortezza() { - return isFortezza; - } - - - /** - * - * @return true if a domestic server is detected - */ - public boolean isSecurityDomestic() { - return isDomestic; - } - - /** - * - * @return encryption pane - */ - public JPanel getPanel() { - return this; - } - - - - private JLabel leftAlignLabel(String label) { - return new JLabel(label, JLabel.LEFT); - } - - private void updateCipherEntry() { - } - - - /** - * Update ui - * - */ - public void refresh() { - updateEncryptionUI(); - } - - JPanel cPane = new JPanel(); - private void updateEncryptionUI() { - cPane.removeAll(); - - cPane.setLayout(new GridBagLayout()); - - int y = 0; - - cipherTitle = - leftAlignLabel(resource.getString("EncryptionPane", "cipherTitle")); - tokenTitle = - leftAlignLabel(resource.getString("EncryptionPane", "tokenTitle")); - certTitle = - leftAlignLabel(resource.getString("EncryptionPane", "certTitle")); - - GridBagUtil.constrain(cPane, cipherTitle, 0, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, - SuiConstants.HORIZ_COMPONENT_INSET, 0, - SuiConstants.COMPONENT_SPACE, - SuiConstants.SEPARATED_COMPONENT_SPACE); - GridBagUtil.constrain(cPane, tokenTitle, 1, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, SuiConstants.COMPONENT_SPACE, - SuiConstants.SEPARATED_COMPONENT_SPACE); - GridBagUtil.constrain(cPane, certTitle, 2, y, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, SuiConstants.COMPONENT_SPACE, 0); - - taskInfo = new KeyCertTaskInfo(_consoleInfo); - taskInfo.clear(); - - taskInfo.put("sie", certdbName); - - try { - taskInfo.exec(taskInfo.SEC_LSTOKEN); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - return; - } - - cipherList = taskInfo.getResponse().getFamilyList(); - - isFortezza = taskInfo.getResponse().isSecurityFortezza(); - isDomestic = taskInfo.getResponse().isSecurityDomestic(); - - - for (int index = cipherList.size() - 1; index >= 0; index--) { - CipherEntry cipher = (CipherEntry)(cipherList.elementAt(index)); - cipher.getCipherCheckBox().addActionListener(this); - cipher.getTokenComboBox().addActionListener(this); - cipher.getCertComboBox().addActionListener(this); - - String name = cipher.getCipherCheckBox().getText(); - cipher.getCipherCheckBox().setActionCommand(name); - cipher.getTokenComboBox().setActionCommand(name); - cipher.getCertComboBox().setActionCommand(name); - - cipher.getCipherCheckBox().addActionListener(actionListener); - cipher.getTokenComboBox().addActionListener(actionListener); - cipher.getCertComboBox().addActionListener(actionListener); - - GridBagUtil.constrain(cPane, cipher.getCipherCheckBox(), 0, - ++y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE); - GridBagUtil.constrain(cPane, cipher.getTokenComboBox(), 1, - y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE); - GridBagUtil.constrain(cPane, cipher.getCertComboBox(), 2, - y, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE); - } - - GridBagUtil.constrain(cPane, bCipherPref, 1, ++y, 2, 1, 1.0, - 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, - SuiConstants.COMPONENT_SPACE); - - - setEnableAll(false); - cipherPane.add("North", cPane); - cPane.validate(); - cPane.repaint(); - } - - class wizardButtonActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("WIZARD")) { - //save the old setting - Vector oldEntry = getCipherList(); - - //lunch the wizard - KeyCertWizard wizard = new KeyCertWizard(_consoleInfo); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - //update the cipher entries - //well it is inefficient, but unless more api - //is added to wizard it self we can't tell if - //a new cert is been added or not - updateEncryptionUI(); - - //restore the setting - for (int i = oldEntry.size() - 1; i >= 0; i--) { - Object cipher = oldEntry.elementAt(i); - setCipherSetting(isEnabled(cipher), - getCipherName(cipher), getToken(cipher), - getCertificateName(cipher)); - } - - setEnableAll(isEncryptionEnabled()); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - - } - } - } - - - private void setEnableAll(boolean enable) { - int count = getCipherCount(); - for (int i = 0; i < count; i++) { - ((CipherEntry) cipherList.elementAt(i)).setEnabledAll(enable); - } - bCipherPref.setEnabled(enable); - cipherTitle.setEnabled(enable); - tokenTitle.setEnabled(enable); - certTitle.setEnabled(enable); - invalidate(); - repaint(); - } - - class CipherPaneToggleListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("ENABLED")) { - setEnableAll(on.isSelected()); - EncryptionPane.this.actionPerformed(e); - validate(); - repaint(); - } - } - } - - class ToggleBorder extends EtchedBorder { - private JComponent _switchPanel; - private int _switchAlign; - - public ToggleBorder(JComponent sp, int align) { - _switchPanel = sp; - _switchAlign = align; - } - - public void paintBorder(Component c, Graphics g, int x, int y, - int width, int height) { - Color save = g.getColor(); - - int top = y + (_switchPanel.getHeight() >> 1); - int new_height = height - top; - - BorderUIResource.getEtchedBorderUIResource().paintBorder(c, - g, x, top, width, new_height); - } - } - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java deleted file mode 100644 index 76580ecf0..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertInstallPane.java +++ /dev/null @@ -1,82 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class GuideCertInstallPane extends JPanel implements SuiConstants, -IKeyCertPage { - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - return ((Boolean)(observable.get("installCert"))).booleanValue(); - } - - public boolean pageHide(WizardObservable observable) { - return true; - } - - - public GuideCertInstallPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("GuideCertInstallPane", "title"))); - - int y = 0; - - - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("GuideCertInstallPane", "explain")), - 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SEPARATED_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new GuideCertInstallPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java deleted file mode 100644 index 51ae0959e..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCertRequestPane.java +++ /dev/null @@ -1,81 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class GuideCertRequestPane extends JPanel implements SuiConstants, -IKeyCertPage { - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - return ((Boolean)(observable.get("requestCert"))).booleanValue(); - } - - public boolean pageHide(WizardObservable observable) { - return true; - } - - - - public GuideCertRequestPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("GuideCertRequestPane", "title"))); - - int y = 0; - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("GuideCertRequestPane", "explain")), - 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SEPARATED_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new GuideCertRequestPane()); - f.setSize(400,400); - f.show(); - }*/ - -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java deleted file mode 100644 index 9eaf3607f..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideCreateTrustPane.java +++ /dev/null @@ -1,79 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class GuideCreateTrustPane extends JPanel implements SuiConstants, -IKeyCertPage { - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - return ((Boolean)(observable.get("createTrust"))).booleanValue(); - } - - public boolean pageHide(WizardObservable observable) { - return true; - } - - public GuideCreateTrustPane() { - super(); - setLayout(new GridBagLayout()); - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("GuideCreateTrustPane", "title"))); - - int y = 0; - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("GuideCreateTrustPane", "explain")), - 0, ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SEPARATED_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add("North", new GuideCreateTrustPane()); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java deleted file mode 100644 index 30bc92200..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/GuideIntroPane.java +++ /dev/null @@ -1,119 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import javax.swing.*; -import javax.swing.border.*; -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class GuideIntroPane extends JPanel implements SuiConstants, IKeyCertPage { - - public JPanel getPanel() { - return this; - } - - public boolean pageShow(WizardObservable observable) { - return true; - } - - public boolean pageHide(WizardObservable observable) { - return true; - } - - private void addNumberedComponent(JPanel p, int count, Component c) { - //JPanel entry = new JPanel(); - //entry.setLayout(new GridBagLayout()); - - GridBagUtil.constrain(p, - Box.createRigidArea( - new Dimension(SEPARATED_COMPONENT_SPACE, 0)), 0, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - GridBagUtil.constrain(p, - new JLabel(Integer.toString(count) + ". "), 1, - count - 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.NONE, 0, 0, 0, 0); - GridBagUtil.constrain(p, c, 2, count - 1, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - //p.add(entry); - } - - - public GuideIntroPane() { - super(); - setLayout(new GridBagLayout()); - - int y = 0; - - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("GuideIntroPane", "title"))); - - GridBagUtil.constrain(this, - new MultilineLabel( - resource.getString("GuideIntroPane", "explain")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, - SEPARATED_COMPONENT_SPACE, 0); - - JPanel p = new JPanel(); - //p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); - p.setLayout(new GridBagLayout()); - int count = 0; - - MultilineLabel _step1 = new MultilineLabel( - resource.getString("GuideIntroPane", "step1")); - MultilineLabel _step2 = new MultilineLabel( - resource.getString("GuideIntroPane", "step2")); - MultilineLabel _step3 = new MultilineLabel( - resource.getString("GuideIntroPane", "step3")); - addNumberedComponent(p, ++count, _step1); - addNumberedComponent(p, ++count, _step2); - addNumberedComponent(p, ++count, _step3); - GridBagUtil.constrain(this, p, 0, ++y, 1, 1, 0.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, ++y, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - GridBagUtil.constrain(this, - new JLabel( - resource.getString(null, "clickNextToContinue")), 0, - ++y, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add(new GuideIntroPane()); - //f.getContentPane().add(new MultilineLabel("adsf;klj a;sldkj ;alskj ;alsj f;alsdjf ;lakjfd ;asdjf ;aldsjf ")); - f.setSize(400,400); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java b/pki/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java deleted file mode 100644 index 77ff5072b..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/IAbstractCipherSet.java +++ /dev/null @@ -1,44 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.Vector; - -/** - * - * The interface for abstract cipher preference - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public abstract interface IAbstractCipherSet { - - /** - * Return cipher list - * - */ - public Vector getCipherList(); - - /** - * Return title. - * For purpose of setting title if cipher is placed in a dialog or TitleBorder - * - */ - public String getTitle(); -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java b/pki/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java deleted file mode 100644 index 42a43c7d5..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/ICipherConstants.java +++ /dev/null @@ -1,76 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -/** - * This interface contains all the internal string constants for each - * cipher encrytion methods. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public interface ICipherConstants { - // export ssl2 cipher - /**SSL2 Export - RC4 with 40 bit encryption and MD5 message authentication*/ - public final static String RC4EXPORT = "rc4export"; - /**SSL2 Export - RC2 with 40 bit encryption and MD5 message authentication*/ - public final static String RC2EXPORT = "rc2export"; - - // domestic ssl2 cipher - /**SSL2 Domestic - RC4 with 128 bit encryption and MD5 message authentication*/ - public final static String RC4 = "rc4"; - /**SSL2 Domestic - RC2 with 128 bit encryption and MD5 message authentication*/ - public final static String RC2 = "rc2"; - /**SSL2 Domestic - DES with 56 bit encryption and MD5 message authentication*/ - public final static String DES = "des"; - /**SSL2 Domestic - Triple DES with 168 bit encryption and MD5 message authentication*/ - public final static String DES3 = "desede3"; - - // export ssl3 cipher - /**SSL3 Export - RC4 with 40 bit encryption and MD5 message authentication*/ - public final static String RSA_RC4_40_MD5 = "rsa_rc4_40_md5"; - /**SSL3 Export - RC2 with 40 bit encryption and MD5 message authentication*/ - public final static String RSA_RC2_40_MD5 = "rsa_rc2_40_md5"; - /**SSL3 Export - No encryption, only MD5 message authentication*/ - public final static String RSA_NULL_MD5 = "rsa_null_md5"; - /**SSL3 Export - TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA */ - public final static String TLS_RSA_DES_SHA = "tls_rsa_export1024_with_des_cbc_sha"; - /**SSL3 Export - TLS_RSA_EXPORT1024_WITH_RC4_56_SHA */ - public final static String TLS_RSA_RC4_SHA = "tls_rsa_export1024_with_rc4_56_sha"; - - // domestic ssl3 cipher - /**SSL3 Domestic - DES with 56 bit encryption and SHA message authentication*/ - public final static String RSA_DES_SHA = "rsa_des_sha"; - /**SSL3 Domestic - RC4 with 128 bit encryption and MD5 message authentication*/ - public final static String RSA_RC4_128_MD5 = "rsa_rc4_128_md5"; - /**SSL3 Domestic - Triple DES with 168 bit encryption and SHA message authentication*/ - public final static String RSA_3DES_SHA = "rsa_3des_sha"; - - // fortezza ciphers - /**SSL3 Domestic - Fortezza with 80 bit encryption and SHA message authentication */ - public final static String FORTEZZA = "fortezza"; - /**SSL3 Domestic - RC4 with 128 bit encryption and Fortezza/SHA message authentication */ - public final static String FORTEZZA_RC4_128_SHA = "fortezza_rc4_128_sha"; - /**SSL3 Domestic - No encryption, only Fortezza and SHA message authentication */ - public final static String FORTEZZA_NULL = "fortezza_null"; - - // FIPS ciphers - public final static String RSA_FIPS_DES_SHA = "rsa_fips_des_sha"; - public final static String RSA_FIPS_3DES_SHA = "rsa_fips_3des_sha"; -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java b/pki/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java deleted file mode 100644 index 96d1b4077..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/IEncryptionPaneListener.java +++ /dev/null @@ -1,52 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -/** - * Interface which specify the encryption panel listen method. - * - * @author <a href=mailto:dshihcm@netscape.com>Chih Ming Shih</a> - * @version 0.2 9/3/97 - */ - -public interface IEncryptionPaneListener { - - /** - * called when cipher change state(on/off, token name change, cert name change) - * - * @param cipherEnbled enable cipher - * @param cipherName cipher name - * @param tokenName token name - * @param certName certificate name - */ - public void cipherStateChanged(boolean cipherEnabled, - String cipherName, String tokenName, String certName); - - /** - * called when ssl change state - * - * @param sslEnabled enable ssl - */ - public void sslStateChanged(boolean sslEnabled); - - /** - * called to invoke cipher preference dialog - * - */ - public void showCipherPreferenceDialog(); -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java b/pki/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java deleted file mode 100644 index 02ec98d9d..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/IKeyCertPage.java +++ /dev/null @@ -1,26 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.JPanel; - -interface IKeyCertPage { - public abstract JPanel getPanel(); - public abstract boolean pageShow(WizardObservable observable); - public abstract boolean pageHide(WizardObservable observable); -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java b/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java deleted file mode 100644 index 9ffe7b2b5..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertTaskInfo.java +++ /dev/null @@ -1,116 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; - -import javax.swing.*; - -import java.awt.event.*; -import java.util.*; -import java.io.*; -import java.net.*; - -import netscape.ldap.*; - -/*-----IMPLEMENTATION-----*/ -//need to implementation timer...if server don't response in 30 sec then -//we will pop up a message telling the user that server side cgi -//has not response in a resonable amount of time...and should check -//the server or call the cgi again. - -class KeyCertTaskInfo extends Hashtable { - - //need to replace this by useful name later since the name will - //be map and no need to use real name. - //So a more descriptive name will probably be more useful. - public static final String SEC_LSALIAS = "ListAlias"; //"sec-lsalias"; - public static final String SEC_GCRT = "CertRequest"; //""sec-gcrt"; - public static final String SEC_ICRT = "CertInstall"; //"sec-icrt"; - public static final String SEC_MGCRT = "CertListing"; //"sec-mgcrt" - public static final String SEC_ECRT = "GetCertInfo"; //"sec-ecrt"; - public static final String SEC_TRUST = "CreateTrustDB"; //"sec-trust"; - public static final String SSL_ON_OFF = "SSLActivate"; //"sec-activate" - public static final String SEC_LSTOKEN = "ListToken"; //"sec-lstoken" - public static final String SEC_LSMODULE = "ListModule"; //"sec-lsmodule" - public static final String SEC_MIGRATE = "KeyCertMigration"; //"sec-migrate" - public static final String SEC_ADDMOD = "AddModule"; //"sec-addmod" - public static final String SEC_CHANGEPW = "ChangeTrustPW"; //"sec-passwd" - public static final String SEC_MGCRL = "CRLListing"; //"sec-mgcrl" - public static final String SEC_ICRL = "CRLInstall"; //"sec-icrl" - public static final String SEC_ECRL = "GetCRLInfo"; //"sec-ecrl" - - String _URL; - ConsoleInfo _consoleInfo; - - //contains the last response from the cgi - Response _response = null; - - private static ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.KeyCertTaskInfoResource"); - - //Call's the appropriate cgi and pass in the appropriate arguments - public Response exec(String operation) throws Exception { - String operationURL = _URL + operation; - - Debug.println(operationURL + "\n"+this); - - Comm kComm = null; - - try { - kComm = new Comm(operationURL, this, true); - - kComm.setAuth(_consoleInfo.getAuthenticationDN(), - _consoleInfo.getAuthenticationPassword()); - kComm.run(); - if (kComm.getError() instanceof Exception) { - if (kComm.getError() instanceof InterruptedIOException) { - throw (new Exception( - resource.getString("KeyCertTaskInfo", "timeoutError"))); - } else if (kComm.getError() instanceof ConnectException) { - throw (new Exception( - resource.getString("KeyCertTaskInfo", "connectionError"))); - } else if (kComm.getError() instanceof IOException) { - throw (new Exception( - resource.getString("KeyCertTaskInfo", "ioError"))); - } else { - throw kComm.getError(); - } - } - } catch (Exception e) { - throw (new Exception(resource.getString("KeyCertTaskInfo", "serverError"))); - } - Debug.println(kComm.getData()); - _response = new Response(kComm.getData()); - - return (_response); - } - - public Response getResponse() { - return _response; - } - - public KeyCertTaskInfo(ConsoleInfo consoleInfo) { - super(); - - _consoleInfo = consoleInfo; - _URL = consoleInfo.getAdminURL() + "admin-serv/tasks/configuration/"; - } - -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java b/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java deleted file mode 100644 index 26032fc0f..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertUtility.java +++ /dev/null @@ -1,113 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.nmclf.*; -import com.netscape.management.client.console.ConsoleInfo; -import com.netscape.management.client.util.*; -import javax.swing.*; - -import java.awt.SystemColor; -import java.util.*; -import java.io.*; - -class KeyCertUtility { - - static ResourceSet _resource = null; - public static ResourceSet getKeyCertWizardResourceSet() { - if (_resource == null) { - _resource = new ResourceSet("com.netscape.admin.certsrv.security.KeyCertWizardResource"); - } - - return _resource; - } - - public static String createTokenName(ConsoleInfo consoleInfo) { - String tokenName = ""; - - tokenName = (String)(consoleInfo.get("SIE")); - if (tokenName == null) { - Debug.println("SIE entry was not set in the ConsoleInfo..."); - try { - String currentDN = consoleInfo.getCurrentDN().toLowerCase(); - tokenName = currentDN.substring(currentDN.indexOf("cn=") + - 3, currentDN.indexOf(",")); - } catch (Exception e2) { - tokenName = "Unknow-Server"; - } - } - - - return (tokenName); - } - - //replace any occurance of 'val' in 'oldStr' with 'replacement' - public static String replace(String oldStr, String val, - String replacement) { - String output = new String(oldStr); - - int index; - - while ((index = output.indexOf(val)) != -1) { - output = output.substring(0, index) + replacement + - output.substring(index + val.length()); - } - - return output; - } - - //a valid is a password that has more then 8 character and contain one or more - //none alphabetic character - public static boolean validPassword(String passwd, - String confirmPasswd, ConsoleInfo consoleInfo) { - boolean valid = true; - if (!(passwd.equals(confirmPasswd))) { - valid = false; - SuiOptionPane.showMessageDialog(consoleInfo.getFrame(), - getKeyCertWizardResourceSet().getString("KeyCertUtility", - "passwdMissMatch")); - ModalDialogUtil.sleep(); - } else if (passwd.length() < 8) { - valid = false; - SuiOptionPane.showMessageDialog(consoleInfo.getFrame(), - getKeyCertWizardResourceSet().getString("KeyCertUtility", - "lessThen8Char")); - ModalDialogUtil.sleep(); - } else { - boolean allChar = true; - int length = confirmPasswd.length(); - for (int i = 0; i < length; i++) { - char ch = confirmPasswd.charAt(i); - if (!((ch >= 'A') && (ch <= 'Z')) && - !((ch >= 'a') && (ch <= 'z'))) { - allChar = false; - break; - } - } - if (allChar) { - valid = false; - SuiOptionPane.showMessageDialog(consoleInfo.getFrame(), - getKeyCertWizardResourceSet().getString("KeyCertUtility", - "noNumericChar")); - ModalDialogUtil.sleep(); - } - } - - return valid; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java b/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java deleted file mode 100644 index 017647488..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/KeyCertWizard.java +++ /dev/null @@ -1,328 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import java.io.*; - -import javax.swing.*; - -import com.netscape.management.client.util.Help; -import com.netscape.management.client.util.Debug; -import com.netscape.management.client.console.ConsoleInfo; -import netscape.ldap.*; - -import com.netscape.management.client.util.*; - -/** - * - * Key and certificate setup wizard - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class KeyCertWizard { - - final int FIRSTPAGE = 0; - - WizardObservable wizardObservable; - IWizardControl owner; - Wizard wizard; - - Vector pages; - int thisPage = 0; - - ConsoleInfo _consoleInfo; - - ResourceSet resource; - Help help; - - void init(ConsoleInfo consoleInfo, String certName) { - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - resource = KeyCertUtility.getKeyCertWizardResourceSet(); - help = new Help(resource); - - wizardObservable = new WizardObservable(consoleInfo); - _consoleInfo = consoleInfo; - - pages = new Vector(); - pages.addElement(new GuideIntroPane()); - //((IKeyCertPage)(pages.elementAt(thisPage))).pageShow(wizardObservable); - pages.addElement(new CertRequestSelectTokenPane()); - pages.addElement(new GuideCreateTrustPane()); - pages.addElement(new CreateTrustPane()); - StatusPane statusPane = new StatusPane(); - pages.addElement(statusPane); - pages.addElement(new GuideCertRequestPane()); - pages.addElement(new CertRequestTypePane()); - pages.addElement(new CertRequestInfoPane()); - pages.addElement(new CertRequestEnterPasswordPane()); - pages.addElement(statusPane); - pages.addElement(new CertRequestCertPane()); - pages.addElement(new GuideCertInstallPane()); - pages.addElement(new CertInstallTypePane()); - pages.addElement(new CertInstallCertPane()); - pages.addElement(statusPane); - pages.addElement(new CertInstallCertInfoPane()); - pages.addElement(statusPane); - - wizardObservable.put("statusPane", statusPane); - - try { - wizard = new Wizard(null, - resource.getString("KeyCertWizard", "title"), - new WizardControlListener()); - } catch (Exception e) { - wizard = new Wizard(null, "", new WizardControlListener()); - } - - if ((certName == null) || (certName.length() == 0)) { - wizardObservable.put("certName", "Server-Cert"); - } else { - wizardObservable.put("certName", certName); - } - - wizard.setMinimumSize(425, 425); - wizard.start(); - } - - - /** - * Create a key and certificate setup wizard - * - * @param consoleInfo - * - */ - public KeyCertWizard(ConsoleInfo consoleInfo, String certName) { - super(); - init(consoleInfo, certName); - } - - /** - * Create a key and certificate setup wizard - * - * - * - */ - public KeyCertWizard(ConsoleInfo consoleInfo) { - super(); - init(consoleInfo, null); - } - - - class WizardControlListener implements IWizardPageControl { - public JPanel getCurrentPage() { - try { - return ( (IKeyCertPage)(pages.elementAt(thisPage))). - getPanel(); - } catch (Exception e) { - return new JPanel(); - } - } - - public JPanel getNextPage() { - IKeyCertPage ipage = (IKeyCertPage)(pages.elementAt(thisPage)); - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - try { - if (!(ipage.pageHide(wizardObservable))) { - //check to see if we need to display some error message - //from cgi - } else { - - - - while (true) { - ipage = (IKeyCertPage)(pages.elementAt(++thisPage)); - if (ipage.pageShow(wizardObservable)) { - break; - } - } - if ((ipage instanceof StatusPane) && - ((StatusPane) ipage).hasError()) { - owner.setCanGoForward(false); - } - - //-2 because we don't want to count the last status page as one of the normal - //page. Also it's only managed by the certinfo page. - if (thisPage == (pages.size() - 2)) { - //owner.setIsLastPage(true); - owner.setCanGoForward(false); - } else if (thisPage == (pages.size() - 1)) { - owner.setCanGoForward(true); - owner.setIsLastPage(true); - } - - owner.setCanGoBackword(true); - - } - } - catch (Exception e) { - Debug.println(e + ":next page"); - } - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - return ipage.getPanel(); - } - - - public JPanel getPrevPage() { - IKeyCertPage page = null; - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - try { - while (true) { - page = (IKeyCertPage)(pages.elementAt(--thisPage)); - if ((page != null) && page.pageShow(wizardObservable)) { - break; - } - } - - owner.setIsLastPage(false); - owner.setCanGoForward(true); - - if (thisPage == FIRSTPAGE) { - owner.setCanGoBackword(false); - } - - if (thisPage == ((pages.size()) - 1)) { - owner.setIsLastPage(true); - } else if (thisPage == (pages.size() - 2)) { - owner.setCanGoForward(false); - } - } catch (Exception e) { - Debug.println(e + ":prev page"); - } - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - return page.getPanel(); - } - - - public void wizardCompleted() { - //do clean up - cleanUp(); - } - public void wizardCanceled() { - //do clean up - cleanUp(); - } - - public void cleanUp() { - wizardObservable = null; - owner = null; - wizard = null; - - pages = null; - - _consoleInfo = null; - - help = null; - } - - public void helpInvoked() { - Object currentPage = pages.elementAt(thisPage); - if (currentPage instanceof GuideIntroPane) { - help.help("GuideIntroPane", "help"); - } else if (currentPage instanceof CertRequestSelectTokenPane) { - help.help("SelectToken", "help"); - } else if (currentPage instanceof GuideCreateTrustPane) { - help.help("GuideCreateTrustPane", "help"); - } else if (currentPage instanceof CreateTrustPane) { - help.help("CreateTrustPane", "help"); - } else if ((currentPage instanceof StatusPane) && - (pages.elementAt(thisPage - - 1) instanceof CreateTrustPane)) { - help.help("CreateTrustPane", "help"); - } else if (currentPage instanceof GuideCertRequestPane) { - help.help("GuideCertRequestPane", "help"); - } else if ( - currentPage instanceof CertRequestEnterPasswordPane) { - help.help("CertRequestEnterPasswordPane", "help"); - } else if (currentPage instanceof CertRequestTypePane) { - help.help("CertRequestTypePane", "help"); - } else if ((currentPage instanceof StatusPane) && - (pages.elementAt(thisPage - - 1) instanceof CertRequestTypePane)) { - help.help("CertRequestTypePane", "help"); - } else if (currentPage instanceof CertRequestInfoPane) { - help.help("CertRequestInfoPane", "help"); - } else if (currentPage instanceof CertRequestCertPane) { - help.help("CertRequestCertPane", "help"); - } else if (currentPage instanceof GuideCertInstallPane) { - help.help("GuideCertInstallPane", "help"); - } else if (currentPage instanceof CertInstallTypePane) { - help.help("CertInstallTypePane", "help"); - } else if (currentPage instanceof CertInstallCertPane) { - help.help("CertInstallCertPane", "help"); - } else if ((currentPage instanceof StatusPane) && - (pages.elementAt(thisPage - - 1) instanceof CertInstallCertPane)) { - help.help("CertInstallCertPane", "help"); - } else if (currentPage instanceof CertInstallCertInfoPane) { - help.help("CertInstallCertInfoPane", "help"); - } else if ((currentPage instanceof StatusPane) && - (pages.elementAt(thisPage - - 1) instanceof CertInstallCertInfoPane)) { - help.help("CertInstallCertInfoPane", "help"); - } - } - - public void setOwner(IWizardControl wizardControl) { - wizardObservable.put("Wizard", wizardControl); - - owner = wizardControl; - } - } - - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - ConsoleInfo consoleInfo = null; - UtilConsoleGlobals.setActivatedFrame(f); - f.setSize(400,400); - - try { - UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); - SwingUtilities.updateComponentTreeUI(f.getContentPane()); - } catch (Exception e) {} - - f.show(); - String host = "buddha"; - try { - consoleInfo = new ConsoleInfo(host+".mcom.com", 389, "admin", "admin", "o=airius.com"); - LDAPConnection connection = new LDAPConnection(); - consoleInfo.setAdminURL("https://"+host+".mcom.com:8081/"); - consoleInfo.setBaseDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com"); - consoleInfo.setCurrentDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com"); - } catch (Exception e) {System.out.println(e);} - - - KeyCertWizard kc = new KeyCertWizard(consoleInfo); - - // f.setIconImage((new RemoteImage("com/netscape/management/client/images/AdminServer.gif")).getImage()); - //f.show(); - }*/ -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/Message.java b/pki/base/console/src/com/netscape/admin/certsrv/security/Message.java deleted file mode 100644 index 96f6bc9f7..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/Message.java +++ /dev/null @@ -1,241 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.*; -import java.io.*; -import com.netscape.management.client.util.Debug; - -class Index { - String _indexValue; - int _pos; - - public Index(String indexValue, int pos) { - _indexValue = indexValue; - _pos = pos; - } - - public String getIndexValue() { - return _indexValue; - } - - public int getPos() { - return _pos; - } -} -class Message { - - public final static int NMC_SUCCESS = 0; - public final static int NMC_FAILURE = 1; - public final static int NMC_WARNING = 2; - public final static int NMC_UNKNOWN = 3; - - /* final static int FILE_ERROR = 0; - final static int MEMORY_ERROR = 1; - final static int SYSTEM_ERROR = 2; - final static int INCORRECT_USAGE = 3; - final static int ELEM_MISSING = 4; - final static int REGISTRY_DATABASE_ERROR = 5; - final static int NETWORK_ERROR = 6; - final static int GENERAL_FAILURE = 7; - final static int APP_ERROR = 8; - final static int WARNING = 9;*/ - - final static int DEFAULT_ERROR = 3; - - final static String NMC_STATUS = "NMC_Status:"; - final static String NMC_ERRTYPE = "NMC_ErrType:"; - final static String NMC_ERRINFO = "NMC_ErrInfo:"; - final static String NMC_ERRDETAIL = "NMC_ErrDetail:"; - final static String NMC_DESCRIPTION = "NMC_Description:"; - final static String NMC_EXTRA = "NMC_EXTRA:"; - - int NMC_Status = -1; - //int NMC_ErrType = -1; - String NMC_ErrType = ""; - String NMC_ErrInfo = ""; - String NMC_ErrDetail = ""; - String NMC_Description = ""; - String NMC_Extra = ""; - - public Message(String message) { - Vector indexes = new Vector(); - int pos1 = message.indexOf(NMC_STATUS); - if (pos1 != -1) { - indexes.addElement(new Index(NMC_STATUS, pos1)); - } - - int pos2 = message.indexOf(NMC_ERRTYPE); - if (pos2 != -1) { - indexes.addElement(new Index(NMC_ERRTYPE, pos2)); - } - - int pos3 = message.indexOf(NMC_ERRINFO); - if (pos3 != -1) { - indexes.addElement(new Index(NMC_ERRINFO, pos3)); - } - - int pos4 = message.indexOf(NMC_ERRDETAIL); - if (pos4 != -1) { - indexes.addElement(new Index(NMC_ERRDETAIL, pos4)); - } - - int pos5 = message.indexOf(NMC_DESCRIPTION); - if (pos5 != -1) { - indexes.addElement(new Index(NMC_DESCRIPTION, pos5)); - } - - int extraIndex = message.indexOf('\n', - Math.max( - Math.max(Math.max(pos1, pos2), Math.max(pos3, pos4)), - pos5)); - if (extraIndex != -1) { - NMC_Extra = message.substring(extraIndex + 1, message.length()); - - /* temp solution until Yu-Jen can think up another header schema */ - NMC_Extra = - KeyCertUtility.replace(NMC_Extra, "Content-type: text/html", ""); - } - indexes.addElement(new Index(NMC_EXTRA, extraIndex + 1)); - - int size = indexes.size(); - for (int i = 0; i < size - 1; i++) { - Index beginIndex = (Index)(indexes.elementAt(i)); - Index endIndex = (Index)(indexes.elementAt(i + 1)); - if (beginIndex.getIndexValue().equals(NMC_STATUS)) { - String val = message.substring(beginIndex.getPos() + - NMC_STATUS.length(), endIndex.getPos()); - NMC_Status = Integer.parseInt(val.trim()); - } else if ( - beginIndex.getIndexValue().equals(NMC_DESCRIPTION)) { - NMC_Description = message.substring(beginIndex.getPos() + - NMC_DESCRIPTION.length(), endIndex.getPos()); - } else if (beginIndex.getIndexValue().equals(NMC_ERRTYPE)) { - NMC_ErrType = message.substring(beginIndex.getPos() + - NMC_ERRTYPE.length(), endIndex.getPos()); - } else if (beginIndex.getIndexValue().equals(NMC_ERRINFO)) { - NMC_ErrInfo = message.substring(beginIndex.getPos() + - NMC_ERRINFO.length(), endIndex.getPos()); - } else if (beginIndex.getIndexValue().equals(NMC_ERRDETAIL)) { - NMC_ErrDetail = message.substring(beginIndex.getPos() + - NMC_ERRDETAIL.length(), endIndex.getPos()); - } - } - - } - - public int getStatus() { - return NMC_Status; - } - - public boolean isSuccess() { - return (getStatus() == NMC_SUCCESS); - } - public boolean isFailure() { - return (getStatus() == NMC_FAILURE); - } - public boolean isWarning() { - return (getStatus() == NMC_WARNING); - } - public boolean isUnknown() { - return (getStatus() == NMC_UNKNOWN); - } - - public String getStatusString() { - String status = ""; - switch (NMC_Status) { - case NMC_SUCCESS: - status = "Success"; - break; - case NMC_FAILURE: - status = "Failure"; - break; - case NMC_WARNING: - status = "Warning"; - break; - case NMC_UNKNOWN: - status = "Unknown"; - break; - } - return status; - } - - public String getErrorType() { - return NMC_ErrType; - } - - /*int getErrorType(String errorType) { - int errVal = -1; - if (errorType.indexOf("FILE ERROR") != -1) { - errVal = FILE_ERROR; - } else if (errorType.indexOf("MEMORY ERROR") != -1) { - errVal = MEMORY_ERROR; - } else if (errorType.indexOf("SYSTEM ERROR") != -1) { - errVal = SYSTEM_ERROR; - } else if (errorType.indexOf("INCORRECT USAGE") != -1) { - errVal = INCORRECT_USAGE; - } else if (errorType.indexOf("ELEMENT MISSING") != -1) { - errVal = ELEM_MISSING; - } else if (errorType.indexOf("REGISTRY DATABASE ERROR") != -1) { - errVal = REGISTRY_DATABASE_ERROR; - } else if (errorType.indexOf("NETWORK ERROR") != -1) { - errVal = NETWORK_ERROR; - } else if (errorType.indexOf("GENERAL FAILURE") != -1) { - errVal = GENERAL_FAILURE; - } else if (errorType.indexOf("APPLICATION ERROR") != -1) { - errVal = APP_ERROR; - } else if (errorType.indexOf("WARNING") != -1) { - errVal = WARNING; - } - return errVal; - } - - public String getErrorTypeString() { - String type = ""; - switch (NMC_ErrType) { - case FILE_ERROR : type = "FILE ERROR"; break; - case MEMORY_ERROR : type = "MEMORY ERROR"; break; - case SYSTEM_ERROR : type = "SYSTEM ERROR"; break; - case INCORRECT_USAGE : type = "INCORRECT USAGE"; break; - case ELEM_MISSING : type = "ELEMENT MISSING"; break; - case REGISTRY_DATABASE_ERROR : type = "REGISTRY DATABASE ERROR"; break; - case NETWORK_ERROR : type = "NETWORK ERROR"; break; - case GENERAL_FAILURE : type = "GENERAL FAILURE"; break; - case APP_ERROR : type = "APPLICATION ERROR"; break; - case WARNING : type = "WARNING"; break; - default : type = "UNKNOW ERROR"; break; - } - return type; - }*/ - - public String getErrorInfo() { - return NMC_ErrInfo; - } - - public String getErrorDetail() { - return NMC_ErrDetail; - } - - public String getDescription() { - return NMC_Description; - } - - public String getExtraMessage() { - return NMC_Extra; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java deleted file mode 100644 index d303de839..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/MessageDialog.java +++ /dev/null @@ -1,66 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; - -import java.awt.SystemColor; -import java.util.*; -import com.netscape.management.client.util.UtilConsoleGlobals; -import com.netscape.management.nmclf.*; - -class MessageDialog { - - public static void rpt_success(Message message) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), - message.getDescription()); - } - - public static void rpt_error(Message message) { - Object m[] = new Object[6]; - m[0] = message.getErrorType(); - m[2] = " "; - m[1] = message.getErrorInfo(); - m[3] = message.getErrorDetail(); - if (message.getExtraMessage().length() != 0) { - m[4] = " "; - m[5] = message.getExtraMessage(); - } - SuiOptionPane.showMessageDialog((new JFrame()), m); - } - - public static void messageDialog(Message cgiMessage) { - switch (cgiMessage.getStatus()) { - case Message.NMC_SUCCESS: - rpt_success(cgiMessage); - break; - case Message.NMC_FAILURE: - rpt_error(cgiMessage); - break; - case Message.NMC_WARNING: - rpt_error(cgiMessage); - break; - case Message.NMC_UNKNOWN: - rpt_success(cgiMessage); - break; - default : - break; - } - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java deleted file mode 100644 index 7b5fe12a6..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11AddModuleDialog.java +++ /dev/null @@ -1,165 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; - -import javax.swing.*; -import javax.swing.JFileChooser; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - - -class PKCS11AddModuleDialog extends AbstractDialog { - - KeyCertTaskInfo taskInfo; - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.PKCS11ManagementResource"); - - JRadioButton _isDLL; - JRadioButton _isJAR; - JTextField _dllname = new JTextField(10); - JTextField _filename = new JTextField(10); - - boolean moduleAdded; - - protected boolean isAdded() { - return moduleAdded; - } - - protected void okInvoked() { - moduleAdded = false; - taskInfo.clear(); - - taskInfo.put("filename", _filename.getText()); - taskInfo.put("format", _isDLL.isSelected() ? "dll" : "jar"); - if (_isDLL.isSelected()) - taskInfo.put("dllname", _dllname.getText()); - - Response response = null; - try { - response = taskInfo.exec(taskInfo.SEC_ADDMOD); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - return; - } - - try { - Message m = (Message)(response.getMessages().elementAt(0)); - MessageDialog.messageDialog(m); - moduleAdded = m.isSuccess(); - } catch (Exception ex) {} - - if (((Message) response.getMessages().elementAt(0)).getStatus() - == Message.NMC_SUCCESS) - super.okInvoked(); - } - - protected void helpInvoked() { - Help help = new Help(resource); - help.help("PKCS11AddModuleDialog", "help"); - } - - - /** - * Listen to changes (key strokes or change in text area or text field) - * then determain (call setEnableNextButton()) if wizard can proceed - */ - class MyActionListener implements KeyListener, ActionListener { - public void keyTyped(KeyEvent e) {} - public void keyPressed(KeyEvent e) {} - public void keyReleased(KeyEvent e) {} - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("ENABLED")) - _dllname.setEnabled(_isDLL.isSelected()); - } - } - - public PKCS11AddModuleDialog(ConsoleInfo consoleInfo) { - super(null, "", true, OK | CANCEL | HELP); - - setTitle(resource.getString("PKCS11AddModuleDialog", "dialogTitle")); - - - taskInfo = new KeyCertTaskInfo(consoleInfo); - - Container mainPane = getContentPane(); - mainPane.setLayout(new GridBagLayout()); - - _isDLL = new JRadioButton( - resource.getString("PKCS11AddModuleDialog", "DLL"), true); - _isJAR = new JRadioButton( - resource.getString("PKCS11AddModuleDialog", "JAR"), false); - - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(_isDLL); - buttonGroup.add(_isJAR); - - _isDLL.setActionCommand("ENABLED"); - _isDLL.addActionListener(new MyActionListener()); - _isJAR.setActionCommand("ENABLED"); - _isJAR.addActionListener(new MyActionListener()); - - GridBagUtil.constrain(mainPane, - new JLabel( resource.getString("PKCS11AddModuleDialog", - "fileType")), 0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, _isDLL, 0, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, _dllname, 1, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, _isJAR, 0, 2, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, Box.createVerticalGlue(), 0, 3, - 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, 0, 0); - - GridBagUtil.constrain(mainPane, - new JLabel( resource.getString("PKCS11AddModuleDialog", - "fileName")), 0, 4, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, - DIFFERENT_COMPONENT_SPACE, 0); - - GridBagUtil.constrain(mainPane, _filename, 0, 5, 1, 1, 1.0, - 1.0, GridBagConstraints.NORTH, - GridBagConstraints.HORIZONTAL, 0, 0, COMPONENT_SPACE, 0); - - //getContentPane().add(mainPane); - - pack(); - setMinimumSize(getSize()); - } - -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java b/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java deleted file mode 100644 index 277605fc8..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/PKCS11ManagementDialog.java +++ /dev/null @@ -1,242 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import com.netscape.management.client.console.ConsoleInfo; - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; -import netscape.ldap.*; - -/** - * - * Public-Key Cryptography Standards #11 (PKCS#11) Management dialog - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - */ -public class PKCS11ManagementDialog extends AbstractDialog { - - KeyCertTaskInfo taskInfo; - ConsoleInfo _consoleInfo; - boolean setupComplete; - - ResourceSet resource = new ResourceSet("com.netscape.admin.certsrv.security.PKCS11ManagementResource"); - - JPanel moduleList = new JPanel(); - JButton bClose; - JButton bAdd; - JButton bHelp; - - //since can't over load protected and I don't - //want the interface to show so... - - private void privateHelpInvoked() { - Help help = new Help(resource); - help.help("PKCS11ManagementDialog", "help"); - } - - //since can't over load protected and I don't - //want the interface to show so... - private void privateCloseInvoked() { - super.okInvoked(); - } - - private JPanel getModuleListPanel() { - JPanel moduleListPanel = new JPanel(); - moduleListPanel.setLayout(new GridBagLayout()); - - moduleListPanel.setBorder( new TitledBorder( - new CompoundBorder(new EtchedBorder(), - new EmptyBorder(SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE, SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE)), - resource.getString("PKCS11ManagementDialog", "title"))); - - JScrollPane scrollPane = new JScrollPane(moduleList, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setBorder( - new CompoundBorder(UITools.createLoweredBorder(), - new EmptyBorder(VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET, VERT_COMPONENT_INSET, - HORIZ_COMPONENT_INSET))); - GridBagUtil.constrain(moduleListPanel, scrollPane, 0, 0, 1, 1, - 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - - return moduleListPanel; - } - - - private PKCS11AddModuleDialog addDialog; - private void addInvoked() { - addDialog.show(); - if (addDialog.isAdded()) { - setupModules(); - } - } - - class PKCS11ActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("CLOSE")) { - privateCloseInvoked(); - } else if (e.getActionCommand().equals("ADD")) { - addInvoked(); - - } else if (e.getActionCommand().equals("HELP")) { - privateHelpInvoked(); - } - } - } - - private JPanel getControlPanel() { - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - buttonPanel.setBorder( - new EmptyBorder(SuiConstants.VERT_WINDOW_INSET, 0, 0, 0)); - - - PKCS11ActionListener listener = new PKCS11ActionListener(); - - bClose = JButtonFactory.createCloseButton(listener); - buttonPanel.add(bClose); - buttonPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.COMPONENT_SPACE, 0))); - - bAdd = JButtonFactory.create( - resource.getString("PKCS11ManagementDialog", "add")); - buttonPanel.add(bAdd); - bAdd.setActionCommand("ADD"); - bAdd.addActionListener(listener); - buttonPanel.add( Box.createRigidArea( - new Dimension(SuiConstants.SEPARATED_COMPONENT_SPACE, 0))); - - bHelp = JButtonFactory.createHelpButton(listener); - buttonPanel.add(bHelp); - - JButtonFactory.resizeGroup(bHelp, bClose, bAdd); - - return buttonPanel; - } - - - private void setupModules() { - taskInfo = new KeyCertTaskInfo(_consoleInfo); - taskInfo.put("sie", KeyCertUtility.createTokenName(_consoleInfo)); - try { - taskInfo.exec(taskInfo.SEC_LSMODULE); - } catch (Exception e) { - SuiOptionPane.showMessageDialog( - UtilConsoleGlobals.getActivatedFrame(), e.getMessage()); - setupComplete = false; - return; - } - - setModal(true); - - moduleList.removeAll(); - Vector modules = taskInfo.getResponse().getModuleList(); - for (int i = 0; i < modules.size(); i++) { - moduleList.add(new JLabel((String) modules.elementAt(i))); - } - - moduleList.doLayout(); - moduleList.repaint(); - } - - /** - * Create a PKCS#11 managemnt dialog - * - * @param consoleInfo Console information - * - */ - public PKCS11ManagementDialog(ConsoleInfo consoleInfo) { - super(null, "", true, NO_BUTTONS); - - setupComplete = true; - - setTitle(resource.getString("PKCS11ManagementDialog", "dialogTitle")); - - - //Cursor oldCursor = UtilConsoleGlobals.getRootFrame().getCursor(); - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - _consoleInfo = consoleInfo; - addDialog = new PKCS11AddModuleDialog(_consoleInfo); - - JPanel mainPanel = new JPanel(); - mainPanel.setLayout(new BorderLayout()); - mainPanel.add("Center", getModuleListPanel()); - mainPanel.add("South", getControlPanel()); - - getContentPane().add(mainPanel); - - setMinimumSize(400, 275); - //setResizable(false); - - moduleList.setLayout(new BoxLayout(moduleList, BoxLayout.Y_AXIS)); - - setupModules(); - - UtilConsoleGlobals.getActivatedFrame().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - - if (!setupComplete) { - return; - } - - show(); - } - - /*public static void main(String arg[]) { - ConsoleInfo consoleInfo = null; - String host = "buddha"; - - JFrame f = new JFrame(); - f.setSize(500,500); - f.show(); - UtilConsoleGlobals.setRootFrame(f); - - try { - UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel"); - SwingUtilities.updateComponentTreeUI(f.getContentPane()); - } catch (Exception e) {} - - try { - consoleInfo = new ConsoleInfo("awing.mcom.com", 3890, "admin", "admin", "o=mcom.com"); - LDAPConnection connection = new LDAPConnection(); - consoleInfo.setAdminURL("http://"+host+".mcom.com:8081/"); - consoleInfo.setBaseDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com"); - consoleInfo.setCurrentDN("cn=admin-serv-"+host+", ou=Netscape SuiteSpot, o=Airius.com"); - } catch (Exception e) {System.out.println(e);} - - PKCS11ManagementDialog d = new PKCS11ManagementDialog(consoleInfo); - }*/ -} - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/Response.java b/pki/base/console/src/com/netscape/admin/certsrv/security/Response.java deleted file mode 100644 index 5d311d33b..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/Response.java +++ /dev/null @@ -1,407 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -/** - * - * Parse the response that was sent back by the cgi - * - */ - -import java.util.*; -import java.io.*; -import com.netscape.management.client.util.Debug; - -//this class need some optimization.... - -class Response { - - String _response; - String _cert = ""; - Vector _messages = new Vector(); - Vector _certList = null; - CertInfo _certInfo = null; - Hashtable _certInstInfo = null; - - Hashtable _ssl2Preference = null; - Hashtable _ssl3Preference = null; - - String startCert = "-----BEGIN NEW CERTIFICATE REQUEST-----"; - String endCert = "-----END NEW CERTIFICATE REQUEST-----"; - String startCertList = "-----BEGIN CERT LIST-----"; - String endCertList = "-----END CERT LIST-----"; - String startCertInfo = "-----BEGIN CERTIFICATE INFO-----"; - String endCertInfo = "-----END CERTIFICATE INFO-----"; - String startCRLCertInfo = "-----BEGIN CRL INFO-----"; - String endCRLCertInfo = "-----END CRL INFO-----"; - - String startCertInstInfo = "-----BEGIN CERTIFICATE INSTALL INFO-----"; - String endCertInstInfo = "-----END CERTIFICATE INSTALL INFO-----"; - String startCRLCertInstInfo = "-----BEGIN CRL INSTALL INFO-----"; - String endCRLCertInstInfo = "-----END CRL INSTALL INFO-----"; - - boolean _fCert = false, _fCertList = false, _fCertInfo = false, - _fCertInstInfo = false; - boolean _fsecurityDomestic = false, _fsecurityFortezza = false; - - void parseCertificate(String response) { - if (response.indexOf(startCert) != -1) { - _cert = response.substring(response.indexOf(startCert), - response.indexOf(endCert) + endCert.length()); - _fCert = true; - } - } - - void parseCertificateList(String response) { - if (response.indexOf(startCertList) != -1) { - _certList = new Vector(); - - try { - BufferedReader stream = - new BufferedReader(new StringReader(response)); - while (!(stream.readLine().equals(startCertList))) { - } - - String line; - while (!((line = stream.readLine()).equals(endCertList))) { - //need to hack the string that return by the NS secutiry code. - //it assumes we are working with html - line = urlDecode(line); - StringTokenizer token = - new StringTokenizer(line, "=;\n", false); - Debug.print(line); - - String certName = "", certType = "", certExpire = ""; - try { - certName = token.nextToken(); - certType = token.nextToken(); - certExpire = token.nextToken(); - } catch (NoSuchElementException noToken) { } - - _certList.addElement( - new CertBasicInfo(certName, certType, - certExpire)); - } - } catch (IOException e) { - Debug.println(e.getMessage()); - } - - _fCertList = true; - } - - } - - void parseCertificateInfo(String response) { - if ((response.indexOf(startCertInfo) != -1) || - (response.indexOf(startCRLCertInfo) != -1)) { - - try { - BufferedReader stream = - new BufferedReader(new StringReader(response)); - String line; - while (! (((line = - stream.readLine()).equals(startCertInfo)) || - (line.equals(startCRLCertInfo)))) { - } - - String issuer = "", subject = "", serialNumber = "", - version = "", validFrom = "", validTo = ""; - String fingerPrint = "", trustCert = "", certName = "", - certDeleted = "0", certTitle = ""; - - while (!((line = stream.readLine()).equals(endCertInfo)) - && !(line.equals(endCRLCertInfo))) { - - //need to hack the string that was returned by the NS secutiry code. - //it assumes we are working with html - line = urlDecode(line); - StringTokenizer token = - new StringTokenizer(line, "=\n", false); - Debug.print(line); - - - try { - String keyWord = token.nextToken(); - if (keyWord.equals("ISSUER")) { - //have to hack again because of the stupid html in the data - issuer = KeyCertUtility.replace( - token.nextToken(), "<br>", "\n"); - ; - } else if (keyWord.equals("SUBJECT")) { - subject = KeyCertUtility.replace( - token.nextToken(), "<br>", "\n"); - ; - } else if (keyWord.equals("SERIALNUMBER")) { - serialNumber = token.nextToken(); - } else if (keyWord.equals("VERSION")) { - version = token.nextToken(); - } else if (keyWord.equals("NOTBEFORE")) { - validFrom = token.nextToken(); - } else if (keyWord.equals("NOTAFTER")) { - validTo = token.nextToken(); - } else if (keyWord.equals("FINGERPRINT")) { - fingerPrint = token.nextToken(); - } else if (keyWord.equals("TRUSTED")) { - trustCert = token.nextToken(); - } else if (keyWord.equals("CERTNAME")) { - certName = token.nextToken(); - } else if (keyWord.equals("CERTDELETED")) { - certDeleted = token.nextToken(); - } else if (keyWord.equals("CERTTITLE")) { - certTitle = token.nextToken(); - } - } catch (NoSuchElementException noToken) { - Debug.print(noToken.getMessage()); - } - - } - - _certInfo = new CertInfo(certName, issuer, subject, - serialNumber, version, validFrom, validTo, - fingerPrint, trustCert, certDeleted, certTitle); - } catch (IOException e) { - Debug.println(e.getMessage()); - } - - _fCertInfo = true; - } - - } - - void parseCertificateInstInfo(String response) { - if ((response.indexOf(startCertInstInfo) != -1) || - (response.indexOf(startCRLCertInstInfo) != -1)) { - _certInstInfo = new Hashtable(); - - try { - BufferedReader stream = - new BufferedReader(new StringReader(response)); - String line; - - while (! (((line = - stream.readLine()).equals(startCertInstInfo)) - || (line.equals(startCRLCertInstInfo)))) { - } - - - while (! ((line = - stream.readLine()).equals(endCertInstInfo)) && - !(line.equals(endCRLCertInstInfo))) { - StringTokenizer token = - new StringTokenizer(line, "=\n", false); - Debug.print(line); - try { - String key = token.nextToken(); - String val = token.nextToken(); - _certInstInfo.put(key, val); - } catch (NoSuchElementException noToken) { - Debug.print(noToken.getMessage()); - } - } - } catch (IOException e) { - Debug.println(e.getMessage()); - } - _fCertInstInfo = true; - } - } - - public static String urlDecode(String urlString) { - ByteArrayOutputStream out = - new ByteArrayOutputStream(urlString.length()); - - for (int i = 0; i < urlString.length(); i++) { - int c = (int) urlString.charAt(i); - if (c == '+') { - out.write(' '); - } else if (c == '%') { - int c1 = Character.digit(urlString.charAt(++i), 16); - int c2 = Character.digit(urlString.charAt(++i), 16); - out.write((char)(c1 * 16 + c2)); - } else { - out.write(c); - } - } - - return out.toString(); - } - - Vector familyList; - public Vector parseFamilyList(String response) { - familyList = new Vector(); - _fsecurityFortezza = false; - _fsecurityDomestic = false; - try { - BufferedReader stream = - new BufferedReader(new StringReader(response)); - String line = null; - - while (!(((line = stream.readLine()).startsWith("NULL")))) { - String cipherName = line.substring(0, line.indexOf("=")); - - StringTokenizer st = new StringTokenizer( - line.substring(line.indexOf("=") + 1, - line.length()), ",\n", false); - Vector tokenList = new Vector(); - Hashtable tokenCertList = new Hashtable(); - while (st.hasMoreTokens()) { - String token = st.nextToken(); - tokenList.addElement(token); - tokenCertList.put(token, ""); - } - - Enumeration e = tokenList.elements(); - while (e.hasMoreElements()) { - String token = (String)(e.nextElement()); - line = stream.readLine(); - String certListString = line.substring( - (token + "-certs=").length(), line.length()); - StringTokenizer certNames = - new StringTokenizer(certListString, ",\n", - false); - Vector certList = new Vector(); - while (certNames.hasMoreTokens()) { - certList.addElement(certNames.nextToken()); - } - tokenCertList.put(token, certList); - } - - familyList.addElement( - new CipherEntry(cipherName, tokenCertList)); - } - if ((line = stream.readLine()).startsWith("security")) { - if (line.endsWith("fortezza")) { - _fsecurityFortezza = true; - _fsecurityDomestic = true; - } - if (line.endsWith("domestic")) { - _fsecurityDomestic = true; - } - } - } catch (Exception e) { - Debug.println("com.netscape.admin.certsrv.security.response:"+ - e.toString()); - } - return familyList; - } - - - Vector moduleList; - public Vector parseModuleList(String response) { - - moduleList = new Vector(); - - try { - BufferedReader stream = - new BufferedReader(new StringReader(response)); - String line = stream.readLine(); - - StringTokenizer st = new StringTokenizer( - line.substring(line.indexOf("=") + 1, - line.length()), ",\n", false); - while (st.hasMoreTokens()) - moduleList.addElement(st.nextToken()); - } catch (Exception e) {/*System.out.println(e);*/ - } - return moduleList; - } - - - public Response(String response) { - - //Debug.print(response); - if (response == null) { - return; - } - - _response = response; - - int beginIndex = 0, endIndex = 0; - while (true) { - beginIndex = response.indexOf(Message.NMC_STATUS, endIndex); - endIndex = response.indexOf(Message.NMC_STATUS, - beginIndex + Message.NMC_STATUS.length()); - if ((endIndex == -1) && (beginIndex == -1)) { - break; - } - if (endIndex != -1) { - _messages.addElement( new Message( KeyCertUtility.replace( - response.substring(beginIndex, endIndex), "\r", - ""))); - } else { - _messages.addElement( new Message( KeyCertUtility.replace( - response.substring(beginIndex, - response.length()), "\r", ""))); - break; - } - } - } - - public Vector getFamilyList() { - return parseFamilyList(_response); - } - - public Vector getModuleList() { - return parseModuleList(_response); - } - - public boolean isSecurityDomestic() { - return _fsecurityDomestic; - } - - public boolean isSecurityFortezza() { - return _fsecurityFortezza; - } - public boolean hasCert() { - parseCertificate(_response); - return _fCert; - } - public boolean hasMessage() { - return (_messages.size() > 0); - } - - public boolean hasCertList() { - parseCertificateList(_response); - return _fCertList; - } - public boolean hasCertInfo() { - parseCertificateInfo(_response); - return _fCertInfo; - } - public boolean hasCertInstInfo() { - parseCertificateInstInfo(_response); - return _fCertInstInfo; - } - public String getCert() { - return _fCert ? _cert : ""; - } - public Vector getMessages() { - return _messages; - } - public Vector getCertList() { - return _fCertList ? _certList : (new Vector()); - } - public CertInfo getCertInfo() { - return _certInfo; - } - public Hashtable getCertInstInfo() { - return _certInstInfo; - } - public String getServerResponse() { - return _response; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java b/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java deleted file mode 100644 index 4625a11d5..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherPreference.java +++ /dev/null @@ -1,56 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; - -/** - * - * Convenient class to construct SSL2 cipher preference toggle pane - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * - * @see com.netscape.admin.certsrv.security.SSL2CipherSet - * @see com.netscape.admin.certsrv.security.ToggleCipherPreferencePane - * @see com.netscape.admin.certsrv.security.SSL3CipherPreference - */ -public class SSL2CipherPreference extends ToggleCipherPreferencePane implements ICipherConstants { - - //private static final String sslVersion = "SSL 2.0 Ciphers"; - - /** - * Create a SSL2 cipher preference toggle pane - * - * @param isDomestic show domestic ssl2 ciphers if true - * - */ - public SSL2CipherPreference(boolean isDomestic) { - super(new SSL2CipherSet(isDomestic), true); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add(new SSL2CipherPreference(true)); - f.getContentPane().add(new AbstractCipherPreference(new SSL2CipherSet(true))); - f.pack(); - f.show(); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java b/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java deleted file mode 100644 index 0bdf7684f..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL2CipherSet.java +++ /dev/null @@ -1,85 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.Vector; - -/** - * - * Convenient class to construct a SSL2 cipher list. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * @see com.netscape.admin.certsrv.security.SSL2CipherPreference - */ -public final class SSL2CipherSet implements ICipherConstants, -IAbstractCipherSet { - - - Vector abstractCipherList = new Vector(); - String title; - - final boolean defaultOn = true; - - /** - * Create a SSL2 cipher set - * - * @param isDomestic show domestic ssl2 ciphers if true - * - */ - public SSL2CipherSet(boolean isDomestic) { - CipherResourceSet resource = new CipherResourceSet(); - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "RC4EXPORT"), RC4EXPORT, - defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "RC2EXPORT"), RC2EXPORT, - defaultOn)); - if (isDomestic) { - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "RC4"), RC4 , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "RC2"), RC2 , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "DES"), DES , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl2", "DES3"), DES3 , defaultOn)); - } - - title = resource.getString("ssl2", "CipherTitle"); - } - - /** - * Return title. - * For purpose of setting title if cipher is placed in a dialog or TitleBorder - * - */ - public String getTitle() { - return title; - } - - /** - * Return cipher list - * - */ - public Vector getCipherList() { - return abstractCipherList; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java b/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java deleted file mode 100644 index e6773a27e..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherPreference.java +++ /dev/null @@ -1,64 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; - -/** - * - * Convenient class to construct SSL3 cipher preference toggle pane - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * - * @see com.netscape.admin.certsrv.security.SSL3CipherSet - * @see com.netscape.admin.certsrv.security.ToggleCipherPreferencePane - * @see com.netscape.admin.certsrv.security.SSL2CipherPreference - */ -public class SSL3CipherPreference extends ToggleCipherPreferencePane implements ICipherConstants { - - - /** - * Create a SSL3 cipher preference toggle pane - * - * @param isDomestic show domestic ssl3 ciphers if true - * @param hasFortezza show fortezza ciphers if true - * - */ - public SSL3CipherPreference(boolean isDomestic, boolean hasFortezza) { - super(new SSL3CipherSet(isDomestic, hasFortezza), true); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - SSL3CipherPreference s = new SSL3CipherPreference(false, false); - f.getContentPane().add(s); - f.pack(); - f.show(); - String[] my = s.getCipherList(); - for (int i=0; i <my.length; i++) { - System.out.println(my[i]); - } - - System.out.println(s.isCipherEnabled(SSL3CipherPreference.FORTEZZA)); - s.setCipherEnabled(SSL3CipherPreference.FORTEZZA, false); - System.out.println(s.isCipherEnabled(SSL3CipherPreference.FORTEZZA)); - }*/ - -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java b/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java deleted file mode 100644 index 417ce5d49..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/SSL3CipherSet.java +++ /dev/null @@ -1,119 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import java.util.Vector; - -/** - * - * Convenient class to construct a SSL3 cipher list. - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * @see com.netscape.admin.certsrv.security.SSL3CipherPreference - */ -public final class SSL3CipherSet implements ICipherConstants, -IAbstractCipherSet { - - Vector abstractCipherList = new Vector(); - String title; - - final boolean defaultOn = true; - - /** - * Create a SSL2 cipher set - * - * @param isDomestic show domestic ssl3 ciphers if true - * @param hasFortezza show fortezza ciphers if true - * - */ - public SSL3CipherSet(boolean isDomestic, boolean hasFortezza) { - CipherResourceSet resource = new CipherResourceSet(); - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_RC4_40_MD5"), - RSA_RC4_40_MD5 , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_RC2_40_MD5"), - RSA_RC2_40_MD5 , defaultOn)); - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "TLS_RSA_DES_SHA"), - TLS_RSA_DES_SHA, defaultOn)); - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "TLS_RSA_RC4_SHA"), - TLS_RSA_RC4_SHA, defaultOn)); - - if (isDomestic) { - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_DES_SHA"), - RSA_DES_SHA , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_RC4_128_MD5"), - RSA_RC4_128_MD5 , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_3DES_SHA"), - RSA_3DES_SHA , defaultOn)); - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_FIPS_DES_SHA"), - RSA_FIPS_DES_SHA , !defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_FIPS_3DES_SHA"), - RSA_FIPS_3DES_SHA , !defaultOn)); - - if (hasFortezza) { - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "FORTEZZA"), - FORTEZZA , defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "FORTEZZA_RC4_128_SHA"), - FORTEZZA_RC4_128_SHA, defaultOn)); - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "FORTEZZA_NULL"), - FORTEZZA_NULL , !defaultOn)); - } - - } - - abstractCipherList.addElement( new AbstractCipher( - resource.getString("ssl3", "RSA_NULL_MD5"), - RSA_NULL_MD5 , !defaultOn)); - - title = resource.getString("ssl3", "CipherTitle"); - } - - /** - * Return title. - * For purpose of setting title if cipher is placed in a dialog or TitleBorder - * - */ - public String getTitle() { - return title; - } - - /** - * Return cipher list - * - */ - public Vector getCipherList() { - return abstractCipherList; - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java deleted file mode 100644 index 9eb5b1ba2..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/StatusPane.java +++ /dev/null @@ -1,153 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; - -import java.util.*; -import java.awt.*; - -import com.netscape.management.client.util.*; -import com.netscape.management.nmclf.*; - -class StatusPane extends JPanel implements IKeyCertPage, SuiConstants { - - boolean show = false; - boolean error = false; - - MultilineLabel statusText = new MultilineLabel(); - - public JPanel getPanel() { - show = false; - return this; - } - - public boolean pageShow(WizardObservable observable) { - return show; - } - - public boolean pageHide(WizardObservable observable) { - show = false; - error = false; - return true; - } - - public void setShow(boolean show) { - this.show = show; - } - - - public boolean hasError() { - return error; - } - - public void setMessage(Vector messages) { - String status = ""; - int nMessage = messages.size(); - for (int i = 0; i < nMessage; i++) { - if (getMessage((Message)(messages.elementAt(i))).length() != - 0) { - status += getMessage((Message)(messages.elementAt(i))) + - "\n\n"; - } - } - - //((LABELeditor)(statusPane.getCtrlByName("statusText"))).setValueS(status); - statusText.setText(status); - - } - - public void setMessage(String message) { - statusText.setText(message); - } - - public void appendMessage(String message) { - StringBuffer sb = new StringBuffer(statusText.getText().trim()); - sb.append(message); - statusText.setText(sb.toString()); - } - - - String getMessage(Message message) { - String status = ""; - - if (message.getStatus() == message.NMC_SUCCESS) { - status = message.getDescription() + message.getExtraMessage(); - } else if (message.getStatus() == message.NMC_FAILURE) { - status += message.getErrorType() + "\n"; - status += message.getErrorInfo() + "\n"; - status += message.getErrorDetail(); - error = true; - } else if (message.getStatus() == message.NMC_WARNING) { - status += message.getDescription(); - } else if (message.getStatus() == message.NMC_UNKNOWN) { - status += message.getDescription(); - error = true; - } - - return status; - } - - public void setMessage(Message message) { - //((LABELeditor)(statusPane.getCtrlByName("statusText"))).setValueS(getMessage(message)); - statusText.setText(getMessage(message)); - } - - public void setLastPage(boolean isLastpage) { - if (isLastpage) { - next.setText(""); - } else { - next.setText(resource.getString(null, "clickNextToContinue")); - } - } - - - ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet(); - JLabel next = new JLabel(); - - public StatusPane() { - //set up layout here; - super(); - - //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - setLayout(new GridBagLayout()); - - setBorder( new TitledBorder( new CompoundBorder(new EtchedBorder(), - new EmptyBorder(COMPONENT_SPACE, COMPONENT_SPACE, - COMPONENT_SPACE, COMPONENT_SPACE)), - resource.getString("StatusPane", "title"))); - - GridBagUtil.constrain(this, statusText, 0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - GridBagUtil.constrain(this, Box.createVerticalGlue(), 0, 1, 1, - 1, 1.0, 1.0, GridBagConstraints.NORTH, - GridBagConstraints.BOTH, 0, 0, 0, 0); - - next.setText(resource.getString(null, "clickNextToContinue")); - - GridBagUtil.constrain(this, next, 0, 2, 1, 1, 1.0, 0.0, - GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, - 0, 0, 0); - - - //add(statusText); - } -} diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java b/pki/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java deleted file mode 100644 index eca1e0b02..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/ToggleCipherPreferencePane.java +++ /dev/null @@ -1,181 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.plaf.*; -import java.awt.event.*; -import java.awt.*; - -import com.netscape.management.nmclf.*; - -/** - * - * Convenient class to create a toggle cipher preference pane - * - * @version 1.0 98/07/10 - * @author <A HREF="mailto:shihcm@netscape.com">shihcm@netscape.com</A> - * - * @see com.netscape.admin.certsrv.security.SSL2CipherPreference - * @see com.netscape.admin.certsrv.security.SSL3CipherPreference - */ -public class ToggleCipherPreferencePane extends AbstractCipherPreference implements ICipherConstants { - private JCheckBox on; - private JPanel top = new JPanel(); - boolean _ismodified; - - boolean oldValue; - - /** - * Create a toggle cipher preference pane - * - * @param cipherSet Interface to obtain cipher preference list, and title for toggle pane - * - */ - public ToggleCipherPreferencePane(IAbstractCipherSet cipherSet) { - this(cipherSet, true); - } - - /** - * Create a toggle cipher preference pane - * - * - * @param cipherSet Interface to obtain cipher preference list, and title for toggle pane - * @param enabled enable/disable toggle pane - * - */ - public ToggleCipherPreferencePane(IAbstractCipherSet cipherSet, - boolean enabled) { - oldValue = enabled; - - on = new JCheckBox(cipherSet.getTitle(), enabled); - on.setActionCommand("ENABLED"); - on.addActionListener(new actionListener()); - - top.setAlignmentX(0.0f); - top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); - top.add(on); - setBorder( new CompoundBorder( - new ToggleBorder(top, SwingConstants.TOP), - new EmptyBorder(0, SuiConstants.COMPONENT_SPACE, - SuiConstants.COMPONENT_SPACE, 0))); - add(top); - - initialize(cipherSet); - - add(Box.createHorizontalGlue()); - } - - class actionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("ENABLED")) { - _ismodified = true; - setEnableAll(on.isSelected()); - } - } - } - - - /** - * Enable or disable toggle pane - * - * @param enable - * - */ - public void setEnabled(boolean enable) { - on.setSelected(enable); - super.setEnableAll(enable); - } - - /** - * Check weather toggle pane is enabled - * - */ - public boolean isEnabled() { - return on.isSelected(); - } - - - //steal from Mac's layout manager - class ToggleBorder extends EtchedBorder { - private JComponent _switchPanel; - private int _switchAlign; - - public ToggleBorder(JComponent sp, int align) { - _switchPanel = sp; - _switchAlign = align; - } - - public void paintBorder(Component c, Graphics g, int x, int y, - int width, int height) { - Color save = g.getColor(); - - int top = y + (_switchPanel.getHeight() >> 1); - int new_height = height - top; - - BorderUIResource.getEtchedBorderUIResource().paintBorder(c, - g, x, top, width, new_height); - } - } - - /** - * Check weather any ciphers has been modified - * - * @see #isModified - * @see #setSaved - * - */ - public boolean isModified() { - return (_ismodified | super.isModified()); - } - - /** - * Reset all changes since last save - * - * @see #setSaved - */ - public void reset() { - setEnabled(oldValue); - _ismodified = false; - super.reset(); - } - - - /** - * Set the state to save. - * - * @see #reset - */ - public void setSaved() { - oldValue = isEnabled(); - _ismodified = false; - super.setSaved(); - } - - /*public static void main(String arg[]) { - JFrame f = new JFrame(); - f.getContentPane().add(new ToggleCipherPreferencePane(new SSL3CipherSet(true, true))); - f.pack(); - f.show(); - }*/ - -} - - - diff --git a/pki/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java b/pki/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java deleted file mode 100644 index ca36816af..000000000 --- a/pki/base/console/src/com/netscape/admin/certsrv/security/WizardObservable.java +++ /dev/null @@ -1,48 +0,0 @@ -// --- BEGIN COPYRIGHT BLOCK --- -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// (C) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.admin.certsrv.security; - - -import com.netscape.management.client.console.ConsoleInfo; - - -import javax.swing.*; -import java.awt.event.*; -import java.util.*; - -class WizardObservable extends Hashtable { - - - KeyCertTaskInfo taskInfo; - ConsoleInfo consoleInfo; - - public WizardObservable(ConsoleInfo consoleInfo) { - taskInfo = new KeyCertTaskInfo(consoleInfo); - this.consoleInfo = consoleInfo; - } - - public KeyCertTaskInfo getTaskInfo() { - return taskInfo; - } - - public ConsoleInfo getConsoleInfo() { - return consoleInfo; - } - -} - |