|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsoftware.common.MarkPermutations
public class MarkPermutations
Computes the mark permutations using the following algorithm
For P:
Let M be a byte array of length 16 (see below how M is constructed for P1,P2,D2)
Compute a secret key SK = Dmk1(C xor Emk2(C xor Emk1(M))) AES128 ECB NoPadding
Let MM be a byte array of length 2, MM[0]=question number, MM[1]=answer number
Using the secret key SK, encrypt MM using AES128 ECB PKCS#5Padding
sort the cryptograms to generate the permutation
For P1:
M=serial+"top"
For P2:
M=serial+"bottom"
For D2:
M=DInstanceNumber+serial+"d2"
D4 is computed from P1,P2,P4
The format of the permutatio is:
each permutation is represented as an array of possitive bytes (thus max 127).
The questions takes n possitions in the array (n is the number of answers)
, each possition having one element of the permutation. For example, if question 6 starts at possition 19
and has 4 answers, ans possitions 19,20,21 and 22 have 2,3,1,0 the permutation is 0->2,1->3,2->1,3->0
| Constructor Summary | |
|---|---|
MarkPermutations(byte[] c,
org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es,
java.util.Vector<java.util.Vector<java.lang.Integer>> partitions)
|
|
MarkPermutations(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es,
java.util.Vector<java.util.Vector<java.lang.Integer>> partitions)
|
|
| Method Summary | |
|---|---|
byte[] |
compose(byte[] p1,
byte[] p2)
Composes two layers. |
byte[] |
compose(byte[] p1,
byte[] p2,
byte partitionId)
Composes two layers. |
byte[] |
computeD3(byte[] p3,
byte[] d2,
byte partitionId)
|
byte[] |
computeR(byte[] d3,
byte[] d4,
byte partitionId)
|
byte[] |
getCanonical()
|
byte[] |
getD2(byte[] did,
byte dInstance,
int partitionId)
this permutation is pseudo-randomly generated |
byte[] |
getD4(byte[] top,
byte[] bottom,
byte[] d2,
byte partitionId)
permutation is deterministically generated. |
byte[] |
getInverseAllPartition(byte[] d2)
|
byte[] |
getInversePartition(byte[] d2,
int partitionId)
|
int |
getMaxNoAnswersInPartition(int partitionId)
|
int |
getMaxNoAnswersInQuestion(int q)
|
int |
getNoAnswersInPartition(int partitionId)
|
byte[] |
getP1(byte[] serial)
this permutation is pseudo-randomly generated |
byte[] |
getP1(byte[] serial,
byte partitionId)
this permutation is pseudo-randomly generated |
byte[] |
getP2(byte[] serial)
this permutation is pseudo-randomly generated |
byte[] |
getP2(byte[] serial,
byte partitionId)
this permutation is pseudo-randomly generated |
int |
getSize()
|
int |
getTotalMaxNoAnswers()
|
int |
getTotalNoAnswers()
|
byte[] |
project(byte[] p,
int partitionId)
Projects a byte array on a given partition I.E extracts only the possitions that corespond to the given partition from the byte array and concatenates them together |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MarkPermutations(byte[] c,
org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es,
java.util.Vector<java.util.Vector<java.lang.Integer>> partitions)
c - - the public constantes - - the Election Specificationpartitions - - what questions are in each partition
public MarkPermutations(javax.crypto.spec.SecretKeySpec mk1,
javax.crypto.spec.SecretKeySpec mk2,
byte[] c,
org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es,
java.util.Vector<java.util.Vector<java.lang.Integer>> partitions)
mk1 - - master key 1mk2 - - master key 2c - - public constantes - - Election Specificationpartitions - - what questions are in each partition (ex {{0,1}{2}{3,4,5}}
means that there are 3 partitions, in the first one there are questions 0 and 1, in the
second one question 2 and in the third patition questions 3,4,5)| Method Detail |
|---|
public byte[] getCanonical()
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getP1(byte[] serial)
throws java.lang.Exception
serial - the serial number of the ballot
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getP2(byte[] serial)
throws java.lang.Exception
serial - the serial number of the ballot
java.lang.Exception
public byte[] getP1(byte[] serial,
byte partitionId)
throws java.lang.Exception
serial - the serial number of the ballotpartitionId -
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getP2(byte[] serial,
byte partitionId)
throws java.lang.Exception
serial - the serial number of the ballotpartitionId -
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getD2(byte[] did,
byte dInstance,
int partitionId)
throws java.lang.Exception
dInstance - the instance number of Ddid - the serial number of the ballot
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getInverseAllPartition(byte[] d2)
throws java.lang.Exception
d2 - all the permutations for all partitions
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] getInversePartition(byte[] d2,
int partitionId)
throws java.lang.Exception
d2 - the permutations in a given partitionpartitionId - - the partition id
java.lang.Exception - - if the length of d2 is different then the length of the
questions in the given partition, an Exception si thrown
public byte[] getD4(byte[] top,
byte[] bottom,
byte[] d2,
byte partitionId)
throws java.lang.Exception
top - the top permutationbottom - the bottom permutationd2 - the first permutation in D
java.lang.Exception - - no Exception is caugth and no Exception is Explicitly thrown
public byte[] project(byte[] p,
int partitionId)
p - - the permutation for all the questionspartitionId -
public int getSize()
public int getNoAnswersInPartition(int partitionId)
partitionId -
public int getMaxNoAnswersInQuestion(int q)
q - - question numbers
public int getMaxNoAnswersInPartition(int partitionId)
partitionId -
public byte[] compose(byte[] p1,
byte[] p2)
p1 - - the permutation that is appleid secondp2 - - the permutation that is applied first
public byte[] compose(byte[] p1,
byte[] p2,
byte partitionId)
p1 - - the permutation that is appleid secondp2 - - the permutation that is applied firstpartitionId -
public int getTotalMaxNoAnswers()
public int getTotalNoAnswers()
public byte[] computeD3(byte[] p3,
byte[] d2,
byte partitionId)
throws java.lang.Exception
p3 - - the selection made by the voter (the entire selection, not just for the given partition)d2 - - the transformationpartitionId -
java.lang.Exception - if p3.length!=total number of answers that the voter can select on the entire ballot (non votes are represented by -1)
or if d2.length!=the number of answers in the given partition (the sum for all the questions)
public byte[] computeR(byte[] d3,
byte[] d4,
byte partitionId)
throws java.lang.Exception
d3 - - the partial decripted balot in the D tabled4 - - the second transformation in the D tablepartitionId -
java.lang.Exception - if d3.length!=the maximum number of answers the voter can select for the questions in the given partition (their sum)
or if d4.length!=the total number of answers in the given partition (the sum for all the questions)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||