software.engine
Class RowPermutation
java.lang.Object
software.engine.RowPermutation
public class RowPermutation
- extends java.lang.Object
Computes the row permutations using the following algorithm
Let M be a byte array of length 16. On the first possitions M will have tableInstance.
On the following possitions M will have columnName
Compute a secret key SK = Dmk1(C xor Emk2(C xor Emk1(M))) AES128 ECB NoPadding
Let MM be a byte array with the string representation of the serial numbers
Using the secret key SK, encrypt MM using AES128 ECB PKCS#5Padding
- sort the cryptograms to generate the permutation
|
Method Summary |
static int[] |
permuteD1(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
byte tableInstance,
int startSerial,
int endSerial,
byte partitionId)
Gets the permutation mapping D to P. |
static int[] |
permuteD1D5(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
int startSerial,
int endSerial,
byte partitionId)
Gets the permutation mapping D1 to D5. |
static int[] |
permuteD5(int[] master,
int[] d1)
Deterministically computes the mapping between D and R, based on the mapping between
P and D (D1) and D1 to D5. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
D1D5CONSTANT
public static byte[] D1D5CONSTANT
D1CONSTANT
public static byte[] D1CONSTANT
RowPermutation
public RowPermutation()
permuteD1D5
public static int[] permuteD1D5(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
int startSerial,
int endSerial,
byte partitionId)
throws java.lang.Exception
- Gets the permutation mapping D1 to D5. This maping is the same for
all the instances of the D tables (because one P has to be mapped to one R)
- Parameters:
mk1 - - master key 1mk2 - - master key 2c - - public constantstartSerial - - the first serial numbered considered (ussualy 0)endSerial - - the last serial number considered (including) (ussualy the number of ballots)partitionId -
- Returns:
- a permutation of length endSerial-startSerial+1
- Throws:
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
permuteD1
public static int[] permuteD1(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
byte tableInstance,
int startSerial,
int endSerial,
byte partitionId)
throws java.lang.Exception
- Gets the permutation mapping D to P. This permutation is different for
every instance of the D table
- Parameters:
mk1 - - master key 1mk2 - - master key 2c - - public constanttableInstance - startSerial - - the first serial numbered considered (ussualy 0)endSerial - - the last serial number considered (including) (ussualy the number of ballots)partitionId -
- Returns:
- a permutation of length endSerial-startSerial+1
- Throws:
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
permuteD5
public static int[] permuteD5(int[] master,
int[] d1)
throws java.lang.Exception
- Deterministically computes the mapping between D and R, based on the mapping between
P and D (D1) and D1 to D5.
- Parameters:
master - the D1D5 permutationd1 - d1 permutation
- Returns:
- master[d1]
- Throws:
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown