- Timestamp:
- 05/07/19 14:08:23 (5 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/assets/resources-public/framesets/authentication/4.exp
r1351 r1357 1 V 1 771 V 181 2 2 p 40 3 3 U authadmin 4 4 D 07Jan2019[14:34] 5 5 M nobody 6 d 0 6May2019[11:49]6 d 07May2019[11:27] 7 7 B 100 100 39 100 8 8 Z … … 167 167 s 29Apr2019[15:40.59] 168 168 d 0 0 0 100 169 P 2380169 P 16 380 170 170 e 100 59 59 100 171 171 N 380 … … 179 179 s 29Apr2019[15:40.59] 180 180 d 0 0 0 100 181 P 9 77380181 P 991 380 182 182 e 100 59 59 100 183 183 N 380 … … 205 205 M 300 206 206 h 1.0 207 p 44 207 208 _ph Password Piece Two 208 209 … … 224 225 M 300 225 226 h 1.0 227 p 44 226 228 _ph Password Piece One 227 229 … … 301 303 Z 302 304 303 ActiveTime:01:24:4 2305 ActiveTime:01:24:43 304 306 DarkTime:02:32:46 305 49:58:429 719 350 Ld 306 49:58:430 719 350 Rd 307 49:58:932 719 350 Ru 308 49:59:027 719 350 Lu 309 50:00:284 905 338 Md 310 50:00:355 905 338 Rd 311 50:00:508 905 338 Mu 312 50:00:523 905 338 Ru 313 50:05:239 1187 159 Md 314 50:05:308 1187 159 Rd 315 50:05:484 1187 159 Ru 316 50:05:485 1187 159 Mu 307 27:47:127 281 438 Ld 308 27:47:238 281 438 Rd 309 27:47:374 281 438 Ru 310 27:47:382 281 438 Lu 311 27:48:551 629 275 Rd 312 27:48:646 629 275 Ru 313 27:51:670 129 185 Md 314 27:51:790 129 185 Mu 315 27:52:711 137 262 Md 316 27:52:919 137 258 Mu 317 27:53:574 142 203 Md 318 27:53:734 142 203 Mu 319 28:03:310 1265 166 kSHIFT 320 28:03:810 1265 166 kSHIFT 321 28:03:843 1265 166 kSHIFT 322 28:03:876 1265 166 kSHIFT 323 28:03:909 1265 166 kSHIFT 324 28:03:942 1265 166 kSHIFT 325 28:03:975 1265 166 kSHIFT 326 28:03:982 1265 166 kA 327 28:04:310 1278 166 kU 328 28:04:478 1287 166 kT 329 28:04:574 1292 166 kH 330 28:04:798 1301 166 kSHIFT 331 28:04:894 1301 166 kA 332 28:05:158 1314 166 kD 333 28:05:390 1323 166 kM 334 28:05:919 1337 166 kBACKSPACE 335 28:06:419 1323 166 kBACKSPACE 336 28:06:458 1314 166 kBACKSPACE 337 28:06:489 1301 166 kBACKSPACE 338 28:06:520 1292 166 kBACKSPACE 339 28:06:551 1287 166 kBACKSPACE 340 28:06:583 1278 166 kBACKSPACE 341 28:06:616 1265 166 kBACKSPACE 342 28:06:649 1265 166 kBACKSPACE 343 28:06:682 1265 166 kBACKSPACE 344 28:06:694 1265 166 kSHIFT 345 28:06:846 1265 166 kT 346 28:07:048 1276 166 kO 347 28:07:230 1285 166 kG 348 28:07:374 1294 166 kG 349 28:07:439 1303 166 kL 350 28:07:582 1308 166 kE 351 28:07:734 1316 166 kSHIFT 352 28:07:806 1316 166 kA 353 28:08:031 1329 166 kU 354 28:08:174 1338 166 kT 355 28:08:287 1343 166 kH 356 28:08:639 1352 166 kCTRL 357 28:08:799 1352 166 kA 358 28:10:503 1327 164 Md 359 28:10:677 1327 164 Mu 360 28:11:576 1264 173 Md 361 28:11:701 1261 173 Mu 362 28:16:638 1268 163 kSHIFT 363 28:16:902 1268 163 kT 364 28:17:206 1279 163 kO 365 28:17:470 1288 163 kG 366 28:17:614 1297 163 kG 367 28:17:718 1306 163 kL 368 28:17:854 1311 163 kE 369 28:18:006 1319 163 kSHIFT 370 28:18:094 1319 163 kA 371 28:18:261 1332 163 kU 372 28:18:430 1341 163 kT 373 28:18:470 1346 163 kH 374 28:18:742 1355 163 kCTRL 375 28:18:918 1355 163 kA 376 28:20:975 1318 166 Ld 377 28:21:118 1318 166 Lu 378 28:26:463 802 382 Md 379 28:26:638 802 382 Mu 380 28:28:223 802 382 kALT 381 28:28:631 802 382 kRIGHT_ARROW 382 28:44:544 816 382 Md 383 28:44:766 816 382 Mu 384 28:47:295 1281 159 Md 385 28:47:559 1281 159 Rd 386 28:47:910 1281 159 Ru 387 28:47:958 1281 159 Mu -
trunk/src/org/expeditee/auth/Actions.java
r1348 r1357 22 22 import java.util.Collection; 23 23 import java.util.HashMap; 24 import java.util.Iterator; 24 25 import java.util.List; 25 26 import java.util.Map; … … 38 39 import org.expeditee.auth.account.Authenticate.AuthenticationResult; 39 40 import org.expeditee.auth.account.Create; 41 import org.expeditee.auth.account.Create.CreateResult; 40 42 import org.expeditee.auth.account.Password; 41 43 import org.expeditee.auth.gui.MailBay; … … 49 51 import org.expeditee.items.Text; 50 52 import org.expeditee.settings.UserSettings; 53 import org.expeditee.settings.identity.passwordrecovery.Colleagues; 51 54 import org.expeditee.settings.identity.secrets.KeyList; 52 55 import org.expeditee.stats.Formatter; … … 78 81 Mail.sendMail(mail, recipient); 79 82 MessageBay.displayMessage("Test message sent."); 83 } 84 public static void SetPWColleagues(String colleagueOne, String colleagueTwo) { 85 Colleagues.Colleague_One.set(colleagueOne); 86 Colleagues.Colleague_Two.set(colleagueTwo); 87 Colleagues.Colleague_One_Email.set("[email protected]"); 88 Colleagues.Colleague_Two_Email.set("[email protected]"); 80 89 } 81 90 … … 181 190 } 182 191 183 Create.createAccount(userData); 184 Authenticate.login(userData); 185 AuthenticatorBrowser.Authenticated = true; 192 CreateResult result = Create.createAccount(userData); 193 if (result == CreateResult.SuccessCreateAccount) { 194 Authenticate.login(userData); 195 AuthenticatorBrowser.Authenticated = true; 196 } else { 197 MessageBay.errorMessage(result.toString()); 198 } 186 199 } else { 187 200 MessageBay.errorMessage("Please fill out all the supplied text boxes."); … … 196 209 */ 197 210 public static void AuthLogin() { 198 finalCollection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();199 finalOptional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, AuthenticationTag.Password);211 Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems(); 212 Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, AuthenticationTag.Password); 200 213 if (userdata.isPresent()) { 201 214 AuthenticationResult result = Authenticate.login(userdata.get()); 202 215 if (result == AuthenticationResult.SuccessLogin) { 203 216 MessageBay.displayMessage(result.toString()); 217 AuthenticatorBrowser.Authenticated = true; 204 218 } else { 205 219 MessageBay.errorMessage(result.toString()); 206 220 } 207 //login(userdata.get());208 AuthenticatorBrowser.Authenticated = true;209 221 } else { 210 222 MessageBay.errorMessage("Please fill out all the supplied text boxes."); … … 258 270 } 259 271 260 public static void Auth ResetPasswordPt1() {272 public static void AuthDistributeIntergalacticNumber() { 261 273 Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems(); 262 Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username); 274 Optional<Map<AuthenticationTag, String>> userdata = 275 AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username); 263 276 if (userdata.isPresent()) { 264 277 Map<AuthenticationTag, String> userData = userdata.get(); … … 267 280 userData.put(AuthenticationTag.Email, email); 268 281 Password.generateAndDeliverIntergalacticNumber(userData); 269 MessageBay.displayMessage("A Intergalactic number has been sent to the email associated with your account. Enter it below to proceed."); 270 } 271 } 272 273 public static void AuthResetPasswordPt2() { 282 MessageBay.displayMessage("A identity number has been sent to the email " 283 + "associated with your account. Enter it below to proceed."); 284 } 285 } 286 287 public static void AuthSubmitIntergalacticNumber() { 274 288 Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems(); 275 Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, 276 AuthenticationTag.IntergalacticNumber, AuthenticationTag.NewPassword, AuthenticationTag.NewPasswordAgain); 289 Optional<Map<AuthenticationTag, String>> userdata = 290 AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, 291 AuthenticationTag.IntergalacticNumber); 277 292 if (userdata.isPresent()) { 278 Map<AuthenticationTag, String> userData = userdata.get(); 279 String username = userData.get(AuthenticationTag.Username); 280 String email = getEmailFromUsername(username); 281 userData.put(AuthenticationTag.Email, email); 282 Password.confirmIntergalacticNumberAndGenerateSubstituteAccount(userData); 293 Map<AuthenticationTag, String> tags = userdata.get(); 294 String username = tags.get(AuthenticationTag.Username); 295 String intergalacticNumber = tags.get(AuthenticationTag.IntergalacticNumber); 296 boolean match = false; 297 try { 298 match = AuthenticatorBrowser.getInstance().confirmIntergalaticNumber(username, intergalacticNumber); 299 } catch (NoSuchAlgorithmException | KeyStoreException | CertificateException | ClassNotFoundException 300 | IOException | SQLException e) { 301 e.printStackTrace(); 302 return; 303 } 304 if (!match) { 305 MessageBay.errorMessage("The provided identity number does not match the one stored on file."); 306 return; 307 } 308 String[] colleagues = getPasswordColleaguesFromUsername(username); 309 Password.confirmIntergalacticNumberAndAlertColleagues(userdata.get(), colleagues); 283 310 } 284 311 } 285 312 286 313 private static String getEmailFromUsername(String username) { 287 Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();288 314 Path credentialsDirPath = Paths.get(FrameIO.PROFILE_PATH).resolve(username).resolve(username + "-credentials"); 289 315 Path credentialsFilePath = credentialsDirPath.resolve("credentials.inf"); … … 303 329 int number = Integer.parseInt(fileName.replace(".exp", "")); 304 330 Frame credentialsFrame = FrameIO.LoadFrame(username + number, FrameIO.PROFILE_PATH); 305 textItems = credentialsFrame.getTextItems();331 Collection<Text> textItems = credentialsFrame.getTextItems(); 306 332 textItems.removeIf(text -> !text.getText().startsWith("Email: ")); 307 333 if (textItems.isEmpty()) { … … 313 339 return email; 314 340 } 341 } 342 343 private static String[] getPasswordColleaguesFromUsername(String username) { 344 Path credentialsDirPath = Paths.get(FrameIO.PROFILE_PATH).resolve(username).resolve(username + "-credentials"); 345 Path credentialsFilePath = credentialsDirPath.resolve("pwcolleagues.inf"); 346 String fileName = null; 347 if (credentialsFilePath.toFile().exists()) { 348 try (Scanner in = new Scanner(credentialsFilePath)) { 349 fileName = in.nextLine(); 350 } catch (IOException e) { 351 MessageBay.errorMessage("Unable to password colleague frame for specified user, are they registered on this computer?"); 352 return null; 353 } 354 } else { 355 MessageBay.errorMessage("Unable to password colleague frame for specified user, are they registered on this computer?"); 356 return null; 357 } 358 359 int number = Integer.parseInt(fileName.replace(".exp", "")); 360 Frame pwColleagueFrame = FrameIO.LoadFrame(username + number, FrameIO.PROFILE_PATH); 361 Collection<Text> textItems = pwColleagueFrame.getTextItems(); 362 textItems.removeIf(text -> !text.getText().startsWith("Colleague")); 363 364 String[] ret = new String[4]; 365 Iterator<Text> it = textItems.iterator(); 366 while(it.hasNext()) { 367 String content = it.next().getText().toLowerCase().trim(); 368 if (content.contains("colleague_one:")) { 369 ret[0] = content.replace("colleague_one:", "").trim(); 370 } else if (content.contains("colleague_two:")) { 371 ret[1] = content.replace("colleague_two:", "").trim(); 372 } else if (content.contains("colleague_one_email:")) { 373 ret[2] = content.replace("colleague_one_email:", "").trim(); 374 } else if (content.contains("colleague_two_email:")) { 375 ret[3] = content.replace("colleague_two_email:", "").trim(); 376 } 377 } 378 return ret; 315 379 } 316 380 -
trunk/src/org/expeditee/auth/AuthenticatorBrowser.java
r1352 r1357 151 151 FileNotFoundException, IOException { 152 152 // Fetch desired password 153 @SuppressWarnings("resource") 153 154 Scanner in = new Scanner(System.in); 154 155 System.out.println("No administrative password set."); … … 164 165 // Register account. 165 166 putKey(ADMINACCOUNT, password, new SecretKeySpec("null".getBytes(), AsymmetricAlgorithm)); 166 in.close();167 //in.close(); 167 168 passwordIsSet = true; 168 169 break; … … 327 328 } 328 329 329 public final boolean confirmIntergalaticNumber(final String username, final String email, final StringintergalacticNumber) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException {330 public final boolean confirmIntergalaticNumber(final String username, final String intergalacticNumber) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException { 330 331 try { 331 finalKeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(intergalacticNumber.toCharArray());332 final KeyStore.SecretKeyEntry entry = (SecretKeyEntry) keyStore.getEntry(email + username, entryPassword);333 if (entry == null) { 332 KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(intergalacticNumber.toCharArray()); 333 KeyStore.SecretKeyEntry entry = (SecretKeyEntry) keyStore.getEntry(username + "_IntergalacticNumber", entryPassword); 334 if (entry == null) { 334 335 return false; 335 336 } else if (Arrays.equals(entry.getSecretKey().getEncoded(), TRUE)) { 336 keyStore.deleteEntry( email + username);337 keyStore.deleteEntry(username + "_IntergalacticNumber"); 337 338 keyStore.store(new FileOutputStream(FrameIO.PARENT_FOLDER + KEYSTOREFILENAME), "ExpediteeAuthPassword".toCharArray()); 338 339 return true; 339 } else { return false; } 340 } else { 341 return false; 342 } 340 343 } catch (final UnrecoverableEntryException e) { 341 344 return false; … … 351 354 352 355 // store intergalactic number 353 finalKeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(new SecretKeySpec(TRUE, SymmetricAlgorithm));354 finalKeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(intergalacticNumber.toCharArray());355 keyStore.setEntry( email + username, entry, entryPassword);356 KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(new SecretKeySpec(TRUE, SymmetricAlgorithm)); 357 KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(intergalacticNumber.toCharArray()); 358 keyStore.setEntry(username + "_IntergalacticNumber", entry, entryPassword); 356 359 keyStore.store(new FileOutputStream(FrameIO.PARENT_FOLDER + KEYSTOREFILENAME), "ExpediteeAuthPassword".toCharArray()); 357 360 -
trunk/src/org/expeditee/auth/Mail.java
r1320 r1357 33 33 import javax.crypto.IllegalBlockSizeException; 34 34 import javax.crypto.NoSuchPaddingException; 35 import javax.crypto.SecretKey; 36 import javax.crypto.spec.SecretKeySpec; 35 37 36 38 import org.expeditee.auth.gui.MailBay; … … 54 56 } 55 57 58 public static void sendOneOffMail(MailEntry mail, String colleagueName, byte[] key) { 59 // Ensure dead drop area is set up. 60 Path databaseFileDirPath = ensureDeadDrops(colleagueName); 61 62 // Ensure the database file exists. 63 Path databaseFilePath = ensureDatabaseFile(colleagueName, databaseFileDirPath); 64 65 // Create secret key. 66 SecretKey secretKey = new SecretKeySpec(key, SymmetricAlgorithm); 67 68 // Send message 69 sendMail(mail, secretKey, databaseFilePath); 70 } 71 56 72 public static void sendMail(MailEntry mail, String colleagueName) { 57 73 // Ensure dead drop area is set up. 58 String me = UserSettings.UserName.get().toLowerCase(); 59 String them = colleagueName.toLowerCase(); 60 Path databaseFileDirPath = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(me + "+" + them); 61 if (!databaseFileDirPath.toFile().exists()) { 62 databaseFileDirPath = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(them + "+" + me); 63 } 74 Path databaseFileDirPath = ensureDeadDrops(colleagueName); 75 76 // Ensure the database file exists. 77 Path databaseFilePath = ensureDatabaseFile(colleagueName, databaseFileDirPath); 78 79 // Obtain public key 80 PublicKey publicKey = null; 81 try { 82 publicKey = AuthenticatorBrowser.getInstance().getPublicKey(colleagueName); 83 } catch (InvalidKeySpecException | NoSuchAlgorithmException | KeyStoreException | CertificateException 84 | ClassNotFoundException | IOException | SQLException e) { 85 System.err.println("Error while sending message. Unable to obtain public key for colleague " + 86 colleagueName + ". Exception message: " + e.getMessage()); 87 return; 88 } 89 90 // Check we got public key 91 if (publicKey == null) { 92 System.err.println("Error while sending message. Unable to obtain public key for colleague. Have you exchanged contact details?"); 93 return; 94 } 95 96 // Send message 97 sendMail(mail, publicKey, databaseFilePath); 98 } 99 100 private static Path ensureDatabaseFile(String colleagueName, Path databaseFileDirPath) { 64 101 Path databaseFilePath = databaseFileDirPath.resolve(colleagueName + ".db"); 65 102 File databaseFile = databaseFilePath.toFile(); … … 86 123 } 87 124 } 88 89 // Obtain public key 90 PublicKey publicKey = null; 91 try { 92 publicKey = AuthenticatorBrowser.getInstance().getPublicKey(colleagueName); 93 } catch (InvalidKeySpecException | NoSuchAlgorithmException | KeyStoreException | CertificateException 94 | ClassNotFoundException | IOException | SQLException e) { 95 System.err.println("Error while sending message. Unable to obtain public key for colleague " + 96 colleagueName + ". Exception message: " + e.getMessage()); 97 return; 98 } 99 100 // Check we got public key 101 if (publicKey == null) { 102 System.err.println("Error while sending message. Unable to obtain public key for colleague. Have you exchanged contact details?"); 103 return; 104 } 105 106 // Send message 107 sendMail(mail, publicKey, databaseFilePath); 125 return databaseFilePath; 126 } 127 128 private static Path ensureDeadDrops(String colleagueName) { 129 String me = UserSettings.UserName.get().toLowerCase(); 130 String them = colleagueName.toLowerCase(); 131 Path databaseFileDirPath = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(me + "+" + them); 132 if (!databaseFileDirPath.toFile().exists()) { 133 databaseFileDirPath = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(them + "+" + me); 134 } 135 return databaseFileDirPath; 108 136 } 109 137 … … 111 139 try { 112 140 Cipher cipher = Cipher.getInstance(AsymmetricAlgorithm + AsymmetricAlgorithmParameters); 113 114 // encrypt the necessary parts of the message115 //cipher.init(Cipher.ENCRYPT_MODE, key);116 //String time = Base64.getEncoder().encodeToString(cipher.doFinal(mail.timestamp.getBytes()));117 141 cipher.init(Cipher.ENCRYPT_MODE, key); 118 142 String sender = Base64.getEncoder().encodeToString(cipher.doFinal(mail.sender.getBytes())); … … 134 158 135 159 // write to mail database 136 Connection c = DriverManager.getConnection("jdbc:sqlite:" + databaseFile); 137 String sql = "INSERT INTO EXPMAIL (TIME,SND,REC,MSG,MSG2,OPTS,OPTSVAL) VALUES (?, ?, ?, ?, ?, ?, ?);"; 138 PreparedStatement statement = c.prepareStatement(sql); 139 statement.setString(1, mail.timestamp); 140 statement.setString(2, sender); 141 statement.setString(3, rec); 142 statement.setString(4, message); 143 statement.setString(5, message2); 144 String opts = Arrays.toString(options.keySet().toArray()); 145 statement.setString(6, opts); 146 String optsval = Arrays.toString(options.values().toArray()); 147 statement.setString(7, optsval); 148 statement.execute(); 149 statement.close(); 150 c.close(); 160 writeToMailDatabase(mail, databaseFile, sender, rec, message, message2, options); 151 161 } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | SQLException e) { 152 162 e.printStackTrace(); … … 154 164 } 155 165 166 private static void sendMail(MailEntry mail, SecretKey key, Path databaseFile) { 167 try { 168 // Encrypt message. 169 Cipher cipher = Cipher.getInstance(SymmetricAlgorithm + SymmetricAlgorithmParameters); 170 cipher.init(Cipher.ENCRYPT_MODE, key); 171 String sender = "=" + Base64.getEncoder().encodeToString(cipher.doFinal(mail.sender.getBytes())); 172 cipher.init(Cipher.ENCRYPT_MODE, key); 173 String rec = Base64.getEncoder().encodeToString(cipher.doFinal(mail.receiver.getBytes())); 174 cipher.init(Cipher.ENCRYPT_MODE, key); 175 String message = Base64.getEncoder().encodeToString(cipher.doFinal(mail.message.getBytes())); 176 cipher.init(Cipher.ENCRYPT_MODE, key); 177 String message2 = Base64.getEncoder().encodeToString(cipher.doFinal(mail.message2.getBytes())); 178 Map<String, String> options = new HashMap<String, String>(); 179 for (String label: mail.options.keySet()) { 180 cipher.init(Cipher.ENCRYPT_MODE, key); 181 String labelEncrypted = Base64.getEncoder().encodeToString(cipher.doFinal(label.getBytes())); 182 cipher.init(Cipher.ENCRYPT_MODE, key); 183 String actionNameEncrypted = Base64.getEncoder().encodeToString(cipher.doFinal(mail.options.get(label).getBytes())); 184 options.put(labelEncrypted, actionNameEncrypted); 185 } 186 187 // Write to mail database. 188 writeToMailDatabase(mail, databaseFile, sender, rec, message, message2, options); 189 } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | SQLException e) { 190 e.printStackTrace(); 191 } 192 } 193 194 private static void writeToMailDatabase(MailEntry mail, Path databaseFile, String sender, String rec, 195 String message, String message2, Map<String, String> options) throws SQLException { 196 Connection c = DriverManager.getConnection("jdbc:sqlite:" + databaseFile); 197 String sql = "INSERT INTO EXPMAIL (TIME,SND,REC,MSG,MSG2,OPTS,OPTSVAL) VALUES (?, ?, ?, ?, ?, ?, ?);"; 198 PreparedStatement statement = c.prepareStatement(sql); 199 statement.setString(1, mail.timestamp); 200 statement.setString(2, sender); 201 statement.setString(3, rec); 202 statement.setString(4, message); 203 statement.setString(5, message2); 204 String opts = Arrays.toString(options.keySet().toArray()); 205 statement.setString(6, opts); 206 String optsval = Arrays.toString(options.values().toArray()); 207 statement.setString(7, optsval); 208 statement.execute(); 209 statement.close(); 210 c.close(); 211 } 212 156 213 /** 157 214 * Gets the mail messages that the specified user is able to read. … … 230 287 public String message2; 231 288 public Map<String, String> options; 289 public MailEntry subEntry; 232 290 233 291 public MailEntry(String timestamp, String sender, String rec, String message, String message2, Map<String, String> options) { -
trunk/src/org/expeditee/auth/account/Password.java
r1348 r1357 24 24 import org.expeditee.gui.FrameIO; 25 25 import org.expeditee.gui.MessageBay; 26 import org.ngikm.cryptography.CryptographyConstants; 26 27 27 public class Password {28 public class Password implements CryptographyConstants { 28 29 /* 29 30 * Changes the recorded password for a user in the key store. … … 91 92 } 92 93 93 public static void confirmIntergalacticNumberAndGenerateSubstituteAccount(Map<AuthenticationTag, String> userData) { 94 String username = userData.get(AuthenticationTag.Username); 95 String email = userData.get(AuthenticationTag.Email); 96 String intergalacticNumber = userData.get(AuthenticationTag.IntergalacticNumber); 97 String newPassword = userData.get(AuthenticationTag.NewPassword); 98 String newPasswordAgain = userData.get(AuthenticationTag.NewPasswordAgain); 99 100 try { 101 boolean match = AuthenticatorBrowser.getInstance().confirmIntergalaticNumber(username, email, intergalacticNumber); 102 if (match) { 103 MessageBay.displayMessage(":)"); 104 } else { 105 MessageBay.displayMessage(":("); 106 } 107 } catch (NoSuchAlgorithmException | KeyStoreException | CertificateException | ClassNotFoundException 108 | IOException | SQLException e) { 109 e.printStackTrace(); 110 } 94 public static void confirmIntergalacticNumberAndAlertColleagues(Map<AuthenticationTag, String> userData, String[] colleagues) { 95 System.err.println("Colleague One: " + colleagues[0] + " @" + colleagues[2]); 96 System.err.println("Colleague Two: " + colleagues[1] + " @" + colleagues[3]); 111 97 } 112 98 } -
trunk/src/org/expeditee/gui/FrameIO.java
r1354 r1357 127 127 public static final int MAX_CACHE = 100; 128 128 private static HashMap<String, Frame> _Cache = new FrameCache(); 129 private static boolean ENABLE_CACHE = true;129 private static final boolean ENABLE_CACHE = true; 130 130 private static boolean _UseCache = true; 131 131 private static boolean _SuspendedCache = false;
Note:
See TracChangeset
for help on using the changeset viewer.