From e27fddcf0ce5be72711d44154cd7f74766cd4d80 Mon Sep 17 00:00:00 2001 From: "tzlil.gon" Date: Sun, 20 Mar 2016 19:18:23 +0200 Subject: [PATCH] mixing test passed --- .../crypto/concrete/ECElGamalEncryption.java | 4 ++++ .../java/meerkat/crypto/mixnet/MixerOutput.java | 2 +- mixer/src/main/java/main/BatchConverter.java | 2 +- mixer/src/main/java/mixer/Mixer.java | 5 +++-- mixer/src/main/java/mixer/MixerOutput.java | 7 ++----- mixer/src/main/java/prover/Prover.java | 16 ++++++++-------- mixer/src/main/java/verifier/Verifier.java | 2 +- mixer/src/main/java/verifier/VerifyTable.java | 12 ++++++++---- mixer/src/test/java/mixer/MixingText.java | 2 +- mixer/src/test/java/mixer/RerandomizeTest.java | 6 ++++-- mixer/src/test/java/mixer/Utiles.java | 1 + .../test/java/mixer/ZeroKnowledgeProofTest.java | 8 ++++---- .../test/java/profiling/BigInteger/AddSub.java | 2 -- .../profiling/BigInteger/GenerateRandomness.java | 3 +-- .../test/java/profiling/BigInteger/Modulo.java | 2 -- .../src/test/java/profiling/BigInteger/Mul.java | 2 -- .../test/java/profiling/BigInteger/SHA256.java | 2 -- .../profiling/Convert/ByteString2ECPoint.java | 2 -- ...izableEncryptedMessage2ElGamalCiphertext.java | 3 +-- mixer/src/test/java/profiling/ECGroup/Add.java | 2 -- .../src/test/java/profiling/ECGroup/Encode.java | 4 ++-- mixer/src/test/java/profiling/ECGroup/Mul.java | 3 +-- .../src/test/java/profiling/ECGroup/Negate.java | 3 +-- mixer/src/test/java/profiling/Rerandomize.java | 2 -- .../test/java/profiling/ZeroKnowledgeProof.java | 3 +-- 25 files changed, 45 insertions(+), 55 deletions(-) diff --git a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java index 5dae4b7..4946b44 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java +++ b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java @@ -146,4 +146,8 @@ public class ECElGamalEncryption extends GlobalCryptoSetup implements Encryption return retval; } + + public BigInteger extractRandomness(Crypto.EncryptionRandomness encryptionRandomness){ + return new BigInteger(1,encryptionRandomness.getData().toByteArray()); + } } diff --git a/meerkat-common/src/main/java/meerkat/crypto/mixnet/MixerOutput.java b/meerkat-common/src/main/java/meerkat/crypto/mixnet/MixerOutput.java index 9ae1432..eb71e61 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/mixnet/MixerOutput.java +++ b/meerkat-common/src/main/java/meerkat/crypto/mixnet/MixerOutput.java @@ -7,7 +7,7 @@ import meerkat.protobuf.Mixing; * Created by Tzlil on 1/18/2016. */ public interface MixerOutput { - public Mixing.ZeroKnowledgeProof[][] gerProofs(); + public Mixing.ZeroKnowledgeProof[][] getProofs(); public Crypto.RerandomizableEncryptedMessage[][] getEncryptedMessages(); public int getN(); } diff --git a/mixer/src/main/java/main/BatchConverter.java b/mixer/src/main/java/main/BatchConverter.java index 919f406..c4e3404 100644 --- a/mixer/src/main/java/main/BatchConverter.java +++ b/mixer/src/main/java/main/BatchConverter.java @@ -38,7 +38,7 @@ public class BatchConverter { .setData(Integer2ByteString(n)) .build()); - for (Mixing.ZeroKnowledgeProof[] zkpLayer : mixerOutput.gerProofs()) { + for (Mixing.ZeroKnowledgeProof[] zkpLayer : mixerOutput.getProofs()) { for (Mixing.ZeroKnowledgeProof zkp : zkpLayer) { result.add(BulletinBoardAPI.BatchData.newBuilder() .setData(zkp.toByteString()) diff --git a/mixer/src/main/java/mixer/Mixer.java b/mixer/src/main/java/mixer/Mixer.java index 477e740..c2c52c0 100644 --- a/mixer/src/main/java/mixer/Mixer.java +++ b/mixer/src/main/java/mixer/Mixer.java @@ -100,11 +100,13 @@ public class Mixer implements meerkat.crypto.mixnet.Mixer { protected ZeroKnowledgeProof[][] createZKPTable(int n,int layers,MixNetwork mixNetwork, RerandomizableEncryptedMessage[][] encryptionTable ,EncryptionRandomness[][] randomnesses) throws InvalidProtocolBufferException { - ZeroKnowledgeProof[][] proofsTable = new ZeroKnowledgeProof[layers][n]; Switch[] switchesLayer; int index1,index2; int switchIndex = 0; int nDiv2 = n >> 1; + ZeroKnowledgeProof[][] proofsTable = new ZeroKnowledgeProof[layers][nDiv2]; + + RerandomizableEncryptedMessage e1,e2; EncryptionRandomness r1,r2; for (int layer = 0; layer < layers; layer++) @@ -132,7 +134,6 @@ public class Mixer implements meerkat.crypto.mixnet.Mixer { public MixerOutput mix(List ciphertexts) throws InvalidProtocolBufferException { int n = ciphertexts.size(); - int nDiv2 = n >> 1; if (!inputBasicCheckSum(n)) return null; diff --git a/mixer/src/main/java/mixer/MixerOutput.java b/mixer/src/main/java/mixer/MixerOutput.java index 38ad3c8..c8efda6 100644 --- a/mixer/src/main/java/mixer/MixerOutput.java +++ b/mixer/src/main/java/mixer/MixerOutput.java @@ -3,12 +3,9 @@ package mixer; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; -import java.awt.*; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.nio.file.Files; /** @@ -28,7 +25,7 @@ public class MixerOutput implements meerkat.crypto.mixnet.MixerOutput{ } public MixerOutput(meerkat.crypto.mixnet.MixerOutput mixerOutput) { - this.proofs = mixerOutput.gerProofs(); + this.proofs = mixerOutput.getProofs(); this.encryptedMessages = mixerOutput.getEncryptedMessages(); this.n = mixerOutput.getN(); this.layers = (int) (2 * Math.log(n) / Math.log(2)) - 1; // layers = 2logn -1; @@ -36,7 +33,7 @@ public class MixerOutput implements meerkat.crypto.mixnet.MixerOutput{ @Override - public Mixing.ZeroKnowledgeProof[][] gerProofs() { + public Mixing.ZeroKnowledgeProof[][] getProofs() { return proofs; } diff --git a/mixer/src/main/java/prover/Prover.java b/mixer/src/main/java/prover/Prover.java index 93fba71..0ff8494 100644 --- a/mixer/src/main/java/prover/Prover.java +++ b/mixer/src/main/java/prover/Prover.java @@ -99,7 +99,7 @@ public class Prover implements Mix2ZeroKnowledgeProver { */ private BigInteger hash(Mixing.ZeroKnowledgeProof.OrProof.ForRandomOracle input) { byte[] arr = input.toByteArray(); - return new BigInteger(this.randomOracle.hash(arr,arr.length)); + return new BigInteger(1,this.randomOracle.hash(arr,arr.length)); } @@ -120,7 +120,7 @@ public class Prover implements Mix2ZeroKnowledgeProver { ECPoint g2Tag = orProofInput.g2Tag; ECPoint h2Tag = orProofInput.h2Tag; - BigInteger r = new BigInteger(encryptor.generateRandomness(rand).getData().toByteArray()).mod(groupOrderUpperBound); + BigInteger r = encryptor.extractRandomness(encryptor.generateRandomness(rand)).mod(groupOrderUpperBound); BigInteger c1,c2,z,zTag; ECPoint u,v,uTag,vTag; Mixing.ZeroKnowledgeProof.OrProof.ForRandomOracle forRandomOracle; @@ -128,8 +128,8 @@ public class Prover implements Mix2ZeroKnowledgeProver { switch (orProofInput.flag) { case left: - c2 = new BigInteger(encryptor.generateRandomness(rand).getData().toByteArray()).mod(groupOrderUpperBound); - zTag = new BigInteger(encryptor.generateRandomness(rand).getData().toByteArray()).mod(groupOrderUpperBound); + c2 = encryptor.extractRandomness(encryptor.generateRandomness(rand)).mod(groupOrderUpperBound); + zTag = encryptor.extractRandomness(encryptor.generateRandomness(rand)).mod(groupOrderUpperBound); //step 1 u = group.multiply(g1, r); v = group.multiply(g2, r); @@ -155,11 +155,11 @@ public class Prover implements Mix2ZeroKnowledgeProver { c1 = hash(forRandomOracle).add(group.orderUpperBound().subtract(c2)).mod(groupOrderUpperBound); //step 3 //z = (r + c1 * x) % group size; - z = r.add(c1.multiply(new BigInteger(orProofInput.x.getData().toByteArray()))).mod(groupOrderUpperBound); + z = r.add(c1.multiply(encryptor.extractRandomness(orProofInput.x))).mod(groupOrderUpperBound); break; case right: - c1 = new BigInteger(encryptor.generateRandomness(rand).getData().toByteArray()).mod(groupOrderUpperBound); - z = new BigInteger(encryptor.generateRandomness(rand).getData().toByteArray()).mod(groupOrderUpperBound); + c1 = encryptor.extractRandomness(encryptor.generateRandomness(rand)).mod(groupOrderUpperBound); + z = encryptor.extractRandomness(encryptor.generateRandomness(rand)).mod(groupOrderUpperBound); //step 1 uTag = group.multiply(g1Tag, r); vTag = group.multiply(g2Tag, r); @@ -185,7 +185,7 @@ public class Prover implements Mix2ZeroKnowledgeProver { c2 = hash(forRandomOracle).add(group.orderUpperBound().subtract(c1)).mod(groupOrderUpperBound); //step 3 //zTag = (r + c2 * x) % group size; - zTag = r.add(c2.multiply(new BigInteger(orProofInput.x.getData().toByteArray()))).mod(groupOrderUpperBound); + zTag = r.add(c2.multiply(encryptor.extractRandomness(orProofInput.x))).mod(groupOrderUpperBound); break; default: return null; diff --git a/mixer/src/main/java/verifier/Verifier.java b/mixer/src/main/java/verifier/Verifier.java index 94c6084..308521f 100644 --- a/mixer/src/main/java/verifier/Verifier.java +++ b/mixer/src/main/java/verifier/Verifier.java @@ -37,7 +37,7 @@ public class Verifier implements Mix2ZeroKnowledgeVerifier { public BigInteger hash(Mixing.ZeroKnowledgeProof.OrProof.ForRandomOracle input) { byte[] arr = input.toByteArray(); - return new BigInteger(this.randomOracle.hash(arr,arr.length)); + return new BigInteger(1,this.randomOracle.hash(arr,arr.length)); } /** * @return true iff the proof is valid diff --git a/mixer/src/main/java/verifier/VerifyTable.java b/mixer/src/main/java/verifier/VerifyTable.java index 37fdedb..ebf203c 100644 --- a/mixer/src/main/java/verifier/VerifyTable.java +++ b/mixer/src/main/java/verifier/VerifyTable.java @@ -5,7 +5,6 @@ import meerkat.crypto.mixnet.Mix2ZeroKnowledgeVerifier; import meerkat.crypto.mixnet.MixerOutput; import meerkat.protobuf.Crypto; import meerkat.protobuf.Mixing; -import qilin.util.Pair; import java.util.Arrays; @@ -30,11 +29,16 @@ public final class VerifyTable { Arrays.fill(locationChecksumLayer,false); } - Mixing.ZeroKnowledgeProof[][] zeroKnowledgeProofs = mixerOutput.gerProofs(); + Mixing.ZeroKnowledgeProof[][] zeroKnowledgeProofs = mixerOutput.getProofs(); Crypto.RerandomizableEncryptedMessage[][] rerandomizableEncryptedMessages = mixerOutput.getEncryptedMessages(); - for (Mixing.ZeroKnowledgeProof[] zkpLayer: zeroKnowledgeProofs) { - for (Mixing.ZeroKnowledgeProof zkp: zkpLayer) { + for (int i = 0; i < zeroKnowledgeProofs.length ; i++){ + for (int j = 0; j < zeroKnowledgeProofs[i].length ; j ++){ + Mixing.ZeroKnowledgeProof zkp = zeroKnowledgeProofs[i][j]; + if(zkp == null){ + int ttt = 1; + ttt++; + } Mixing.ZeroKnowledgeProof.Location location = zkp.getLocation(); index1 = location.getI(); index2 = location.getJ(); diff --git a/mixer/src/test/java/mixer/MixingText.java b/mixer/src/test/java/mixer/MixingText.java index 23645ed..e2d0b6f 100644 --- a/mixer/src/test/java/mixer/MixingText.java +++ b/mixer/src/test/java/mixer/MixingText.java @@ -53,7 +53,7 @@ public class MixingText { mixer = new Mixer(randomMixer,prover,encryptor); // generate n - int logN = 10; // + random.nextInt(8) + int logN = 8; // + random.nextInt(8) layers = 2*logN - 1; n = 1 << logN; } diff --git a/mixer/src/test/java/mixer/RerandomizeTest.java b/mixer/src/test/java/mixer/RerandomizeTest.java index c2f0bb7..b7d9082 100644 --- a/mixer/src/test/java/mixer/RerandomizeTest.java +++ b/mixer/src/test/java/mixer/RerandomizeTest.java @@ -7,6 +7,7 @@ import meerkat.protobuf.ConcreteCrypto; import meerkat.protobuf.Crypto; import meerkat.protobuf.Voting; import org.bouncycastle.math.ec.ECPoint; +import org.bouncycastle.util.BigIntegers; import org.junit.Before; import org.junit.Test; import qilin.primitives.RandomOracle; @@ -62,13 +63,13 @@ public class RerandomizeTest { ConcreteCrypto.ElGamalCiphertext eElGamal = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext(e); ConcreteCrypto.ElGamalCiphertext eNewElGamal = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext(eNew); - ECPoint expected1 = g.multiply(new BigInteger(r.getData().toByteArray())); + ECPoint expected1 = g.multiply(enc.extractRandomness(r)); ECPoint result1 = group.add(convert2ECPoint(eNewElGamal.getC1()),group.negate(convert2ECPoint(eElGamal.getC1()))); expected1.normalize(); result1.normalize(); assert (expected1.equals(result1)); - ECPoint expected2 = h.multiply(new BigInteger(r.getData().toByteArray())); + ECPoint expected2 = h.multiply(enc.extractRandomness(r)); ECPoint result2 = group.add(convert2ECPoint(eNewElGamal.getC2()), group.negate(convert2ECPoint(eElGamal.getC2()))); expected2.normalize(); result2.normalize(); @@ -76,6 +77,7 @@ public class RerandomizeTest { assert (expected2.equals(result2)); } + @Test public void rerandomizeTest() throws InvalidProtocolBufferException { diff --git a/mixer/src/test/java/mixer/Utiles.java b/mixer/src/test/java/mixer/Utiles.java index 2be2a1c..15483f3 100644 --- a/mixer/src/test/java/mixer/Utiles.java +++ b/mixer/src/test/java/mixer/Utiles.java @@ -18,6 +18,7 @@ import qilin.primitives.generic.ElGamal; import qilin.util.Pair; import java.io.ByteArrayInputStream; +import java.math.BigInteger; import java.security.KeyFactory; import java.security.PublicKey; import java.util.Random; diff --git a/mixer/src/test/java/mixer/ZeroKnowledgeProofTest.java b/mixer/src/test/java/mixer/ZeroKnowledgeProofTest.java index 5bfedc8..6b75b1a 100644 --- a/mixer/src/test/java/mixer/ZeroKnowledgeProofTest.java +++ b/mixer/src/test/java/mixer/ZeroKnowledgeProofTest.java @@ -76,13 +76,13 @@ public class ZeroKnowledgeProofTest { ConcreteCrypto.ElGamalCiphertext e2TagElGamal = ECElGamalEncryption.RerandomizableEncryptedMessage2ElGamalCiphertext(e2New); - assert (g.multiply(new BigInteger(r1.getData().toByteArray())).equals( + assert (g.multiply(enc.extractRandomness(r1)).equals( group.add(convert2ECPoint(e1TagElGamal.getC1()),group.negate(convert2ECPoint(e1ElGamal.getC1()))))); - assert (h.multiply(new BigInteger(r1.getData().toByteArray())).equals( + assert (h.multiply(enc.extractRandomness(r1)).equals( group.add(convert2ECPoint(e1TagElGamal.getC2()),group.negate(convert2ECPoint(e1ElGamal.getC2()))))); - assert (g.multiply(new BigInteger(r2.getData().toByteArray())).equals( + assert (g.multiply(enc.extractRandomness(r2)).equals( group.add(convert2ECPoint(e2TagElGamal.getC1()),group.negate(convert2ECPoint(e2ElGamal.getC1()))))); - assert (h.multiply(new BigInteger(r2.getData().toByteArray())).equals( + assert (h.multiply(enc.extractRandomness(r2)).equals( group.add(convert2ECPoint(e2TagElGamal.getC2()),group.negate(convert2ECPoint(e2ElGamal.getC2()))))); assert (verifier.verify(e1,e2,e1New,e2New,prover.prove(e1,e2,e1New,e2New,false,0,0,0,r1,r2))); diff --git a/mixer/src/test/java/profiling/BigInteger/AddSub.java b/mixer/src/test/java/profiling/BigInteger/AddSub.java index 1505aca..86ef2a7 100644 --- a/mixer/src/test/java/profiling/BigInteger/AddSub.java +++ b/mixer/src/test/java/profiling/BigInteger/AddSub.java @@ -23,7 +23,6 @@ public class AddSub { BigInteger[] randoms; BigInteger[] randoms2; - @Before public void setup() throws Exception { Random rand = new Random(); tests = 1 << 17; @@ -47,7 +46,6 @@ public class AddSub { } - @Test public void AddSubProfiling() throws InvalidProtocolBufferException { System.out.println("AddSub"); diff --git a/mixer/src/test/java/profiling/BigInteger/GenerateRandomness.java b/mixer/src/test/java/profiling/BigInteger/GenerateRandomness.java index 837fcc5..870d331 100644 --- a/mixer/src/test/java/profiling/BigInteger/GenerateRandomness.java +++ b/mixer/src/test/java/profiling/BigInteger/GenerateRandomness.java @@ -19,7 +19,7 @@ public class GenerateRandomness { int tests; ECElGamalEncryption enc; Random rand; - @Before + public void setup() throws Exception { rand = new Random(); ECGroup group = new ECGroup("secp256k1"); @@ -33,7 +33,6 @@ public class GenerateRandomness { } - @Test public void GenerateRandomnessProfiling() throws InvalidProtocolBufferException { System.out.println("GenerateRandomnessProfiling"); diff --git a/mixer/src/test/java/profiling/BigInteger/Modulo.java b/mixer/src/test/java/profiling/BigInteger/Modulo.java index a1757ee..a97cf6c 100644 --- a/mixer/src/test/java/profiling/BigInteger/Modulo.java +++ b/mixer/src/test/java/profiling/BigInteger/Modulo.java @@ -23,7 +23,6 @@ public class Modulo { BigInteger[] randoms; BigInteger orderUpperBound; - @Before public void setup() throws Exception { Random rand = new Random(); ECGroup group = new ECGroup("secp256k1"); @@ -41,7 +40,6 @@ public class Modulo { } } - @Test public void ModuloProfiling() throws InvalidProtocolBufferException { System.out.println("ModuloProfiling"); diff --git a/mixer/src/test/java/profiling/BigInteger/Mul.java b/mixer/src/test/java/profiling/BigInteger/Mul.java index 9656255..c25a1d8 100644 --- a/mixer/src/test/java/profiling/BigInteger/Mul.java +++ b/mixer/src/test/java/profiling/BigInteger/Mul.java @@ -21,7 +21,6 @@ public class Mul { BigInteger[] randoms; BigInteger[] randoms2; - @Before public void setup() throws Exception { Random rand = new Random(); tests = 1 << 17; @@ -45,7 +44,6 @@ public class Mul { } - @Test public void MulProfiling() throws InvalidProtocolBufferException { System.out.println("Mul"); diff --git a/mixer/src/test/java/profiling/BigInteger/SHA256.java b/mixer/src/test/java/profiling/BigInteger/SHA256.java index 7e086a4..c2f4cbc 100644 --- a/mixer/src/test/java/profiling/BigInteger/SHA256.java +++ b/mixer/src/test/java/profiling/BigInteger/SHA256.java @@ -26,7 +26,6 @@ public class SHA256 { BigInteger[] randoms; RandomOracle randomOracle; - @Before public void setup() throws Exception { Random rand = new Random(); randomOracle = new DigestOracle(); @@ -40,7 +39,6 @@ public class SHA256 { } } - @Test public void SHA256Profiling() throws InvalidProtocolBufferException { System.out.println("SHA256Profiling"); diff --git a/mixer/src/test/java/profiling/Convert/ByteString2ECPoint.java b/mixer/src/test/java/profiling/Convert/ByteString2ECPoint.java index 77d1a68..c11d718 100644 --- a/mixer/src/test/java/profiling/Convert/ByteString2ECPoint.java +++ b/mixer/src/test/java/profiling/Convert/ByteString2ECPoint.java @@ -28,7 +28,6 @@ public class ByteString2ECPoint { int tests; ConcreteCrypto.ElGamalCiphertext[] encryptedMessage; - @Before public void setup() throws Exception { rand = new Random(); group = new ECGroup("secp256k1"); @@ -53,7 +52,6 @@ public class ByteString2ECPoint { return group.decode(bs.toByteArray()); } - @Test public void ByteString2ECPointProfiling() throws InvalidProtocolBufferException { System.out.println("ByteString2ECPointProfiling"); diff --git a/mixer/src/test/java/profiling/Convert/RerandomizableEncryptedMessage2ElGamalCiphertext.java b/mixer/src/test/java/profiling/Convert/RerandomizableEncryptedMessage2ElGamalCiphertext.java index 8639911..316070d 100644 --- a/mixer/src/test/java/profiling/Convert/RerandomizableEncryptedMessage2ElGamalCiphertext.java +++ b/mixer/src/test/java/profiling/Convert/RerandomizableEncryptedMessage2ElGamalCiphertext.java @@ -28,7 +28,6 @@ public class RerandomizableEncryptedMessage2ElGamalCiphertext { int tests; Crypto.RerandomizableEncryptedMessage[] encryptedMessage; - @Before public void setup() throws Exception { rand = new Random(); group = new ECGroup("secp256k1"); @@ -48,7 +47,7 @@ public class RerandomizableEncryptedMessage2ElGamalCiphertext { encryptedMessage[i] = enc.encrypt(msg, enc.generateRandomness(rand)); } } - @Test + public void RerandomizableEncryptedMessage2ElGamalCiphertext() throws InvalidProtocolBufferException { System.out.println("RerandomizableEncryptedMessage2ElGamalCiphertext"); diff --git a/mixer/src/test/java/profiling/ECGroup/Add.java b/mixer/src/test/java/profiling/ECGroup/Add.java index 31865b9..c45457e 100644 --- a/mixer/src/test/java/profiling/ECGroup/Add.java +++ b/mixer/src/test/java/profiling/ECGroup/Add.java @@ -26,7 +26,6 @@ public class Add { List members1; List members2; - @Before public void setup() throws InvalidKeySpecException { // initialization random = new Random(); @@ -46,7 +45,6 @@ public class Add { } } - @Test public void addProfiling() throws InvalidProtocolBufferException { System.out.println("AddSub"); System.out.println("n is : " + n); diff --git a/mixer/src/test/java/profiling/ECGroup/Encode.java b/mixer/src/test/java/profiling/ECGroup/Encode.java index a7a731f..ccdf3cb 100644 --- a/mixer/src/test/java/profiling/ECGroup/Encode.java +++ b/mixer/src/test/java/profiling/ECGroup/Encode.java @@ -25,7 +25,7 @@ public class Encode { private int n; List members; - @Before + public void setup() throws InvalidKeySpecException { // initialization random = new Random(); @@ -41,7 +41,7 @@ public class Encode { members.add(group.sample(random)); } } - @Test + public void encodeProfiling() throws InvalidProtocolBufferException { System.out.println("Encode"); System.out.println("n is : " + n); diff --git a/mixer/src/test/java/profiling/ECGroup/Mul.java b/mixer/src/test/java/profiling/ECGroup/Mul.java index b0c0c7e..bb7ecaf 100644 --- a/mixer/src/test/java/profiling/ECGroup/Mul.java +++ b/mixer/src/test/java/profiling/ECGroup/Mul.java @@ -26,7 +26,7 @@ public class Mul { private int n; List members; List randomnesses; - @Before + public void setup() throws InvalidKeySpecException { // initialization random = new Random(); @@ -48,7 +48,6 @@ public class Mul { } } - @Test public void mulProfiling() throws InvalidProtocolBufferException { System.out.println("Multiply"); System.out.println("n is : " + n); diff --git a/mixer/src/test/java/profiling/ECGroup/Negate.java b/mixer/src/test/java/profiling/ECGroup/Negate.java index 75030fa..0c2d9d7 100644 --- a/mixer/src/test/java/profiling/ECGroup/Negate.java +++ b/mixer/src/test/java/profiling/ECGroup/Negate.java @@ -25,7 +25,6 @@ public class Negate { private int n; List members; - @Before public void setup() throws InvalidKeySpecException { // initialization random = new Random(); @@ -41,7 +40,7 @@ public class Negate { members.add(group.sample(random)); } } - @Test + public void negProfiling() throws InvalidProtocolBufferException { System.out.println("Neg"); System.out.println("n is : " + n); diff --git a/mixer/src/test/java/profiling/Rerandomize.java b/mixer/src/test/java/profiling/Rerandomize.java index ed018f3..495c7ca 100644 --- a/mixer/src/test/java/profiling/Rerandomize.java +++ b/mixer/src/test/java/profiling/Rerandomize.java @@ -34,7 +34,6 @@ public class Rerandomize { Crypto.EncryptionRandomness[] randomnesses; Crypto.RerandomizableEncryptedMessage[] encryptedMessage; - @Before public void setup() throws Exception { rand = new Random(); group = new ECGroup("secp256k1"); @@ -58,7 +57,6 @@ public class Rerandomize { } } - @Test public void RerandomizeProfiling() throws InvalidProtocolBufferException { System.out.println("Rerandomiz"); diff --git a/mixer/src/test/java/profiling/ZeroKnowledgeProof.java b/mixer/src/test/java/profiling/ZeroKnowledgeProof.java index c371d7b..356e69a 100644 --- a/mixer/src/test/java/profiling/ZeroKnowledgeProof.java +++ b/mixer/src/test/java/profiling/ZeroKnowledgeProof.java @@ -37,7 +37,7 @@ public class ZeroKnowledgeProof { Crypto.EncryptionRandomness[] randomnesses; Crypto.RerandomizableEncryptedMessage[] encryptedMessage; Crypto.RerandomizableEncryptedMessage[] reencryptedMessage; - @Before + public void setup() throws Exception { rand = new Random(); group = new ECGroup("secp256k1"); @@ -70,7 +70,6 @@ public class ZeroKnowledgeProof { return group.decode(bs.toByteArray()); } - @Test public void zeroKnowledgeProofTest() throws InvalidProtocolBufferException { System.out.println("Prove");