Procházet zdrojové kódy

Access 0<i<h cases done

Boyoung- před 9 roky
rodič
revize
f5e6a698f6
2 změnil soubory, kde provedl 37 přidání a 2 odebrání
  1. 18 2
      src/protocols/Access.java
  2. 19 0
      src/protocols/OutAccess.java

+ 18 - 2
src/protocols/Access.java

@@ -21,7 +21,7 @@ public class Access extends Protocol {
 		super(con1, con2);
 	}
 
-	public void runE(PreData predata, Tree OTi, byte[] Li, byte[] Ni, byte[] Nip1_pr) {
+	public OutAccess runE(PreData predata, Tree OTi, byte[] Li, byte[] Ni, byte[] Nip1_pr) {
 		// step 1
 		Bucket[] pathBuckets = OTi.getBucketsOnPath(new BigInteger(1, Li).longValue());
 		Tuple[] pathTuples = Bucket.bucketsToTuples(pathBuckets);
@@ -52,6 +52,12 @@ public class Access extends Protocol {
 
 		SSIOT ssiot = new SSIOT(con1, con2);
 		ssiot.runE(predata, y_array, Nip1_pr);
+
+		// step 5
+		Tuple Ti = new Tuple(new byte[0], Ni, Li, y);
+
+		OutAccess outaccess = new OutAccess(null, null, null, Ti, pathTuples);
+		return outaccess;
 	}
 
 	public void runD(PreData predata, Tree OTi, byte[] Li, byte[] Ni, byte[] Nip1_pr) {
@@ -84,7 +90,7 @@ public class Access extends Protocol {
 		ssiot.runD(predata, Nip1_pr);
 	}
 
-	public void runC(Metadata md, int treeIndex) {
+	public OutAccess runC(Metadata md, int treeIndex) {
 		// step 2
 		Object[] objArray = con2.readObjectArray();
 		Tuple[] pathTuples = Arrays.copyOf(objArray, objArray.length, Tuple[].class);
@@ -106,6 +112,16 @@ public class Access extends Protocol {
 		int lSegBytes = md.getABytesOfTree(treeIndex) / md.getTwoTauPow();
 		byte[] z_j2 = Arrays.copyOfRange(z, j2 * lSegBytes, (j2 + 1) * lSegBytes);
 		byte[] Lip1 = Util.xor(jy.m_t, z_j2);
+
+		Tuple Ti = new Tuple(new byte[] { 1 }, Ni, new byte[md.getLBytesOfTree(treeIndex)], z);
+
+		pathTuples[j1].getF()[0] = (byte) (1 - pathTuples[j1].getF()[0]);
+		Crypto.sr.nextBytes(pathTuples[j1].getN());
+		Crypto.sr.nextBytes(pathTuples[j1].getL());
+		Crypto.sr.nextBytes(pathTuples[j1].getA());
+
+		OutAccess outaccess = new OutAccess(Lip1, Ti, pathTuples, null, null);
+		return outaccess;
 	}
 
 	@Override

+ 19 - 0
src/protocols/OutAccess.java

@@ -0,0 +1,19 @@
+package protocols;
+
+import oram.Tuple;
+
+public class OutAccess {
+	public byte[] C_Lip1;
+	public Tuple E_Ti;
+	public Tuple C_Ti;
+	public Tuple[] E_P;
+	public Tuple[] C_P;
+
+	public OutAccess(byte[] C_Lip1, Tuple C_Ti, Tuple[] C_P, Tuple E_Ti, Tuple[] E_P) {
+		this.C_Lip1 = C_Lip1;
+		this.E_Ti = E_Ti;
+		this.C_Ti = C_Ti;
+		this.E_P = E_P;
+		this.C_P = C_P;
+	}
+}