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 void TestCiphertextCyclic() { var str = c.ToString(); var c2 = new Ciphertext(str); Assert.AreEqual(c, c2); }
public void Setup() { c = new Ciphertext(new byte[] { 72, 69, 73, 76 }); }