diff --git a/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeProver.java b/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeProver.java deleted file mode 100644 index 3a11c0e..0000000 --- a/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeProver.java +++ /dev/null @@ -1,20 +0,0 @@ -package meerkat.crypto.mixnet; - -import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.Crypto; -import meerkat.protobuf.Mixing; - -/** - * Prove in zero knowledge that two ciphertexts are a mix of two original ciphertexts. - */ -public interface Mix2ZeroKnowledgeProver { - 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; - - -} diff --git a/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeVerifier.java b/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeVerifier.java deleted file mode 100644 index 45bf692..0000000 --- a/mixer/src/main/java/meerkat/crypto/mixnet/Mix2ZeroKnowledgeVerifier.java +++ /dev/null @@ -1,24 +0,0 @@ -package meerkat.crypto.mixnet; - -import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.Crypto; -import meerkat.protobuf.Mixing; - -/** - * Verify the two-ciphertext mix proof - */ -public interface Mix2ZeroKnowledgeVerifier { - /** - * 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; -} diff --git a/mixer/src/main/java/meerkat/crypto/mixnet/Mixer.java b/mixer/src/main/java/meerkat/crypto/mixnet/Mixer.java deleted file mode 100644 index a9b61d7..0000000 --- a/mixer/src/main/java/meerkat/crypto/mixnet/Mixer.java +++ /dev/null @@ -1,15 +0,0 @@ -package meerkat.crypto.mixnet; - -import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.protobuf.Crypto; - -import java.util.List; -import java.util.Random; - -/** - * Created by talm on 25/10/15. - */ -public interface Mixer { - public MixerOutput mix(List ciphertexts,Random random) - throws InvalidProtocolBufferException; -} diff --git a/mixer/src/main/java/meerkat/crypto/mixnet/MixerOutput.java b/mixer/src/main/java/meerkat/crypto/mixnet/MixerOutput.java deleted file mode 100644 index 770dc92..0000000 --- a/mixer/src/main/java/meerkat/crypto/mixnet/MixerOutput.java +++ /dev/null @@ -1,14 +0,0 @@ -package meerkat.crypto.mixnet; - -import meerkat.protobuf.Crypto; -import meerkat.protobuf.Mixing; - -/** - * Created by Tzlil on 1/18/2016. - */ -public interface MixerOutput { - public Mixing.Mix2Proof[][] getProofs(); - public Crypto.RerandomizableEncryptedMessage[][] getEncryptedMessages(); - public int getLogN(); - public int getNumLayers(); -} diff --git a/mixer/src/main/java/meerkat/mixer/MixGenerator.java b/mixer/src/main/java/meerkat/mixer/MixGenerator.java index e4787d6..c901fc7 100644 --- a/mixer/src/main/java/meerkat/mixer/MixGenerator.java +++ b/mixer/src/main/java/meerkat/mixer/MixGenerator.java @@ -2,11 +2,10 @@ package meerkat.mixer; import com.google.protobuf.InvalidProtocolBufferException; import meerkat.crypto.Encryption; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeProver; -import meerkat.crypto.mixnet.MixerOutput; import meerkat.mixer.network.BenesNetwork; import meerkat.mixer.network.PermutationNetwork; import meerkat.mixer.network.RandomPermutation; +import meerkat.mixer.proofs.Mix2nizk; import meerkat.protobuf.Crypto.EncryptionRandomness; import meerkat.protobuf.Crypto.RerandomizableEncryptedMessage; import meerkat.protobuf.Mixing.Mix2Proof; @@ -15,18 +14,17 @@ import java.util.List; import java.util.Random; /** - * an implementation of meerkat.crypto.mixnet.Mixer - * meerkat.mixer.network algorithm on set of n encrypted votes: - * 0. asset n is power of two - * 1. set switches according to benes network on random permutation + * Run Abe's permutation network mixing algorithm on set of n encrypted votes: + * 0. n is power of two + * 1. set switches according to Benes network on random permutation * 2. re encrypt and mix with respect to switches values (encryptor.rerandomize) * 3. generate zero knowledge proof on each re encrypted couple * 4. return proofs table + encryption table * */ -public class MixGenerator implements meerkat.crypto.mixnet.Mixer { +public class MixGenerator { - private final Mix2ZeroKnowledgeProver prover; + private final Mix2nizk.Prover prover; private final Encryption encryptor; /** @@ -34,7 +32,7 @@ public class MixGenerator implements meerkat.crypto.mixnet.Mixer { * @param prover * @param encryptor */ - public MixGenerator(Mix2ZeroKnowledgeProver prover, Encryption encryptor) { + public MixGenerator(Mix2nizk.Prover prover, Encryption encryptor) { this.prover = prover; this.encryptor = encryptor; } diff --git a/mixer/src/main/java/meerkat/mixer/MixVerifier.java b/mixer/src/main/java/meerkat/mixer/MixVerifier.java index 8ddd956..e94938c 100644 --- a/mixer/src/main/java/meerkat/mixer/MixVerifier.java +++ b/mixer/src/main/java/meerkat/mixer/MixVerifier.java @@ -1,8 +1,7 @@ package meerkat.mixer; import com.google.protobuf.InvalidProtocolBufferException; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeVerifier; -import meerkat.crypto.mixnet.MixerOutput; +import meerkat.mixer.proofs.Mix2nizk; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; @@ -20,7 +19,7 @@ public final class MixVerifier { * @return true iff the meerkat.mixer.network output is valid * @throws InvalidProtocolBufferException */ - public static boolean verifyTable(Mix2ZeroKnowledgeVerifier verifier, MixerOutput mixerOutput) + public static boolean verifyTable(Mix2nizk.Verifier verifier, MixerOutput mixerOutput) throws InvalidProtocolBufferException { int out0,out1,layer, switchIdx; diff --git a/mixer/src/main/java/meerkat/mixer/MixerOutput.java b/mixer/src/main/java/meerkat/mixer/MixerOutput.java index 356bc05..c77d54c 100644 --- a/mixer/src/main/java/meerkat/mixer/MixerOutput.java +++ b/mixer/src/main/java/meerkat/mixer/MixerOutput.java @@ -8,10 +8,9 @@ import java.io.OutputStream; /** * Created by Tzlil on 1/18/2016. - * implements meerkat.crypto.mixnet.MixerOutput interface * container for meerkat.mixer.network.mix result. */ -public class MixerOutput implements meerkat.crypto.mixnet.MixerOutput { +public class MixerOutput { private final Mixing.Mix2Proof[][] proofs; private final Crypto.RerandomizableEncryptedMessage[][] encryptedMessages; private final int logN; @@ -30,22 +29,18 @@ public class MixerOutput implements meerkat.crypto.mixnet.MixerOutput { this.logN = logN; } - @Override public Mixing.Mix2Proof[][] getProofs() { return proofs; } - @Override public Crypto.RerandomizableEncryptedMessage[][] getEncryptedMessages() { return encryptedMessages; } - @Override public int getLogN() { return logN; } - @Override public int getNumLayers() { return 2 * logN - 1; } diff --git a/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java b/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java index a611b22..38541a9 100644 --- a/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java +++ b/mixer/src/main/java/meerkat/mixer/main/BatchConverter.java @@ -1,6 +1,6 @@ package meerkat.mixer.main; -import meerkat.crypto.mixnet.MixerOutput; +import meerkat.mixer.MixerOutput; import meerkat.protobuf.BulletinBoardAPI; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; diff --git a/mixer/src/main/java/meerkat/mixer/main/BatchHandler.java b/mixer/src/main/java/meerkat/mixer/main/BatchHandler.java index 4aeb582..4886066 100644 --- a/mixer/src/main/java/meerkat/mixer/main/BatchHandler.java +++ b/mixer/src/main/java/meerkat/mixer/main/BatchHandler.java @@ -1,7 +1,7 @@ package meerkat.mixer.main; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeVerifier; -import meerkat.crypto.mixnet.MixerOutput; +import meerkat.mixer.MixerOutput; +import meerkat.mixer.proofs.Mix2nizk; import meerkat.protobuf.Crypto; import meerkat.mixer.necessary.AsyncBulletinBoardClient; import meerkat.mixer.necessary.CompleteBatch; @@ -21,13 +21,13 @@ public class BatchHandler implements AsyncBulletinBoardClient.ClientCallback mixerInput = generateMixerInput(); diff --git a/mixer/src/test/java/meerkat/mixer/MixingTest.java b/mixer/src/test/java/meerkat/mixer/MixingTest.java index 05c8c90..b1f08a0 100644 --- a/mixer/src/test/java/meerkat/mixer/MixingTest.java +++ b/mixer/src/test/java/meerkat/mixer/MixingTest.java @@ -19,7 +19,7 @@ import java.util.Random; public class MixingTest extends ECParamTestBase { Random random,randomMixer,randomProver; Mix2nizk mix2nizk; - meerkat.crypto.mixnet.Mixer mixer; + MixGenerator mixer; private int layers; private int n; @@ -57,7 +57,7 @@ public class MixingTest extends ECParamTestBase { System.out.println(" start network"); long startTime = System.currentTimeMillis(); - meerkat.crypto.mixnet.MixerOutput mixerOutput = mixer.mix(mixerInput,randomMixer); + MixerOutput mixerOutput = mixer.mix(mixerInput,randomMixer); long finishTime = System.currentTimeMillis(); System.out.println(" that took: "+(finishTime-startTime)+ " ms"); diff --git a/mixer/src/test/java/meerkat/mixer/proofs/concrete/Mix2ProofTest.java b/mixer/src/test/java/meerkat/mixer/proofs/concrete/Mix2ProofTest.java index 4a9c28f..1ee2a42 100644 --- a/mixer/src/test/java/meerkat/mixer/proofs/concrete/Mix2ProofTest.java +++ b/mixer/src/test/java/meerkat/mixer/proofs/concrete/Mix2ProofTest.java @@ -2,11 +2,8 @@ package meerkat.mixer.proofs.concrete; import com.google.protobuf.InvalidProtocolBufferException; import meerkat.crypto.concrete.ECElGamalEncryption; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeProver; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeVerifier; import meerkat.mixer.ECParamTestBase; import meerkat.mixer.Utils; -import meerkat.mixer.proofs.concrete.Mix2nizk; import meerkat.protobuf.ConcreteCrypto; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; @@ -23,8 +20,8 @@ import static org.junit.Assert.assertTrue; */ public class Mix2ProofTest extends ECParamTestBase { Mix2nizk nizk; - Mix2ZeroKnowledgeVerifier verifier ; - Mix2ZeroKnowledgeProver prover ; + meerkat.mixer.proofs.Mix2nizk.Verifier verifier ; + meerkat.mixer.proofs.Mix2nizk.Prover prover ; @Before public void setup() throws Exception { diff --git a/mixer/src/test/java/profiling/ZeroKnowledgeProof.java b/mixer/src/test/java/profiling/ZeroKnowledgeProof.java index e390486..94e8f24 100644 --- a/mixer/src/test/java/profiling/ZeroKnowledgeProof.java +++ b/mixer/src/test/java/profiling/ZeroKnowledgeProof.java @@ -3,7 +3,6 @@ package profiling; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; import meerkat.crypto.concrete.ECElGamalEncryption; -import meerkat.crypto.mixnet.Mix2ZeroKnowledgeProver; import meerkat.mixer.proofs.concrete.Mix2nizk; import meerkat.protobuf.ConcreteCrypto; import meerkat.protobuf.Crypto; @@ -28,7 +27,7 @@ public class ZeroKnowledgeProof { ECGroup group; ECElGamalEncryption enc; ConcreteCrypto.ElGamalPublicKey serializedPk; - Mix2ZeroKnowledgeProver prover ; + meerkat.mixer.proofs.Mix2nizk.Prover prover ; int n; Crypto.EncryptionRandomness[] randomnesses; Crypto.RerandomizableEncryptedMessage[] encryptedMessage;