Instructions:Enter a plaintext sentence in the textfield labeled "Plaintext of A:" then hit return. A random key is generated for A and shown in the textfield labeled "Key A:". A random key is generated for B and shown in the textfield labeled "Key B:". The double lock protocol implemented with the XOR cipher. The encrypted message that A sends to B is intercepted by an attacker and the result recorded and shown in textfield "Attacker sees and records this:". The double encrypted message sent from B to A is also intercepted and recorded and shown in the textfield "Attacker sees this:". The attacker xors this with what it had previously recorded and the result is in the textfield "to get B's key:". The attacker uses this key to decrypt the final encrypted message sent from A to B and the result is shown in the textfield "Attacker intercepts and decrypts to this:". Is there some more secure way to implement the double lock protocol?
Source code: CrackDoubleLock.java