@@ -125,6 +125,7 @@ public static boolean sendKeyCheck() throws IOException {
125
125
if (!"" .equals (recipientPassword )) {
126
126
if (recipientUsername .length () >= 5 && recipientUsername .length () <= 10 ) {
127
127
if (!recipientUsername .equals (Statics .recipientPassword )) {
128
+ resetStaticInts ();
128
129
Hasher .hashedUsername = Hasher .getHash (recipientUsername , true );
129
130
Hasher .hashedPassword = Hasher .getHash (recipientPassword , false );
130
131
Main .jRadioButton2 .setEnabled (false );
@@ -180,41 +181,12 @@ private static void receivePanelTools() {
180
181
Main .jRadioButton3 .setSelected (false );
181
182
}
182
183
183
- public static boolean receiveKeyCheck (String zipFileN ) throws IOException {
184
- char [] password = Main .jPasswordField3 .getPassword ();
185
- if (GUI .t .isAlive ()) {
186
- GUI .t .interrupt ();
187
- }
188
-
189
- zipFileName = zipFileN ;
190
- System .out .println (Main .jList1 .getSelectedValue ());
191
-
192
- recipientPassword = new String (password );
193
- if (Main .jList1 .getSelectedValue () != null ) {
194
- if (!"" .equals (recipientPassword )) {
195
- Hasher .hashedUsername = Hasher .getHash (username , true );
196
- Hasher .hashedPassword = Hasher .getHash (recipientPassword , false );
197
- Main .jPasswordField3 .setText ("" );
198
- Folder .list1Dir (1 );
199
- } else {
200
- GUI .labelCutterThread (jAlertLabel , "please make a password" , 20 , 20 , 1200 , false );
201
- receivePanelTools ();
202
- }
203
- } else {
204
- GUI .labelCutterThread (jAlertLabel , "please select a .i-cc file" , 20 , 20 , 1200 , false );
205
- receivePanelTools ();
206
- Main .jPasswordField3 .setText ("" );
207
- }
208
- return false ;
209
- }
210
-
211
184
public static boolean verifySendKey (String zipFileN ) {
212
-
185
+ boolean b = false ;
213
186
char [] password = Main .jPasswordField3 .getPassword ();
214
187
if (GUI .t .isAlive ()) {
215
188
GUI .t .interrupt ();
216
189
}
217
-
218
190
zipFileName = zipFileN ;
219
191
System .out .println (Main .jList1 .getSelectedValue ());
220
192
@@ -227,6 +199,57 @@ public static boolean verifySendKey(String zipFileN) {
227
199
Main .jRadioButton3 .setEnabled (false );
228
200
unzipFile (Statics .zipFileName + ".i-cc" , Statics .zipFileName .replaceAll (".i-cc" , "" ));
229
201
Main .toolBtnsBool (true );
202
+ try {
203
+ BufferedReader brTest = new BufferedReader (new FileReader (zipFileName + "\\ send.key" ));
204
+ String usernameRead = Hasher .readKey (brTest .readLine (), username );
205
+ String passwordRead = Hasher .readKey (brTest .readLine (), recipientPassword );
206
+
207
+ BufferedReader brTest1 = new BufferedReader (new FileReader (keyFile ));
208
+ String usernameRead1 = Hasher .readKey (brTest1 .readLine (), username );
209
+ //
210
+ if (usernameRead .equals (usernameRead1 )) {
211
+ System .out .println ("USERNAME MATCH" );
212
+ if (passwordRead .equals (Hasher .getHash (recipientPassword , false ))) {
213
+ System .out .println ("PASSWORD MATCH" );
214
+ resetStaticInts ();
215
+ jProgressBar1 .setValue (Statics .fileIter );
216
+ jProgressBar1 .setValue (Statics .fileCount );
217
+ AESMode = 1 ;
218
+ fileCount = GUI .countFiles (receiveFolder );
219
+ zipFileCount = fileCount ;
220
+ jProgressBar1 .setMaximum (fileCount );
221
+ AES .AESThread (listAESPaths (Paths .get (Statics .zipFileName )), Paths .get (Statics .zipFileName ).toFile (), true , 1 );
222
+ Main .progressbarBool = false ;
223
+ b = true ;
224
+ } else {
225
+ resetStaticInts ();
226
+ brTest .close ();
227
+ Folder .deleteDirectory (Paths .get (Statics .zipFileName ).toFile ());
228
+ Paths .get (Statics .zipFileName ).toFile ().delete ();
229
+ GUI .labelCutterThread (jAlertLabel , "mismatched credentials" , 20 , 20 , 1000 , false );
230
+ Main .jList1 .clearSelection ();
231
+ receivePanelTools ();
232
+ Main .jPasswordField3 .setText ("" );
233
+ Main .jRadioButton3 .setEnabled (true );
234
+ Folder .listZipFiles ();
235
+ Main .toolBtnsBool (true );
236
+ }
237
+ } else {
238
+ resetStaticInts ();
239
+ brTest .close ();
240
+ Folder .deleteDirectory (Paths .get (Statics .zipFileName ).toFile ());
241
+ Paths .get (Statics .zipFileName ).toFile ().delete ();
242
+ GUI .labelCutterThread (jAlertLabel , "mismatched credentials" , 20 , 20 , 1000 , false );
243
+ receivePanelTools ();
244
+ Main .jList1 .clearSelection ();
245
+ Main .jPasswordField3 .setText ("" );
246
+ Main .jRadioButton3 .setEnabled (true );
247
+ Folder .listZipFiles ();
248
+ Main .toolBtnsBool (true );
249
+ }
250
+ } catch (IOException ex ) {
251
+ ex .printStackTrace ();
252
+ }
230
253
231
254
} else {
232
255
GUI .labelCutterThread (jAlertLabel , "please make a password" , 20 , 20 , 1200 , false );
@@ -237,57 +260,7 @@ public static boolean verifySendKey(String zipFileN) {
237
260
receivePanelTools ();
238
261
Main .jPasswordField3 .setText ("" );
239
262
}
240
-
241
- try {
242
- BufferedReader brTest = new BufferedReader (new FileReader (zipFileName + "\\ send.key" ));
243
- String usernameRead = Hasher .readKey (brTest .readLine (), username );
244
- String passwordRead = Hasher .readKey (brTest .readLine (), recipientPassword );
245
-
246
- BufferedReader brTest1 = new BufferedReader (new FileReader (keyFile ));
247
- String usernameRead1 = Hasher .readKey (brTest1 .readLine (), username );
248
- //
249
- if (usernameRead .equals (usernameRead1 )) {
250
- System .out .println ("USERNAME MATCH" );
251
- if (passwordRead .equals (Hasher .getHash (recipientPassword , false ))) {
252
- System .out .println ("PASSWORD MATCH" );
253
- Statics .fileIter = 0 ;
254
- Statics .fileCount = 0 ;
255
- jProgressBar1 .setValue (Statics .fileIter );
256
- jProgressBar1 .setValue (Statics .fileCount );
257
- AESMode = 1 ;
258
- fileCount = GUI .countFiles (receiveFolder );
259
- zipFileCount = fileCount ;
260
- jProgressBar1 .setMaximum (fileCount );
261
- AES .AESThread (listAESPaths (Paths .get (Statics .zipFileName )), Paths .get (Statics .zipFileName ).toFile (), true , 1 );
262
- return true ;
263
- } else {
264
- brTest .close ();
265
- Folder .deleteDirectory (Paths .get (Statics .zipFileName ).toFile ());
266
- Paths .get (Statics .zipFileName ).toFile ().delete ();
267
- GUI .labelCutterThread (jAlertLabel , "mismatched credentials" , 20 , 20 , 1000 , false );
268
- Main .jList1 .clearSelection ();
269
- receivePanelTools ();
270
- Main .jPasswordField3 .setText ("" );
271
- Main .jRadioButton3 .setEnabled (true );
272
- Folder .listZipFiles ();
273
- Main .toolBtnsBool (true );
274
- }
275
- } else {
276
- brTest .close ();
277
- Folder .deleteDirectory (Paths .get (Statics .zipFileName ).toFile ());
278
- Paths .get (Statics .zipFileName ).toFile ().delete ();
279
- GUI .labelCutterThread (jAlertLabel , "mismatched credentials" , 20 , 20 , 1000 , false );
280
- receivePanelTools ();
281
- Main .jList1 .clearSelection ();
282
- Main .jPasswordField3 .setText ("" );
283
- Main .jRadioButton3 .setEnabled (true );
284
- Folder .listZipFiles ();
285
- Main .toolBtnsBool (true );
286
- }
287
- } catch (IOException ex ) {
288
- ex .printStackTrace ();
289
- }
290
- return false ;
263
+ return b ;
291
264
}
292
265
293
266
public static boolean verifyLogin () {
0 commit comments