DH UnitTest
This commit is contained in:
parent
4def149519
commit
f2cea164ae
23
src/test/java/Main/DHExchangeTest.java
Normal file
23
src/test/java/Main/DHExchangeTest.java
Normal file
@ -0,0 +1,23 @@
|
||||
package Main;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class DHExchangeTest {
|
||||
|
||||
@Test
|
||||
void KeyMatchAfterExchangeTest(){
|
||||
DHExchange alice = new DHExchange(2048, true);
|
||||
DHExchange bob = new DHExchange(2048, false);
|
||||
alice.createKeyPar();
|
||||
try {
|
||||
bob.createKeyParFromPublicKey(alice.getThisPublicKeyEncoded());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
alice.onRecievePubKey(bob.getThisPublicKeyEncoded());
|
||||
|
||||
assertEquals(bob.getSecretKey(), alice.getSecretKey());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user