Browse Source

added check that inputs are on curve

pull/8/head
Nanak Nihal Singh Khalsa 1 year ago
parent
commit
9313800860
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      src/lib.rs

+ 3
- 0
src/lib.rs

@ -416,6 +416,9 @@ impl PrivateKey {
}
pub fn decrypt_elgamal(&self, encrypted_point: ElGamalEncryption) -> Point {
// Make sure inputs aren't bad (i imagine this check could be skipped for performance reasons, but it seems a sanity check here would be helpful)
assert!(encrypted_point.c1.on_curve() && encrypted_point.c2.on_curve());
let shared_secret = encrypted_point.c1.mul_scalar(&self.scalar_key());
println!("Shared Secret {:?}", shared_secret);
// Subtract the shared secret

Loading…
Cancel
Save