package meerkat.mixer.proofs;

import com.google.protobuf.InvalidProtocolBufferException;
import meerkat.protobuf.Crypto;
import meerkat.protobuf.Mixing;

/**
 * Created by talm on 20/01/17.
 */
public interface Mix2nizk {
    /**
     * Prove in zero knowledge that two ciphertexts are a mix of two original ciphertexts.
     */
    public interface Prover {
        public Mixing.Mix2Proof prove(Crypto.RerandomizableEncryptedMessage in1,
                                      Crypto.RerandomizableEncryptedMessage in2,
                                      Crypto.RerandomizableEncryptedMessage out1,
                                      Crypto.RerandomizableEncryptedMessage out2,
                                      boolean switched, int layer, int switchIdx, int out0Idx, int out1Idx, // switch info
                                      Crypto.EncryptionRandomness r1,
                                      Crypto.EncryptionRandomness r2) throws InvalidProtocolBufferException;


    }

    /**
     * Verify the two-ciphertext mix proof
     */
    public interface Verifier {
        /**
         * Return true iff the proof is valid.
         * @param in1
         * @param in2
         * @param out1
         * @param out2
         * @return
         */
        boolean verify(Crypto.RerandomizableEncryptedMessage in1,
                       Crypto.RerandomizableEncryptedMessage in2,
                       Crypto.RerandomizableEncryptedMessage out1,
                       Crypto.RerandomizableEncryptedMessage out2,
                       Mixing.Mix2Proof proof) throws InvalidProtocolBufferException;
    }
}
