public static BswabeMsk unserializeBswabeMsk(BswabePub pub, byte[] b) { int offset = 0; BswabeMsk msk = new BswabeMsk(); msk.beta = pub.p.getZr().newElement(); msk.g_alpha = pub.p.getG2().newElement(); offset = unserializeElement(b, offset, msk.beta); offset = unserializeElement(b, offset, msk.g_alpha); return msk; }
public static BswabeCph bswabeCphUnserialize(BswabePub pub, byte[] cphBuf) { BswabeCph cph = new BswabeCph(); int offset = 0; int[] offset_arr = new int[1]; cph.cs = pub.p.getGT().newElement(); cph.c = pub.p.getG1().newElement(); offset = SerializeUtils.unserializeElement(cphBuf, offset, cph.cs); offset = SerializeUtils.unserializeElement(cphBuf, offset, cph.c); offset_arr[0] = offset; cph.p = SerializeUtils.unserializePolicy(pub, cphBuf, offset_arr); offset = offset_arr[0]; return cph; }
offset = unserializeElement(b, offset, prv.d); c.dp = pub.p.getG2().newElement(); offset = unserializeElement(b, offset, c.d); offset = unserializeElement(b, offset, c.dp);
public static BswabePub unserializeBswabePub(byte[] b) { BswabePub pub; int offset; pub = new BswabePub(); offset = 0; StringBuffer sb = new StringBuffer(""); offset = unserializeString(b, offset, sb); pub.pairingDesc = sb.substring(0); CurveParameters params = new DefaultCurveParameters() .load(new ByteArrayInputStream(pub.pairingDesc.getBytes())); pub.p = PairingFactory.getPairing(params); Pairing pairing = pub.p; pub.g = pairing.getG1().newElement(); pub.h = pairing.getG1().newElement(); pub.gp = pairing.getG2().newElement(); pub.g_hat_alpha = pairing.getGT().newElement(); offset = unserializeElement(b, offset, pub.g); offset = unserializeElement(b, offset, pub.h); offset = unserializeElement(b, offset, pub.gp); offset = unserializeElement(b, offset, pub.g_hat_alpha); return pub; }
p.cp = pub.p.getG1().newElement(); offset[0] = unserializeElement(arr, offset[0], p.c); offset[0] = unserializeElement(arr, offset[0], p.cp); } else { p.children = new BswabePolicy[n];