1 package civitas.crypto.ciphertext.tests;
2
3 import civitas.common.VoteChoice;
4 import civitas.crypto.ciphertext.ElGamalCiphertext;
5 import civitas.crypto.msg.tests.ElgamalMsgTestData;
6 import civitas.crypto.publickey.tests.ElGamalPublicKeyTestData;
7 import civitas.crypto.reencryptfactor.tests.ElGamalReencryptFactorTestData;
8 import civitas.util.CivitasBigInteger;
9 import civitas.util.CivitasBigIntegerFactory;
10
11 public interface ElGamalCiphertextTestData
12 extends ElgamalMsgTestData, ElGamalPublicKeyTestData, ElGamalReencryptFactorTestData {
13
14 ElGamalCiphertext EL_GAMAL_CIPHERTEXT_ONE = new ElGamalCiphertext(ONE, ONE_ENCODED.m());
15 ElGamalCiphertext EL_GAMAL_CIPHERTEXT_TWO = new ElGamalCiphertext(TWO, TWO_ENCODED.m());
16
17 CivitasBigInteger CIPHERTEXT_E_A = BIGINT_G.modPow(FACTOR_E, BIGINT_P);
18 CivitasBigInteger CIPHERTEXT_E_B =
19 MESSAGE_VOTE_CAPABILITY_SHARE_ENCODED.modMultiply(PUBKEY_E.modPow(FACTOR_E, BIGINT_P), BIGINT_P);
20 ElGamalCiphertext CIPHERTEXT_E = new ElGamalCiphertext(CIPHERTEXT_E_A, CIPHERTEXT_E_B);
21 ElGamalCiphertext CIPHERTEXT_E_REENCRYPTED = new ElGamalCiphertext(
22 CIPHERTEXT_E_A.modMultiply(BIGINT_G.modPow(RANDOMS_0, BIGINT_P), BIGINT_P),
23 CIPHERTEXT_E_B.modMultiply(PUBKEY_EPRIME.modPow(RANDOMS_0, BIGINT_P), BIGINT_P));
24
25 CivitasBigInteger CIPHERTEXT_ENCCAP_A = BIGINT_G.modPow(FACTOR_EPRIME, BIGINT_P);
26 CivitasBigInteger CIPHERTEXT_ENCCAP_B =
27 MESSAGE_VOTE_CAPABILITY_SHARE_ENCODED.modMultiply(PUBKEY_E.modPow(FACTOR_EPRIME, BIGINT_P), BIGINT_P);
28 ElGamalCiphertext CIPHERTEXT_ENCCAP = new ElGamalCiphertext(CIPHERTEXT_ENCCAP_A, CIPHERTEXT_ENCCAP_B);
29
30 CivitasBigInteger CIPHERTEXT_EPRIME_A = BIGINT_G.modPow(FACTOR_EPRIME, BIGINT_P);
31 CivitasBigInteger CIPHERTEXT_EPRIME_B =
32 MESSAGE_VOTE_CAPABILITY_SHARE_ENCODED.modMultiply(PUBKEY_E.modPow(FACTOR_EPRIME, BIGINT_P), BIGINT_P);
33 ElGamalCiphertext CIPHERTEXT_EPRIME = new ElGamalCiphertext(CIPHERTEXT_EPRIME_A, CIPHERTEXT_EPRIME_B);
34
35 ElGamalCiphertext EL_GAMAL_CIPHERTEXT = new ElGamalCiphertext(GENERATOR_OTHER_POW_R1, BIGINT_D);
36
37 ElGamalCiphertext ENCRYPTED_WITH_FACTOR_EPRIME = new ElGamalCiphertext(
38 G_EXP_FACTOR,
39 MESSAGE_VOTE_CAPABILITY_SHARE_ENCODED.modMultiply(PUBKEY_EPRIME.modPow(FACTOR_EPRIME, BIGINT_P), BIGINT_P));
40
41 ElGamalCiphertext ENCRYPTED_ZERO_FACTOR = new ElGamalCiphertext(ONE, G_EXP_B);
42
43 byte[] VOTER_ADDITIONAL_ENV = "8+bob hash".getBytes();
44
45 ElGamalCiphertext CIPHERTEXT_2_3 =
46 new ElGamalCiphertext(CivitasBigIntegerFactory.obtain(2), CivitasBigIntegerFactory.obtain(3));
47 ElGamalCiphertext[][] CIPHERTEXT_MATRIX = {
48 {
49 CIPHERTEXT_2_3,
50 new ElGamalCiphertext(CivitasBigIntegerFactory.obtain(5), CivitasBigIntegerFactory.obtain(7)),
51 },
52 {
53 new ElGamalCiphertext(CivitasBigIntegerFactory.obtain(11), CivitasBigIntegerFactory.obtain(13)),
54 new ElGamalCiphertext(CivitasBigIntegerFactory.obtain(17), CivitasBigIntegerFactory.obtain(19)),
55 }
56 };
57 VoteChoice MY_CHOICE = VoteChoice.I_BEATS_J;
58 }