void getTable() { if (chooser == null) { File userdir = new File(System.getProperty("user.dir")); chooser = new JFileChooser(userdir); } if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); fileLength = file.length(); setTitle(windowTitle + ": " + file.getAbsolutePath()); int size = Key.getEncryptionKeySize(this, true); key = Key.getEncryptionKey(this, true, size); if (key == null) key = defaultKey; initCipher(); } else System.exit(0); }
// Reads the contents of the passed file into a string public String getContents(File file) { StringBuilder result = new StringBuilder(); try { BufferedReader input = new BufferedReader(new FileReader(file)); String nextLine = new String(); while ((nextLine = input.readLine()) != null) { result.append(nextLine); result.append(System.getProperty("line.separator")); } input.close(); } catch (Exception e) { System.out.println("Encryption/Decryption File Error: " + e); } return result.toString(); }
public String toString() { String LINE_SEP = System.getProperty("line.separator"); StringBuffer strbuf = new StringBuffer( "SunJCE Diffie-Hellman Public Key:" + LINE_SEP + "y:" + LINE_SEP + Debug.toHexString(this.y) + LINE_SEP + "p:" + LINE_SEP + Debug.toHexString(this.p) + LINE_SEP + "g:" + LINE_SEP + Debug.toHexString(this.g)); if (this.l != 0) strbuf.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l); return strbuf.toString(); }