Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public KeyPair(PublicKey pub, PrivateKey priv)
 {
     _pub = pub;
     _priv = priv;
 }