Guest User

jex.stackoverflow

a guest
Aug 22nd, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. public static void verifyHost(){
  2.         String tempChallenge = null;
  3.         if(whosHost == true){
  4.             challenge = JOptionPane.showInputDialog(null, "Please enter a challenge for the remote connecting host", "Encrypted Chat - Challenge", JOptionPane.QUESTION_MESSAGE);
  5.             challenge = AESEncrypt(challenge);         
  6.             System.out.println(challenge);
  7.             out.println(challenge);
  8.             String decryptedChallenge = AESDecrypt(challenge);
  9.             System.out.println(decryptedChallenge);
  10.             try {
  11.                 tempChallenge = in.readLine();
  12.             } catch (IOException e) {
  13.                 e.printStackTrace();
  14.             }
  15.             if( decryptedChallenge.equals(tmpChallenge) ){
  16.                 JOptionPane.showMessageDialog(null, "Paired!");
  17.             } else {
  18.                 JOptionPane.showMessageDialog(null, "Error with authentication", "Encrypted Chat - Authentication", JOptionPane.ERROR_MESSAGE);
  19.             }
  20.            
  21.         }
  22.        
  23.         if(whosHost == false){
  24.             String tempChallengeIn = null;
  25.             try {
  26.                 tempChallengeIn = in.readLine();
  27.             } catch (IOException e) {
  28.                 e.printStackTrace();
  29.             }
  30.             System.out.println(tempChallengeIn);
  31.             tempChallengeIn = AESDecrypt(tempChallengeIn);
  32.             System.out.println(tempChallengeIn);
  33.             out.println(tempChallengeIn);          
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment