Commits

Mark C committed c8f0e23

removed hardcoded values

Comments (0)

Files changed (27)

build/built-jar.properties

-#Mon, 17 Mar 2014 23:22:29 +1100
+#Wed, 26 Mar 2014 23:36:51 +1100
 
 
-/home/lp1/Desktop/Dropbox/Apps/KeystoreGUI=
+/home/lp1/Desktop/Dropbox/Apps/clientcertificatemaker=

build/classes/KeyStore/CSR.class

Binary file modified.

build/classes/KeyStore/KeyPair.class

Binary file modified.

build/classes/KeyStore/KeyStoreController.class

Binary file modified.

build/classes/KeyStoreGUI/ExistingKeyPanel$1.class

Binary file added.

build/classes/KeyStoreGUI/ExistingKeyPanel$2.class

Binary file added.

build/classes/KeyStoreGUI/ExistingKeyPanel.class

Binary file added.

build/classes/KeyStoreGUI/ExistingKeyPanel.form

+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <Properties>
+    <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[494, 315]"/>
+    </Property>
+  </Properties>
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
+                      <Component id="keysFoundLabel" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="loadSelectedKeyButton" min="-2" pref="160" max="-2" attributes="0"/>
+                      <EmptySpace pref="150" max="32767" attributes="0"/>
+                      <Component id="openKeyFromFileButton" min="-2" pref="160" max="-2" attributes="0"/>
+                  </Group>
+                  <Component id="jScrollPane1" max="32767" attributes="0"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="1" attributes="0">
+              <EmptySpace pref="15" max="32767" attributes="0"/>
+              <Component id="keysFoundLabel" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="loadSelectedKeyButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="openKeyFromFileButton" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JList" name="existingKeySelector">
+          <Properties>
+            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+              <StringArray count="5">
+                <StringItem index="0" value="Item 1"/>
+                <StringItem index="1" value="Item 2"/>
+                <StringItem index="2" value="Item 3"/>
+                <StringItem index="3" value="Item 4"/>
+                <StringItem index="4" value="Item 5"/>
+              </StringArray>
+            </Property>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JLabel" name="keysFoundLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Keys Found:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JButton" name="loadSelectedKeyButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Load Selected Key"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loadSelectedKeyButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="openKeyFromFileButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Open From File"/>
+      </Properties>
+    </Component>
+  </SubComponents>
+</Form>

build/classes/KeyStoreGUI/MainFrame.class

Binary file modified.

build/classes/KeyStoreGUI/MainMenuPanel$1.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel$2.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel$3.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel$4.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel$5.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel.class

Binary file added.

build/classes/KeyStoreGUI/MainMenuPanel.form

+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <Properties>
+    <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[1023, 305]"/>
+    </Property>
+    <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[1024, 305]"/>
+    </Property>
+  </Properties>
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace pref="13" max="32767" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Component id="jScrollPane1" alignment="1" min="-2" pref="470" max="-2" attributes="0"/>
+                  <Component id="generateNewButton" alignment="1" min="-2" pref="470" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace type="separate" max="-2" attributes="0"/>
+              <Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="separate" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Component id="jScrollPane2" min="-2" pref="470" max="-2" attributes="0"/>
+                  <Component id="openExistingButton" min="-2" pref="470" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="1" attributes="0">
+                  <Component id="jSeparator1" alignment="1" min="-2" pref="273" max="-2" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="generateNewButton" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Component id="openExistingButton" alignment="0" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="1" attributes="0">
+                          <Component id="jScrollPane1" min="-2" pref="243" max="-2" attributes="0"/>
+                          <Component id="jScrollPane2" min="-2" pref="243" max="-2" attributes="0"/>
+                      </Group>
+                  </Group>
+              </Group>
+              <EmptySpace pref="14" max="32767" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JButton" name="generateNewButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Generate new key and CSR"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateNewButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JToggleButton" name="openExistingButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Combine selected key with certificate"/>
+      </Properties>
+      <Events>
+        <EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openExistingButtonMouseReleased"/>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openExistingButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextArea" name="csrTextField">
+          <Properties>
+            <Property name="editable" type="boolean" value="false"/>
+            <Property name="columns" type="int" value="20"/>
+            <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+              <Font name="Courier New" size="12" style="0"/>
+            </Property>
+            <Property name="rows" type="int" value="5"/>
+            <Property name="autoscrolls" type="boolean" value="false"/>
+          </Properties>
+          <Events>
+            <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="csrTextFieldMouseClicked"/>
+          </Events>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JList" name="exitingKeyList">
+          <Properties>
+            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+              <StringArray count="5">
+                <StringItem index="0" value="Item 1"/>
+                <StringItem index="1" value="Item 2"/>
+                <StringItem index="2" value="Item 3"/>
+                <StringItem index="3" value="Item 4"/>
+                <StringItem index="4" value="Item 5"/>
+              </StringArray>
+            </Property>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JSeparator" name="jSeparator1">
+      <Properties>
+        <Property name="orientation" type="int" value="1"/>
+      </Properties>
+    </Component>
+  </SubComponents>
+</Form>

build/classes/PackageController.class

Binary file modified.

dist/KeystoreGUI.jar

Binary file modified.

src/KeyStore/CSR.java

     private static X500Principal subject;
     private static ContentSigner signGen;
     private static PKCS10CertificationRequest csr;
+    private static String csrExtension = ".csr.pem";
 
     
-    public CSR(java.security.KeyPair keyPair, String x500Text, String csrPath) throws FileNotFoundException, IOException {
+    public CSR(java.security.KeyPair keyPair, String x500Text, String csrName, String outputDir) throws FileNotFoundException, IOException {
         try {
-            //import javax.securi = "myCSR.pem"ty.auth.x500.X500Principal
             subject = new X500Principal (x500Text);
             signGen = new JcaContentSignerBuilder("SHA1withRSA").build(keyPair.getPrivate());
 
         }
         
         //write CSR to file
-            writeCSR(csrPath);
+            writeCSR(csrName, outputDir);
     }
           
-    private void writeCSR(String csrPath) throws FileNotFoundException, IOException {
-        File file = new File(csrPath);
+    private void writeCSR(String csrName, String outputDir) throws FileNotFoundException, IOException {
+        File file = new File(outputDir + File.separatorChar + csrName + csrExtension);
         try (FileOutputStream fop = new FileOutputStream(file)) {
             file.createNewFile();
             OutputStreamWriter output = new OutputStreamWriter(fop);
             }
         }
     }
-    
-    public String getCSR(String file) throws FileNotFoundException, IOException {
-        BufferedReader reader = new BufferedReader(new FileReader (file));
+    // 
+    public String getCSR(String keyName, String outputDir) throws FileNotFoundException, IOException {
+        BufferedReader reader = new BufferedReader(new FileReader (outputDir + File.separatorChar + keyName + csrExtension));
         String line = null;
         StringBuilder stringBuilder = new StringBuilder();
         String ls = System.getProperty("line.separator");

src/KeyStore/KeyPair.java

      * @param bitLenght default is 2048 from package controller
      * @param password is input by user, default is 'abc123'
      */
-    public KeyPair(Integer bitLength, String inPassword, String keyPath) throws FileNotFoundException, IOException {
+    public KeyPair(Integer bitLength, String inPassword, String keyName, String outputDir) throws FileNotFoundException, IOException {
         try {
             KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA");
             gen.initialize(bitLength);
         } catch (NoSuchAlgorithmException ex) {
             Logger.getLogger(KeyPair.class.getName()).log(Level.SEVERE, null, ex);
         }
-        writeKeyPair(inPassword,keyPath, keyPair);
+        writeKeyPair(inPassword, keyName, outputDir, keyPair);
         //writeKeyPair(filePath + "myPrivate.pem", keyPair.getPrivate());
         //writeKeyPair(filePath + "myPublic.pem", keyPair.getPublic());
     }
             System.out.println("Unencrypted key - no password needed");
             keyPair = converter.getKeyPair((PEMKeyPair) object);
         }
-        writeKeyPair("lol123","myKeyPairRevied.pem", keyPair.getPrivate());
     }
     
     public PrivateKey getPrivateKey() {
         return keyPair.getPublic();
     }
     
-    public String getCSR(String x500Text) throws IOException {
-        csr =  new CSR(keyPair, x500Text, "myCSR.pem");
-        return csr.getCSR("myCSR.pem");
+    public String getCSR(String x500Text, String csrName, String outputDir) throws IOException {
+        csr =  new CSR(keyPair, x500Text, csrName, outputDir);
+        return csr.getCSR(csrName, outputDir);
     }
     
-    private void writeKeyPair(String keyPassword, String keyPath, Object pemObject) throws FileNotFoundException, IOException {
-        File file = new File(keyPath);
+    private void writeKeyPair(String keyPassword, String keyName, String outputDir, Object pemObject) throws FileNotFoundException, IOException {
+        File file = new File(outputDir + File.separatorChar + keyName + ".key.pem");
         JcePEMEncryptorBuilder encBuild = new JcePEMEncryptorBuilder("DES-EDE3-CBC");
         PEMEncryptor myEncryptor = encBuild.build(keyPassword.toCharArray());
         

src/KeyStore/KeyStoreController.java

     private static KeyPair keyPair;
     private static String keyPassword;
     private static Certificate certificate;
+    private static String keyName;
+    private static String outputDir;
      /*    
      * Key Constructor with no arg
      * 
      */
-    public KeyStoreController(int bitLength, String keyPassword, String keyPath) {
+    public KeyStoreController(int bitLength, String keyPassword, String inKeyName, String inOutputDir) {
         try {
             //ASSUMES ALL NEW - new keypair and new CSR
-            //new keypair contructor (bitLenght, password, file)
-            KeyStoreController.keyPair = new KeyPair(bitLength, keyPassword, keyPath);
+            keyName = inKeyName;
+            outputDir = inOutputDir;
+            KeyStoreController.keyPair = new KeyPair(bitLength, keyPassword, keyName, outputDir);
             KeyStoreController.keyPassword = keyPassword;
         } catch (FileNotFoundException ex) {
             Logger.getLogger(KeyStoreController.class.getName()).log(Level.SEVERE, null, ex);
      * Key Constructor with filePath arg
      * 
      */
-    public KeyStoreController(String keyPassword, String keyPath) throws FileNotFoundException, IOException {
+    public KeyStoreController(String keyPassword, String keyName) throws FileNotFoundException, IOException {
             // opens existing keypair assuming filename 'myKeyPair.pem' and path provided
-        KeyStoreController.keyPair = new KeyPair(keyPassword, keyPath);
+        KeyStoreController.keyPair = new KeyPair(keyPassword, keyName);
         KeyStoreController.keyPassword = keyPassword;
     }
 
     public String getCSR(String x500Text) {
         String csrVal = null;
         try {       
-            csrVal = keyPair.getCSR(x500Text);
+            csrVal = keyPair.getCSR(x500Text, keyName, outputDir);
         } catch (IOException ex) {
             Logger.getLogger(KeyStoreController.class.getName()).log(Level.SEVERE, null, ex);
         }

src/KeyStoreGUI/ExistingKeyPanel.form

+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <Properties>
+    <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[494, 315]"/>
+    </Property>
+  </Properties>
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
+                      <Component id="keysFoundLabel" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="loadSelectedKeyButton" min="-2" pref="160" max="-2" attributes="0"/>
+                      <EmptySpace pref="150" max="32767" attributes="0"/>
+                      <Component id="openKeyFromFileButton" min="-2" pref="160" max="-2" attributes="0"/>
+                  </Group>
+                  <Component id="jScrollPane1" max="32767" attributes="0"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="1" attributes="0">
+              <EmptySpace pref="15" max="32767" attributes="0"/>
+              <Component id="keysFoundLabel" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="loadSelectedKeyButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="openKeyFromFileButton" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JList" name="existingKeySelector">
+          <Properties>
+            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+              <StringArray count="5">
+                <StringItem index="0" value="Item 1"/>
+                <StringItem index="1" value="Item 2"/>
+                <StringItem index="2" value="Item 3"/>
+                <StringItem index="3" value="Item 4"/>
+                <StringItem index="4" value="Item 5"/>
+              </StringArray>
+            </Property>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JLabel" name="keysFoundLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Keys Found:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JButton" name="loadSelectedKeyButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Load Selected Key"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loadSelectedKeyButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="openKeyFromFileButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Open From File"/>
+      </Properties>
+    </Component>
+  </SubComponents>
+</Form>

src/KeyStoreGUI/ExistingKeyPanel.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package KeyStoreGUI;
+
+/**
+ *
+ * @author lp1
+ */
+public class ExistingKeyPanel extends javax.swing.JPanel {
+
+    /**
+     * Creates new form ExistingKey
+     */
+    public ExistingKeyPanel() {
+        initComponents();
+    }
+
+    /**
+     * This method is called from within the constructor to initialize the form.
+     * WARNING: Do NOT modify this code. The content of this method is always
+     * regenerated by the Form Editor.
+     */
+    @SuppressWarnings("unchecked")
+    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+    private void initComponents() {
+
+        jScrollPane1 = new javax.swing.JScrollPane();
+        existingKeySelector = new javax.swing.JList();
+        keysFoundLabel = new javax.swing.JLabel();
+        loadSelectedKeyButton = new javax.swing.JButton();
+        openKeyFromFileButton = new javax.swing.JButton();
+
+        setPreferredSize(new java.awt.Dimension(494, 315));
+
+        existingKeySelector.setModel(new javax.swing.AbstractListModel() {
+            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+            public int getSize() { return strings.length; }
+            public Object getElementAt(int i) { return strings[i]; }
+        });
+        jScrollPane1.setViewportView(existingKeySelector);
+
+        keysFoundLabel.setText("Keys Found:");
+
+        loadSelectedKeyButton.setText("Load Selected Key");
+        loadSelectedKeyButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                loadSelectedKeyButtonActionPerformed(evt);
+            }
+        });
+
+        openKeyFromFileButton.setText("Open From File");
+
+        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(keysFoundLabel)
+                        .addGap(0, 0, Short.MAX_VALUE))
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(loadSelectedKeyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150, Short.MAX_VALUE)
+                        .addComponent(openKeyFromFileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(jScrollPane1))
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                .addContainerGap(15, Short.MAX_VALUE)
+                .addComponent(keysFoundLabel)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(loadSelectedKeyButton)
+                    .addComponent(openKeyFromFileButton))
+                .addGap(14, 14, 14))
+        );
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void loadSelectedKeyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadSelectedKeyButtonActionPerformed
+        // TODO add your handling code here:
+    }//GEN-LAST:event_loadSelectedKeyButtonActionPerformed
+
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JList existingKeySelector;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JLabel keysFoundLabel;
+    private javax.swing.JButton loadSelectedKeyButton;
+    private javax.swing.JButton openKeyFromFileButton;
+    // End of variables declaration//GEN-END:variables
+}

src/KeyStoreGUI/MainFrame.java

             }
         });
 
-        mainTabPanel.setMaximumSize(new java.awt.Dimension(862, 632));
-        mainTabPanel.addTab("Client SSL", new KeyPanel());
+        mainTabPanel.setSize(1024, 305);
+        mainTabPanel.addTab("Client SSL", new MainMenuPanel());
 
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
         getContentPane().setLayout(layout);
                 .addContainerGap())
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(mainTabPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 1071, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addComponent(mainTabPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 1024, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
         );
         layout.setVerticalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(mainTabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
+                .addComponent(mainTabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(quitButton)
                 .addContainerGap())

src/KeyStoreGUI/MainMenuPanel.form

 <?xml version="1.0" encoding="UTF-8" ?>
 
 <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <Properties>
+    <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[1023, 305]"/>
+    </Property>
+    <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+      <Dimension value="[1024, 305]"/>
+    </Property>
+  </Properties>
   <AuxValues>
     <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
     <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
-              <EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
+              <EmptySpace pref="13" max="32767" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
-                  <Component id="jScrollPane1" min="-2" pref="470" max="-2" attributes="0"/>
-                  <Group type="102" attributes="0">
-                      <Component id="generateNewButton" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace type="separate" max="-2" attributes="0"/>
-                      <Component id="openExistingButton" min="-2" max="-2" attributes="0"/>
-                  </Group>
+                  <Component id="jScrollPane1" alignment="1" min="-2" pref="470" max="-2" attributes="0"/>
+                  <Component id="generateNewButton" alignment="1" min="-2" pref="470" max="-2" attributes="0"/>
               </Group>
-              <EmptySpace pref="452" max="32767" attributes="0"/>
+              <EmptySpace type="separate" max="-2" attributes="0"/>
+              <Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="separate" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Component id="jScrollPane2" min="-2" pref="470" max="-2" attributes="0"/>
+                  <Component id="openExistingButton" min="-2" pref="470" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
     <DimensionLayout dim="1">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
-              <EmptySpace min="-2" pref="57" max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="generateNewButton" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="openExistingButton" alignment="3" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="1" attributes="0">
+                  <Component id="jSeparator1" alignment="1" min="-2" pref="273" max="-2" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="generateNewButton" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Component id="openExistingButton" alignment="0" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="1" attributes="0">
+                          <Component id="jScrollPane1" min="-2" pref="243" max="-2" attributes="0"/>
+                          <Component id="jScrollPane2" min="-2" pref="243" max="-2" attributes="0"/>
+                      </Group>
+                  </Group>
               </Group>
-              <EmptySpace type="separate" max="-2" attributes="0"/>
-              <Component id="jScrollPane1" min="-2" pref="243" max="-2" attributes="0"/>
-              <EmptySpace pref="362" max="32767" attributes="0"/>
+              <EmptySpace pref="14" max="32767" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
   <SubComponents>
     <Component class="javax.swing.JButton" name="generateNewButton">
       <Properties>
-        <Property name="text" type="java.lang.String" value="Generate new"/>
+        <Property name="text" type="java.lang.String" value="Generate new key and CSR"/>
       </Properties>
       <Events>
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateNewButtonActionPerformed"/>
     </Component>
     <Component class="javax.swing.JToggleButton" name="openExistingButton">
       <Properties>
-        <Property name="text" type="java.lang.String" value="Open existing"/>
+        <Property name="text" type="java.lang.String" value="Combine selected key with certificate"/>
       </Properties>
+      <Events>
+        <EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="openExistingButtonMouseReleased"/>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="openExistingButtonActionPerformed"/>
+      </Events>
     </Component>
     <Container class="javax.swing.JScrollPane" name="jScrollPane1">
       <AuxValues>
         </Component>
       </SubComponents>
     </Container>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JList" name="exitingKeyList">
+          <Properties>
+            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+              <StringArray count="5">
+                <StringItem index="0" value="Item 1"/>
+                <StringItem index="1" value="Item 2"/>
+                <StringItem index="2" value="Item 3"/>
+                <StringItem index="3" value="Item 4"/>
+                <StringItem index="4" value="Item 5"/>
+              </StringArray>
+            </Property>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JSeparator" name="jSeparator1">
+      <Properties>
+        <Property name="orientation" type="int" value="1"/>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>

src/KeyStoreGUI/MainMenuPanel.java

  *
  * @author lp1
  */
-public class KeyPanel extends javax.swing.JPanel {
+public class MainMenuPanel extends javax.swing.JPanel {
     private static Integer bitLength = 2048;
+    private static String outputDir = "output";
     /**
      * Creates new form KeyPanel
      */
-    public KeyPanel() {
+    public MainMenuPanel() {
         initComponents();
+        //Insert code for including a list of pemkeys
+        
     }
     
     private static String getPassword(String message) {
         openExistingButton = new javax.swing.JToggleButton();
         jScrollPane1 = new javax.swing.JScrollPane();
         csrTextField = new javax.swing.JTextArea();
+        jScrollPane2 = new javax.swing.JScrollPane();
+        exitingKeyList = new javax.swing.JList();
+        jSeparator1 = new javax.swing.JSeparator();
+
+        setMinimumSize(new java.awt.Dimension(1023, 305));
+        setPreferredSize(new java.awt.Dimension(1024, 305));
 
-        generateNewButton.setText("Generate new");
+        generateNewButton.setText("Generate new key and CSR");
         generateNewButton.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
                 generateNewButtonActionPerformed(evt);
             }
         });
 
-        openExistingButton.setText("Open existing");
+        openExistingButton.setText("Combine selected key with certificate");
+        openExistingButton.addMouseListener(new java.awt.event.MouseAdapter() {
+            public void mouseReleased(java.awt.event.MouseEvent evt) {
+                openExistingButtonMouseReleased(evt);
+            }
+        });
+        openExistingButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                openExistingButtonActionPerformed(evt);
+            }
+        });
 
         csrTextField.setEditable(false);
         csrTextField.setColumns(20);
         });
         jScrollPane1.setViewportView(csrTextField);
 
+        exitingKeyList.setModel(new javax.swing.AbstractListModel() {
+            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+            public int getSize() { return strings.length; }
+            public Object getElementAt(int i) { return strings[i]; }
+        });
+        jScrollPane2.setViewportView(exitingKeyList);
+
+        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
         this.setLayout(layout);
         layout.setHorizontalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
-                .addGap(38, 38, 38)
+                .addContainerGap(13, Short.MAX_VALUE)
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(generateNewButton)
-                        .addGap(18, 18, 18)
-                        .addComponent(openExistingButton)))
-                .addContainerGap(452, Short.MAX_VALUE))
+                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(generateNewButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addGap(18, 18, 18)
+                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addGap(18, 18, 18)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(openExistingButton, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addGap(29, 29, 29))
         );
         layout.setVerticalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
-                .addGap(57, 57, 57)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(generateNewButton)
-                    .addComponent(openExistingButton))
-                .addGap(18, 18, 18)
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap(362, Short.MAX_VALUE))
+                .addContainerGap()
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addComponent(generateNewButton)
+                            .addComponent(openExistingButton))
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE))))
+                .addContainerGap(14, Short.MAX_VALUE))
         );
     }// </editor-fold>//GEN-END:initComponents
 
             String cn = JOptionPane.showInputDialog(null, "Common name: ","", 1);
             String email = JOptionPane.showInputDialog(null, "Contact email: ","", 1);
             String x500Text = "C=" + c + ", O=" + o + ", CN=" + cn + ", EMAILADDRESS=" + email;
-            KeyStore.KeyStoreController newKeySess = new KeyStore.KeyStoreController(bitLength, keyPassword, cn + ".pem");
+            KeyStore.KeyStoreController newKeySess = new KeyStore.KeyStoreController(bitLength, keyPassword, cn, outputDir);
+            csrTextField.setVisible(true);
             csrTextField.setText(newKeySess.getCSR(x500Text));
         } else
              JOptionPane.showMessageDialog(null, "Passwords do not match", "Oops", JOptionPane.INFORMATION_MESSAGE);
         csrTextField.selectAll();
     }//GEN-LAST:event_csrTextFieldMouseClicked
 
+    private void openExistingButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_openExistingButtonMouseReleased
+        
+    }//GEN-LAST:event_openExistingButtonMouseReleased
+
+    private void openExistingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openExistingButtonActionPerformed
+        // TODO add your handling code here:
+    }//GEN-LAST:event_openExistingButtonActionPerformed
+
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JTextArea csrTextField;
+    private javax.swing.JList exitingKeyList;
     private javax.swing.JButton generateNewButton;
     private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JScrollPane jScrollPane2;
+    private javax.swing.JSeparator jSeparator1;
     private javax.swing.JToggleButton openExistingButton;
     // End of variables declaration//GEN-END:variables
 }

src/PackageController.java

-import KeyStore.KeyStoreController;
 import KeyStoreGUI.MainFrame;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Scanner;
 import javax.swing.JFrame;
 
 /**
 
 // Example: http://www.simsudo.com/generating-csr-using-java-and-bouncycastle-api.html
 public class PackageController {
-    
-    private static String x500Text = "C=AU, ST=Mel, L=Mel, O=tester1, OU=Null, CN=client_tester, EMAILADDRESS=test@local";
-    private static String keyPath = "myKeyPair.pem";
-    private static String keyPassword = "abc123";
-    private static String certPath = "myCert.pem";
-    private static String outputPath = "myPKCS12.p12";
  
     public static void main(String[] args) {
         JFrame newFrame = new MainFrame();