test DH as well

This commit is contained in:
François Garillot
2020-06-13 09:07:57 -04:00
parent e9fa474c58
commit 3ae1c58d46
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -33,4 +33,4 @@ hex = "0.4.2"
lazy_static = "1.4.0"
serde_json = "1.0"
proptest = "0.10.0"
rand = "0.7"
rand = "0.7"
+10
View File
@@ -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);
}
}
}