diff --git a/Cargo.toml b/Cargo.toml index 2204012..8e6ca88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,4 +33,4 @@ hex = "0.4.2" lazy_static = "1.4.0" serde_json = "1.0" proptest = "0.10.0" -rand = "0.7" \ No newline at end of file +rand = "0.7" diff --git a/src/keypair.rs b/src/keypair.rs index e49df75..b660ee1 100644 --- a/src/keypair.rs +++ b/src/keypair.rs @@ -237,5 +237,15 @@ mod tests { prop_assert_eq!(&X25519KeyPair::public_from_private(sk), pk); } + + #[test] + fn test_x25519_dh(kp1 in X25519KeyPair::uniform_keypair_strategy(), + kp2 in X25519KeyPair::uniform_keypair_strategy()) { + + let dh1 = X25519KeyPair::diffie_hellman(kp1.public().clone(), kp2.private().clone()); + let dh2 = X25519KeyPair::diffie_hellman(kp2.public().clone(), kp1.private().clone()); + + prop_assert_eq!(dh1,dh2); + } } }