Changeset 1504 for trunk/src/org/expeditee/auth/account/Password.java
- Timestamp:
- 01/29/20 13:20:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/account/Password.java
r1500 r1504 13 13 import java.util.Base64; 14 14 import java.util.Collection; 15 import java.util.Date; 15 16 import java.util.HashMap; 16 17 import java.util.Iterator; … … 33 34 import org.expeditee.auth.mail.Mail; 34 35 import org.expeditee.auth.mail.Mail.MailEntry; 36 import org.expeditee.auth.mail.gui.MailBay; 35 37 import org.expeditee.auth.tags.AuthenticationTag; 36 38 import org.expeditee.encryption.CryptographyConstants; … … 44 46 import org.expeditee.settings.identity.passwordrecovery.Colleagues; 45 47 import org.expeditee.settings.identity.secrets.KeyList; 46 import org.expeditee.stats.Formatter;47 48 48 49 import com.codahale.shamir.Scheme; … … 113 114 114 115 // Get colleagues to distribute messages too. 115 String[] colleagues = getPasswordColleaguesFromUsername(username);116 String[] trustedUsers = getPasswordColleaguesFromUsername(username); 116 117 // Send secure message to colleague one 117 String colleagueOne = colleagues[0];118 String time = Formatter.getDateTime();118 String trustedUserOne = trustedUsers[0]; 119 String time = Mail.FORMAT.format(new Date()); 119 120 String topic = "Password Recovery for " + username; 120 121 String message = "Your colleague " + username + " would like you to help them recover access to their account."; 121 122 Map<String, String> options = new HashMap<String, String>(); 122 123 options.put("Provide assistance", "AuthEmailPasswordShare " + username); 123 MailEntry mail = new MailEntry(time, username, colleagueOne, topic, message, options); 124 Mail.sendOneOffMail(mail, colleagueOne, Base64.getDecoder().decode(intergalacticNumber)); 124 Mail outbox = MailBay.getMailClient(username); 125 MailEntry mail = outbox.new MailEntry(time, username, trustedUserOne, topic, message, options); 126 SecretKeySpec key = new SecretKeySpec(Base64.getDecoder().decode(intergalacticNumber), SymmetricAlgorithm); 127 outbox.sendOneOffMail(mail, trustedUserOne, key); 125 128 126 129 // Send secure message to colleague two 127 String colleagueTwo = colleagues[1];128 Mail.sendOneOffMail(mail, colleagueTwo, Base64.getDecoder().decode(intergalacticNumber));130 String trustedUserTwo = trustedUsers[1]; 131 outbox.sendOneOffMail(mail, trustedUserTwo, key); 129 132 130 133 String nl = System.getProperty("line.separator"); … … 136 139 try { 137 140 // Send email with key to colleague one 138 String colleagueOneEmail = colleagues[2];141 String colleagueOneEmail = trustedUsers[2]; 139 142 sendEmail(colleagueOneEmail, sb); 140 143 // Send email with key to colleague two 141 String colleagueTwoEmail = colleagues[3];144 String colleagueTwoEmail = trustedUsers[3]; 142 145 sendEmail(colleagueTwoEmail, sb); 143 146 … … 250 253 } 251 254 252 public static void setPWColleagues(String colleagueOne, String colleagueTwo) {255 public static void setPWColleagues(String trustedUserOne, String trustedUserTwo) { 253 256 // Get needed text items. 254 257 Frame pwRecoveryFrame = FrameIO.LoadFrame(UserSettings.UserName.get() + AuthenticatorBrowser.PASSWORD_RECOVERY_FRAME); … … 261 264 Text text = it.next(); 262 265 if (text.getText().toLowerCase().startsWith("user_one:")) { 263 text.setText("User_one: " + colleagueOne);264 Colleagues.User_One.set( colleagueOne);266 text.setText("User_one: " + trustedUserOne); 267 Colleagues.User_One.set(trustedUserOne); 265 268 } else if (text.getText().toLowerCase().startsWith("user_two:")) { 266 text.setText("User_two: " + colleagueTwo);267 Colleagues.User_Two.set( colleagueTwo);269 text.setText("User_two: " + trustedUserTwo); 270 Colleagues.User_Two.set(trustedUserTwo); 268 271 } 269 272 } … … 281 284 // Create shares 282 285 Map<Integer, byte[]> shares = scheme.split(keyBytes); 283 String colleagueOneShare = Base64.getEncoder().encodeToString(shares.get(1));284 String colleagueTwoShare = Base64.getEncoder().encodeToString(shares.get(2));286 String trustedUserOneShare = Base64.getEncoder().encodeToString(shares.get(1)); 287 String trustedUserTwoShare = Base64.getEncoder().encodeToString(shares.get(2)); 285 288 286 289 // Distribute share zero to colleague one 287 String time = org.expeditee.stats.Formatter.getDateTime();290 String time = Mail.FORMAT.format(new Date()); 288 291 String sender = UserSettings.UserName.get(); 289 292 String topic = "Please help me secure my Expeditee account."; 290 293 String message = "Run the below action to store a secret key that will help me recover access to my account should I ever loose it."; 291 294 Map<String, String> options = new HashMap<String, String>(); 292 options.put("Store Secret Key for " + sender, "AuthAddSecretKey " + sender + "PersonalKeyShare " + colleagueOneShare); 293 MailEntry mail = new MailEntry(time, sender, colleagueOne, topic, message, options); 294 Mail.sendMail(mail, colleagueOne); 295 options.put("Store Secret Key for " + sender, "AuthAddSecretKey " + sender + "PersonalKeyShare " + trustedUserOneShare); 296 Mail outbox = MailBay.getMailClient(); 297 MailEntry mail = outbox.new MailEntry(time, sender, trustedUserOne, topic, message, options); 298 outbox.sendMail(mail, trustedUserOne); 295 299 296 300 // Distribute share one to colleague two 297 301 options = new HashMap<String, String>(); 298 options.put("Store Secret Key for " + sender, "AuthAddSecretKey " + sender + "PersonalKeyShare " + colleagueTwoShare);299 mail = new MailEntry(time, sender, colleagueTwo, topic, message, options);300 Mail.sendMail(mail, colleagueTwo);301 302 MessageBay.displayMessage("You PW Colleagues have been set to " + colleagueOne + " and " + colleagueTwo + ". "302 options.put("Store Secret Key for " + sender, "AuthAddSecretKey " + sender + "PersonalKeyShare " + trustedUserTwoShare); 303 mail = outbox.new MailEntry(time, sender, trustedUserTwo, topic, message, options); 304 outbox.sendMail(mail, trustedUserTwo); 305 306 MessageBay.displayMessage("You Trusted Users have been set to " + trustedUserOne + " and " + trustedUserTwo + ". " 303 307 + "They have been sent a Expeditee mail that they can use to store a share of your secret key."); 304 308 }
Note:
See TracChangeset
for help on using the changeset viewer.