Using JPBC(Java Pairing-Based Cryptography Library) to implement pairing-based cryptography algorithm like BBS04 group signature. And I proposed a modification of batch verification to the original BBS04.
If there exists formula displaying mistakes, check the pdf of README also.
please refer to the official website of JPBC: http://gas.dia.unisa.it/projects/jpbc/index.html
Download the JPBC Library from the official website, and import the jar package you need to the project. jpbc-api-2.0.0.jar
and jpbc-plaf-2.0.0.jar
are mostly used.
Also copy the parameter file under the project directory, which is used to generate bilinear group.
Notice that Type A pairing is symmetric.
See the following example that initializes a new element without calling getImmutable()
import it.unisa.dia.gas.jpbc.Pairing;
import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory;
import it.unisa.dia.gas.jpbc.Field;
import it.unisa.dia.gas.jpbc.Element;
public class JPBCDemo {
public static void main(String[] args) {
Pairing bp = PairingFactory.getPairing("a.properties");
Field G1=bp.getG1();
Field Zr=bp.getZr();
Element g=G1.newRandomElement();
Element a=Zr.newRandomElement();
System.out.println(g);
System.out.println(a);
Element g_a=g.powZn(a); //the value "g" will be changed to g_a
System.out.println(g);
System.out.println(a);
System.out.println(g_a);
}
}
Although
method to avoid:
-
call getImmutable() when defining g
Element g = pairing.getG1().newRandomElement().getImmutable();
-
or call duplicate() when using g
Element ga = g.duplicate().powZn(a);
I would tend to use getImmutable()
the original paper: https://crypto.stanford.edu/~dabo/pubs/papers/groupsigs.pdf
Assume bilinear groups (
-
choose a generator
$g_1$ from$G_1$ , choose a generator$g_2$ from$G_2$ -
select
$h$ $\in$ $G_1$ $\backslash{1_{G_1}}$ (1 stands for the identity element of$G_1$ , so$h$ is the element in$G_1$ except identity element 1), choose$\xi_1,\xi_2\in$ ${Z_p}^*$ ; select$u,v\in$ $G_1$ so that$u^{\xi_1}=v^{\xi_2}=h$ -
choose
$\gamma\in{Z_p}^*$ , compute$\omega={g_2}^\gamma$ -
group public key is
$(g_1,g_2,h,u,v,\omega)$ , group manger private key is$(\xi_1,\xi_2)$
For each group member
Therefore, the group manger know the private key of each group member. As a result, manger may forge member's signature theoretically. So the group manger needs to be trustable.
Given a group public key
For a certain member whose private key is
- randomly choose
$\alpha,\beta\in Z_p$ , compute$T_1=u^\alpha,T_2=v^\beta,T_3=Ah^{\alpha+\beta}$ - randomly choose$r_\alpha,r_\beta,r_x,r_{\delta_1},r_{\delta_2} \in Z_p$, compute
$R_1=u^{r_\alpha}$ ,$R_2=v^{r_\beta}$ ,$R_3=e(T_3,g_2)^{r_x} \cdot e(h,\omega)^{-r_\alpha-r_\beta} \cdot e(h,g_2)^{-r_{\delta_1}-r_{\delta_2}}$ ,$R_4={T_1}^{r_x} \cdot u^{-r_{\delta_1}}$ ,$R_5={T_2}^{r_x} \cdot v^{-r_{\delta_2}}$ - compute the hash value
$c=H(M,T_1,T_2,T_3,R_1,R_2,R_3,R_4,R_5) \in Z_p$ - compute
$s_\alpha=r_\alpha+c\alpha$ ,$s_\beta=r_\beta+c\beta$ ,$s_x=r_x+cx$ ,$s_{\delta_1}=r_{\delta_1}+c\delta_1$ ,$s_{\delta_2}=r_{\delta_2}+c\delta_2$ , where$\delta_1=x\alpha,\delta_2=x\beta$ , and the signature is$\sigma=(T_1,T_2,T_3,c,s_\alpha,s_\beta,s_x,s_{\delta_1},s_{\delta_2})$
compute
verify whether
if equals, then the signature is valid. Otherwise, invalid.
Compute
Since bilinear mapping is initially used in Identity-Based Encryption system, we often need to hash a specific string or byte array into bilinear group.
During the process of signing and verification, hash function is indispensable. In the process of signing, hash the message with other variables, and then obtain the hash value Element
(JPBC), not int
, so the hash value should be mapped to Z group, transforming into Element type.
int c_sign=M_sign.hashCode(); //M_sign is String type
byte[] c_sign_byte = Integer.toString(c_sign).getBytes();
Element c = (Zr.newElementFromHash(c_sign_byte, 0, c_sign_byte.length)).getImmutable();
After hashing the message, transform int to byte array, then call newElementFromHash()
method to generate a corresponding element of
newElementFromHash()
can map the hash value into
prove:
let
When computing two bilinear pairings with the same
During the verification, computing
Then consider the case that the number of signatures is
$$ \prod_{i=1}^n [e({{T_3}_i}^{{s_x}i} \cdot h^{-{s{\delta_1}}i-{s{\delta_2}}i} \cdot {g_1}^{-c_i},g_2) \cdot e(h^{-{s\alpha}i-{s\beta}_i} \cdot {T_3}^{c_i},\omega)] $$
$$ = e(\prod_{i=1}^n {{T_3}i}^{{s_x}i} \cdot h^{-{s{\delta_1}}i-{s{\delta_2}}i} \cdot {g_1}^{-c_i},g_2) \cdot e(\prod{i=1}^n {h^{-{s\alpha}i-{s\beta}_i} \cdot {T_3}^{c_i}},\omega) $$
Since the BBS04 group signature scheme is based on bilinear pairing, and pairing operation is about 1500 times as time-consuming as multiplication. If we receive several signatures and verify them separately, it will takes even more time.
What if we verify a batch of signatures simultaneously?
In this way, we can decrease the number of times to do paring from 5n to 2, however big n is. Thus saving a lot of time for verification.
A modification of batch verification as follow :
Group public key is
Assume now we have
for each
- firstly verify whether the four equations are true
$$ {T_1}_i^{{s_x}i} \cdot u^{-{s{\delta_1}}_i} = {R_4}_i $$
$$ {T_2}_i^{{s_x}i} \cdot v^{-{s{\delta_2}}_i} = {R_5}_i $$
- then verify the equation
$$ e(\prod_{i=1}^n {{T_3}i}^{{s_x}i} \cdot h^{-{s{\delta_1}}i-{s{\delta_2}}i} \cdot {g_1}^{-c_i},g_2) \cdot e(\prod{i=1}^n {h^{-{s\alpha}i-{s\beta}i} \cdot {T_3}^{c_i}},\omega) = \prod{i=1}^n {{R_3}_i} $$
If and only if the above equations are true, these n signatures can successfully pass the verification together.