protected boolean testKey() { String data = UID.random(24); byte[] bb = RSA.encode(data.getBytes(), TConn.pub_key); if (bb != null) { bb = RSA.decode(bb, TConn.pri_key); if (bb != null && data.equals(new String(bb))) { return true; } } return false; }
private void sendRSA() { try { // print local cipherTextArea.append("RSAE" + rsa.getE()); cipherTextArea.append("RSAN" + rsa.getN()); // send the RSA stuff outputStrm.writeObject("RSAE" + rsa.getE()); outputStrm.writeObject("RSAN" + rsa.getN()); outputStrm.flush(); } catch (IOException e) { chatTextWindow.append(" Something messed up!\n"); } }
/** Inits the. */ public static synchronized void init() { if (inited) { return; } _conf = Config.getConfig(); /** initialize app command */ Command.init(); /** initialize the RSA key, hardcode 2048 bits */ TConn.pub_key = SystemConfig.s("pub_key", null); if (TConn.pub_key == null) { Key k = RSA.generate(2048); TConn.pri_key = k.pri_key; TConn.pub_key = k.pub_key; /** set back in database */ SystemConfig.setConfig("pri_key", TConn.pri_key); SystemConfig.setConfig("pub_key", TConn.pub_key); } else { /** get from the database */ TConn.pri_key = SystemConfig.s("pri_key", null); } inited = true; }
private String decrypting(String message) { int i = 0; while (message.substring(i, i + 1).compareTo(":") != 0 && i + 1 < message.length()) { i++; } i += 2; if (i + 2 >= message.length()) { return message; } String cMessage = message.substring(i); // System.out.println(cMessage); switch (cSelect) { case 0: return message.substring(0, i) + cMessage; case 1: return message.substring(0, i) + decryptCaesar(cMessage, Integer.parseInt(textFieldShift.getText())); case 2: vig.setKey(textFieldVigPass.getText()); return message.substring(0, i) + vig.decode(cMessage); case 3: tea.setKey(textFieldTEA.getText().getBytes()); return message.substring(0, i) + tea.decrypt(cMessage); case 4: return message.substring(0, i) + rsa.decrypt(cMessage); } return message; }
private void decodActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_decodActionPerformed // TODO add your handling code here: String outt = rsa.desencripta(textoCifrado); msj.setText(outt); } // GEN-LAST:event_decodActionPerformed
private int decryptKey(int[] a, int i) { long v; v = a[i + 0]; v = a[i + 1] + v * MAX; v = a[i + 2] + v * MAX; v = a[i + 3] + v * MAX; return (int) rsa_.decrypt(v); }
private void encryptKey(int k, int[] a, int i) { long v = rsa_.encrypt(k); a[i + 3] = (int) (v % MAX); v /= MAX; a[i + 2] = (int) (v % MAX); v /= MAX; a[i + 1] = (int) (v % MAX); v /= MAX; a[i + 0] = (int) (v % MAX); }
public String getEncryptedSharedSecret(String sharedSecret) { byte[] bytes = sharedSecret.getBytes(); int i = 0; String encSecret = ""; BigInteger givenMessage, p1, q1, e1; p1 = new BigInteger("13"); q1 = new BigInteger("19"); e1 = new BigInteger("5"); RSA rsa = new RSA(p1, q1, e1); while (i < bytes.length) { givenMessage = BigInteger.valueOf(bytes[i]); BigInteger encryptMessage = rsa.rsaEncrypt(givenMessage, new BigInteger("5"), new BigInteger("247")); encSecret = encSecret + new String(encryptMessage.toByteArray()); i++; } return encSecret; }
private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String num1, num2; long num = 0; objR = new RSA(); num1 = String.valueOf(objR.gen_Primo()); num2 = String.valueOf(objR.gen_Primo()); prime_1.setText(num1); prime_2.setText(num2); } // GEN-LAST:event_jButton1ActionPerformed
private void verificarActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_verificarActionPerformed // TODO add your handling code here: String msj = ""; objR = new RSA(); long num = Long.parseLong(verNum.getText()); if (objR.miller_rabin(num)) { mensaje.setText("El numero " + num + " es un numero Primo"); } else { mensaje.setText("El numero " + num + " es un numero Compuesto"); } } // GEN-LAST:event_verificarActionPerformed
private void keepChatting() throws IOException { String message = "Connected"; sendMessage(message); canUserType(true); btnSend.setEnabled(true); do { try { message = (String) inputStrm.readObject(); if (waitingOnRSA) { // System.out.println(message); // System.out.println(message.substring(0, 4)); if (message.substring(0, 4).compareToIgnoreCase("RSAE") == 0) { // System.out.println(message.substring(4)); rsaE = new BigInteger(message.substring(4)); rsa.setE(rsaE); // System.out.println("E"); } if (message.substring(0, 4).compareToIgnoreCase("RSAN") == 0) { rsaN = new BigInteger(message.substring(4)); rsa.setN(rsaN); waitingOnRSA = false; showMessage("RSA ENABLED\n"); // System.out.println("N"); } } if (message.substring(0, 3).compareTo("RSA") != 0) { showDecryptMessage(message); } } catch (ClassNotFoundException e) { showMessage("WTF?"); } catch (SocketException e) { safelyShutDown(); } } while (!message.equals("END")); }
private void jButton2ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed String textoPlano = textoC.getText(); textoCifrado = rsa.encripta(textoPlano); for (int i = 0; i < textoCifrado.length; i++) { out += textoCifrado[i].toString(); textoE.setText(out); } textoE.setText(out); // } // GEN-LAST:event_jButton2ActionPerformed
/** * Instantiates a new MDC server. * * @param host the host * @param port the port */ protected MDCServer(String host, int port) { _conf = Config.getConfig(); address = (host == null) ? new InetSocketAddress(port) : new InetSocketAddress(host, port); /** initialize app command */ Command.init(); /** initialize the connection center */ TConnCenter.init(_conf, port); synchronized (_conf) { /** load public key from database */ TConn.pub_key = SystemConfig.s("pub_key", null); TConn.pri_key = SystemConfig.s("pri_key", null); /** initialize the RSA key, hardcode 2048 bits */ if (TConn.pub_key == null || TConn.pri_key == null || "".equals(TConn.pub_key) || "".equals(TConn.pri_key)) { /** print out the old state */ log.warn( "the pub_key or pri_key missed, the old state are pub_key:[" + TConn.pub_key + "], pri_key:[" + TConn.pri_key + "]"); Key k = RSA.generate(2048); TConn.pri_key = k.pri_key; TConn.pub_key = k.pub_key; /** print out the new public key */ log.warn("create new RSA key pair, pub_key:[" + TConn.pub_key + ']'); /** set back in database */ SystemConfig.setConfig("pri_key", TConn.pri_key); SystemConfig.setConfig("pub_key", TConn.pub_key); } MAX_SIZE = SystemConfig.i("mdc.max_size", MAX_SIZE); } }
private String encrypting(String message) { switch (cSelect) { case 0: return message; case 1: // System.out.println("." + Integer.parseInt(textFieldShift.getText()) + "."); return encryptCaesar(message, Integer.parseInt(textFieldShift.getText())); case 2: vig.setKey(textFieldVigPass.getText()); return vig.encode(message); case 3: tea.setKey(textFieldTEA.getText().getBytes()); return tea.encrypt(message); case 4: if (waitingOnRSA) { return message; } else { return rsa.encryptOther(message); } } return message; }
private void buildGUI() { Border border = BorderFactory.createLineBorder(Color.black, 1, false); Border empty = new EmptyBorder(4, 4, 4, 4); CompoundBorder cborder = new CompoundBorder(border, empty); chatTextWindow.setBorder(cborder); jsp = new JScrollPane(chatTextWindow); chatPanel.add(jsp); sb = jsp.getVerticalScrollBar(); inputPanel = new JPanel(); inputPanel.setLayout(new GridLayout(0, 1, 0, 0)); border = BorderFactory.createLineBorder(Color.black, 1, false); // createLineBorder(Color.BLACK); empty = new EmptyBorder(4, 4, 4, 4); cborder = new CompoundBorder(border, empty); userText = new JTextArea(); userText.setToolTipText(""); userText.setWrapStyleWord(true); userText.setLineWrap(true); userText.setBorder(cborder); // userText.setMargin(new Insets(20, 20, 20, 20)); userText.setFont(new Font("Tahoma", Font.PLAIN, 13)); // add(); inputPanel.add(new JScrollPane(userText)); btnSend = new JButton("Send"); btnSend.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { userName = nameTextField.getText(); sendMessage(userText.getText()); userText.setText(""); } }); btnSend.setFont(new Font("Tahoma", Font.PLAIN, 13)); btnSend.setEnabled(false); JPanel panelCipher = new JPanel(); panelCipher.setLayout(new GridLayout(0, 1, 0, 0)); JLabel lblCiphertext = new JLabel("CipherText:"); JTabbedPane panelChoice = new JTabbedPane(JTabbedPane.TOP); JPanel panelStart = new JPanel(); panelStart.setBorder( new TitledBorder( new LineBorder(new Color(0, 0, 0)), "Connection", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); JLabel lblConversationAndPlain = new JLabel("Conversation and Plain Text:"); lblThankYou = new JLabel("Thank you for using our Secure Instant Messager"); lblThankYou.setHorizontalAlignment(SwingConstants.CENTER); lblNewLabel_1 = new JLabel("Designed and Developed by Adam Gorman and Unknown other"); lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addGroup( groupLayout .createSequentialGroup() .addContainerGap() .addGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent( inputPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( groupLayout .createSequentialGroup() .addGap(10) .addComponent(lblConversationAndPlain)) .addComponent(chatPanel, 0, 0, Short.MAX_VALUE) .addComponent( panelStart, GroupLayout.PREFERRED_SIZE, 440, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addGroup( groupLayout .createSequentialGroup() .addComponent( btnSend, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout .createParallelGroup(Alignment.LEADING, false) .addComponent( lblNewLabel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( lblThankYou, GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)) .addGap(165)) .addGroup( groupLayout .createSequentialGroup() .addGap(10) .addComponent(lblCiphertext)) .addGroup( groupLayout .createParallelGroup(Alignment.TRAILING, false) .addComponent(panelChoice, Alignment.LEADING) .addComponent( panelCipher, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE))) .addGap(41))); groupLayout.setVerticalGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addGroup( groupLayout .createSequentialGroup() .addContainerGap() .addGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent( panelStart, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) .addComponent( panelChoice, GroupLayout.PREFERRED_SIZE, 101, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout .createParallelGroup(Alignment.BASELINE) .addComponent(lblCiphertext) .addComponent(lblConversationAndPlain)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent( panelCipher, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( chatPanel, GroupLayout.PREFERRED_SIZE, 434, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent( inputPanel, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE) .addComponent( btnSend, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE) .addGroup( groupLayout .createSequentialGroup() .addComponent(lblThankYou) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblNewLabel_1))) .addContainerGap())); panelStart.setLayout(null); lblIp = new JLabel("IP:"); lblIp.setBounds(37, 59, 22, 16); panelStart.add(lblIp); lblIp.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblName = new JLabel("Name:"); lblName.setBounds(10, 25, 49, 16); panelStart.add(lblName); lblName.setHorizontalAlignment(SwingConstants.RIGHT); lblName.setFont(new Font("Tahoma", Font.PLAIN, 13)); nameTextField = new JTextField(); nameTextField.setBounds(66, 22, 138, 22); panelStart.add(nameTextField); nameTextField.setText("AliceBob"); nameTextField.setColumns(10); btnHost = new JButton("Host"); btnHost.setBounds(216, 21, 97, 25); panelStart.add(btnHost); btnJoin = new JButton("Join"); btnJoin.setBounds(216, 55, 97, 25); panelStart.add(btnJoin); ipHostTextField = new JTextField(); ipHostTextField.setBounds(66, 56, 138, 22); panelStart.add(ipHostTextField); ipHostTextField.setText("127.0.0.1"); ipHostTextField.setColumns(10); btnJoin.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { serverIP = ipHostTextField.getText(); btnJoin.setEnabled(false); btnHost.setEnabled(false); new Thread( new Runnable() { @Override public void run() { startRunning(); } }) .start(); } }); btnHost.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnJoin.setEnabled(false); btnHost.setEnabled(false); new Thread( new Runnable() { @Override public void run() { StartHosting(); } }) .start(); } }); JPanel panel_5 = new JPanel(); panelChoice.addTab(" Settings ", null, panel_5, null); buildRadio(panel_5); JPanel panel_6 = new JPanel(); panelChoice.addTab(" Caesar Shift ", null, panel_6, null); panel_6.setLayout(new GridLayout(0, 1, 5, 0)); lblShiftAmount = new JLabel("Shift Amount: "); lblShiftAmount.setHorizontalAlignment(SwingConstants.CENTER); panel_6.add(lblShiftAmount); textFieldShift = new JTextField(); textFieldShift.setHorizontalAlignment(SwingConstants.CENTER); textFieldShift.setText("0"); panel_6.add(textFieldShift); textFieldShift.setColumns(10); btnCShiftApply = new JButton("Apply"); btnCShiftApply.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }); panel_6.add(btnCShiftApply); scrollPane = new JScrollPane(); sb2 = scrollPane.getVerticalScrollBar(); panelCipher.add(scrollPane); cipherTextArea = new JTextArea(); cipherTextArea.setBorder(cborder); scrollPane.setViewportView(cipherTextArea); cipherTextArea.setLineWrap(true); cipherTextArea.setWrapStyleWord(true); getContentPane().setLayout(groupLayout); userText.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent k) { if (k.getKeyChar() == KeyEvent.VK_ENTER) { userName = nameTextField.getText(); sendMessage(userText.getText()); } } @Override public void keyReleased(KeyEvent k) { if (k.getKeyChar() == KeyEvent.VK_ENTER) { userText.setText(""); } } }); setSize(1010, 700); menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { safelyShutDown(); // setVisible(false); // dispose(); } }); mnFile.add(mntmExit); panel_2 = new JPanel(); panelChoice.addTab(" Vigenere Cipher ", null, panel_2, null); panel_2.setLayout(new GridLayout(0, 1, 0, 0)); JLabel lblSymmetricPassword = new JLabel("Symmetric password:"******"Apply"); btnVigApply.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }); panel_2.add(btnVigApply); panel_3 = new JPanel(); panelChoice.addTab(" TEA ", null, panel_3, null); panel_3.setLayout(new GridLayout(0, 1, 0, 0)); JLabel lblSymmetricPassphrase = new JLabel("Symmetric passphrase:"); lblSymmetricPassphrase.setHorizontalAlignment(SwingConstants.CENTER); panel_3.add(lblSymmetricPassphrase); textFieldTEA = new JTextField(); textFieldTEA.setHorizontalAlignment(SwingConstants.CENTER); panel_3.add(textFieldTEA); textFieldTEA.setColumns(10); JButton btnApplyTEA = new JButton("Apply"); btnApplyTEA.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }); panel_3.add(btnApplyTEA); panel_1 = new JPanel(); panelChoice.addTab(" RSA ", null, panel_1, null); panel_1.setLayout(null); lblNewLabel = new JLabel("Public (e):"); lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT); lblNewLabel.setBounds(12, 13, 77, 16); panel_1.add(lblNewLabel); RSAPublicE = new JTextField(); RSAPublicE.setText("65324"); RSAPublicE.setBounds(101, 10, 412, 22); panel_1.add(RSAPublicE); RSAPublicE.setColumns(10); lblModulus = new JLabel("Modulus (N):"); lblModulus.setHorizontalAlignment(SwingConstants.RIGHT); lblModulus.setBounds(12, 42, 77, 16); panel_1.add(lblModulus); RSAPublicN = new JTextField(); RSAPublicN.setHorizontalAlignment(SwingConstants.LEFT); // RSAPublicN.setText("8256"); RSAPublicN.setBounds(101, 39, 412, 22); panel_1.add(RSAPublicN); RSAPublicN.setColumns(10); RSAPublicE.setText(rsa.getE().toString()); RSAPublicN.setText(rsa.getN().toString()); }
/** Load application settings from persistent store. */ public void load() { Preferences preferences = getUnderlyingPreferences(); // Authority certificates useCaCertificates = preferences.getBoolean(KSE3_USECACERTS, false); String cacertsPath = preferences.get( KSE3_CACERTSFILE, AuthorityCertificates.getDefaultCaCertificatesLocation().toString()); caCertificatesFile = cleanFilePath(new File(cacertsPath)); useWindowsTrustedRootCertificates = preferences.getBoolean(KSE3_USEWINTRUSTROOTCERTS, false); // Trust checks enableImportTrustedCertTrustCheck = preferences.getBoolean(KSE3_ENABLEIMPORTTRUSTEDCERTTRUSTCHECK, false); enableImportCaReplyTrustCheck = preferences.getBoolean(KSE3_ENABLEIMPORTCAREPLYTRUSTCHECK, false); // Key pair generation generateKeyPairType = KeyPairType.resolveJce(preferences.get(KSE3_KEYPAIRTYPE, RSA.jce())); if (generateKeyPairType == null) { generateKeyPairType = RSA; } int defaultKeyPairSize; if (generateKeyPairType == RSA) { defaultKeyPairSize = 2048; } else { defaultKeyPairSize = 1024; // DSA } generateKeyPairSize = preferences.getInt(KSE3_KEYPAIRSIZE, defaultKeyPairSize); // Secret key generation generateSecretKeyType = SecretKeyType.resolveJce(preferences.get(KSE3_SECKEYTYPE, AES.jce())); if (generateSecretKeyType == null) { generateSecretKeyType = AES; } generateSecretKeySize = preferences.getInt(KSE3_SECKEYSIZE, 192); // Certificate fingerprint certificateFingerprintType = DigestType.resolveJce(preferences.get(KSE3_CERTFINGERTYPE, SHA1.jce())); if (certificateFingerprintType == null) { certificateFingerprintType = SHA1; } // Password quality passwordQualityConfig = new PasswordQualityConfig( preferences.getBoolean(KSE3_PWDQUALENABLE, false), preferences.getBoolean(KSE3_MINPWDQUALENFORCE, false), preferences.getInt(KSE3_MINPWDQUAL, 60)); // Internet proxy settings ProxyConfigurationType proxyConfigurationType = ProxyConfigurationType.resolve( preferences.get(KSE3_PROXY, ProxyConfigurationType.SYSTEM.name())); // default should be system settings because of "java.net.useSystemProxies=true", save it for // later usage SystemProxySelector.setSystemProxySelector(ProxySelector.getDefault()); switch (proxyConfigurationType) { case NONE: ProxySelector.setDefault(new NoProxySelector()); break; case PAC: // Use PAC URL for proxy configuration String pacUrl = preferences.get(KSE3_PACURL, null); if (pacUrl != null) { ProxySelector.setDefault(new PacProxySelector(pacUrl)); } else { ProxySelector.setDefault(new NoProxySelector()); } break; case MANUAL: // Use manual settings for HTTP, HTTPS and SOCKS ProxyAddress httpProxyAddress = null; ProxyAddress httpsProxyAddress = null; ProxyAddress socksProxyAddress = null; String httpHost = preferences.get(KSE3_HTTPHOST, null); int httpPort = preferences.getInt(KSE3_HTTPPORT, 0); if (httpHost != null && httpPort > 0) { httpProxyAddress = new ProxyAddress(httpHost, httpPort); } String httpsHost = preferences.get(KSE3_HTTPSHOST, null); int httpsPort = preferences.getInt(KSE3_HTTPSPORT, 0); if (httpsHost != null && httpsPort > 0) { httpsProxyAddress = new ProxyAddress(httpsHost, httpsPort); } String socksHost = preferences.get(KSE3_SOCKSHOST, null); int socksPort = preferences.getInt(KSE3_SOCKSPORT, 0); if (socksHost != null && socksPort > 0) { socksProxyAddress = new ProxyAddress(socksHost, socksPort); } if (httpProxyAddress != null || httpsProxyAddress != null) { ProxySelector.setDefault( new ManualProxySelector( httpProxyAddress, httpsProxyAddress, null, socksProxyAddress)); } else { // no manual settings - use no proxy to connect to the Internet ProxySelector.setDefault(new NoProxySelector()); } break; case SYSTEM: default: ProxySelector.setDefault(new SystemProxySelector()); break; } // Application size and position sizeAndPosition = new Rectangle( preferences.getInt(KSE3_XPOS, 0), preferences.getInt(KSE3_YPOS, 0), preferences.getInt(KSE3_WIDTH, KseFrame.DEFAULT_WIDTH), preferences.getInt(KSE3_HEIGHT, KseFrame.DEFAULT_HEIGHT)); // User interface showToolBar = preferences.getBoolean(KSE3_SHOWTOOLBAR, true); showStatusBar = preferences.getBoolean(KSE3_SHOWSTATUSBAR, true); tabLayout = preferences.getInt(KSE3_TABLAYOUT, JTabbedPane.WRAP_TAB_LAYOUT); // Recent files ArrayList<File> recentFilesList = new ArrayList<File>(); for (int i = 1; i <= KseFrame.RECENT_FILES_SIZE; i++) { String recentFile = preferences.get(KSE3_RECENTFILE + i, null); if (recentFile == null) { break; } else { recentFilesList.add(cleanFilePath(new File(recentFile))); } } recentFiles = recentFilesList.toArray(new File[recentFilesList.size()]); // Current directory String currentDirectoryStr = preferences.get(KSE3_CURRENTDIR, null); if (currentDirectoryStr != null) { currentDirectory = cleanFilePath(new File(currentDirectoryStr)); } // Look and feel lookAndFeelClass = preferences.get(KSE3_LOOKFEEL, null); lookAndFeelDecorated = preferences.getBoolean(KSE3_LOOKFEELDECOR, false); // Licensing licenseAgreed = preferences.getBoolean(KSE3_LICENSEAGREED, false); // Tip of the day showTipsOnStartUp = preferences.getBoolean(KSE3_TIPSONSTARTUP, true); nextTipIndex = preferences.getInt(KSE3_TIPINDEX, 0); // Default distinguished name defaultDN = preferences.get(KSE3_DEFAULTDN, ""); // SSL host names and ports for "Examine SSL" sslHosts = preferences.get(KSE3_SSLHOSTS, "www.google.com;www.amazon.com"); sslPorts = preferences.get(KSE3_SSLPORTS, "443"); // auto update check autoUpdateCheckEnabled = preferences.getBoolean(KSE3_AUTO_UPDATE_CHECK_ENABLED, true); autoUpdateCheckInterval = preferences.getInt(KSE3_AUTO_UPDATE_CHECK_INTERVAL, 14); autoUpdateCheckLastCheck = getDate(preferences, KSE3_AUTO_UPDATE_CHECK_LAST_CHECK, new Date()); // PKCS#11 libraries p11Libs = preferences.get(KSE3_PKCS11_LIBS, ""); }