public void TestDoubleEncrypt() { EncryptedWatermark.Algorithm = aes; TextWatermark mark = new TextWatermark("This will be encrypted twice"); EncryptedWatermark enc1 = new EncryptedWatermark(mark, "password1"); EncryptedWatermark enc2 = new EncryptedWatermark(enc1, "password2"); Watermarker.EmbedWatermark(file, enc2, "password", "results/DoubleEncrypt.png"); PNGFile file2 = new PNGFile("results/DoubleEncrypt.png"); EncryptedWatermark extract = Watermarker.ExtractWatermark <EncryptedWatermark>(file, "password"); extract = extract.Decrypt <EncryptedWatermark>("password2"); mark = extract.Decrypt <TextWatermark>("password1"); Expect(mark.Text, Is.EqualTo("This will be encrypted twice")); }
public void TestEncryptedWatermark() { EncryptedWatermark.Algorithm = aes; TextWatermark mark = new TextWatermark("This should be encrypted"); EncryptedWatermark encrypted = new EncryptedWatermark(mark, "super-secret"); Watermarker.EmbedWatermark(file, encrypted, "password", "results/EncryptedMark.png"); PNGFile file2 = new PNGFile("results/EncryptedMark.png"); EncryptedWatermark extract = (EncryptedWatermark)Watermarker.ExtractWatermark(file2, "password"); mark = extract.Decrypt <TextWatermark>("super-secret"); Expect(mark, Is.Not.Null); Expect(mark.Text, Is.EqualTo("This should be encrypted")); }