Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void verifyHost(){
- String tempChallenge = null;
- if(whosHost == true){
- challenge = JOptionPane.showInputDialog(null, "Please enter a challenge for the remote connecting host", "Encrypted Chat - Challenge", JOptionPane.QUESTION_MESSAGE);
- challenge = AESEncrypt(challenge);
- System.out.println(challenge);
- out.println(challenge);
- String decryptedChallenge = AESDecrypt(challenge);
- System.out.println(decryptedChallenge);
- try {
- tempChallenge = in.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- if( decryptedChallenge.equals(tmpChallenge) ){
- JOptionPane.showMessageDialog(null, "Paired!");
- } else {
- JOptionPane.showMessageDialog(null, "Error with authentication", "Encrypted Chat - Authentication", JOptionPane.ERROR_MESSAGE);
- }
- }
- if(whosHost == false){
- String tempChallengeIn = null;
- try {
- tempChallengeIn = in.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- System.out.println(tempChallengeIn);
- tempChallengeIn = AESDecrypt(tempChallengeIn);
- System.out.println(tempChallengeIn);
- out.println(tempChallengeIn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment