private static void fillPolicy(BswabePolicy p, BswabePub pub, Element e)
throws NoSuchAlgorithmException {
int i;
Element r, t, h;
Pairing pairing = pub.p;
r = pairing.getZr().newElement();
t = pairing.getZr().newElement();
h = pairing.getG2().newElement();
p.q = randPoly(p.k - 1, e);
if (p.children == null || p.children.length == 0) {
p.c = pairing.getG1().newElement();
p.cp = pairing.getG2().newElement();
elementFromString(h, p.attr);
p.c = pub.g.duplicate();;
p.c.powZn(p.q.coef[0]);
p.cp = h.duplicate();
p.cp.powZn(p.q.coef[0]);
} else {
for (i = 0; i < p.children.length; i++) {
r.set(i + 1);
evalPoly(t, p.q, r);
fillPolicy(p.children[i], pub, t);
}
}
}