public Plaintext Decrypt(PrivateKey d, Ciphertext c) { if (!(c is ElGamalCiphertext)) throw new ArgumentException("Ciphertext must be ElGamalCiphertext!"); var ciphertext = c as ElGamalCiphertext; var M = ciphertext.C2 - (ciphertext.C1 * d.Value); return _encoder.DecodeMessage(M); }
public KeyPair(PublicKey pub, PrivateKey priv) { _pub = pub; _priv = priv; }