How to use JPBC?

To use JPBC, add to your classpath the following jars: jpbc_2.0.0-api.jar and jpbc_2.0.0-plaf.jar.

To use the PBC Wrapper, a shared C library must be compiled and installed properly as shown here. Then, to use the wrapper, include the following jars: jpbc_2.0.0-pbc.jar and jna-3.1.0.jar.

To use the Multilinear Maps, include the following jar: jpbc_2.0.0-mm.jar.

To use the cryptosystems provided by JPBC include the following jars: jpbc-crypto-2.0.0.jar and bcprov-jdk16-1.46.

Which is the main entry point?

The main entry point is the Pairing interface that provides access to the algebraic structures underlying the pairing computation and the pairing function.

How do I get an instance of the Pairing interface?

The easiest way to obtain an instance of the Pairing interface is by using the factory provided by JPBC. The factory takes in input the pairing parameters and instantiates the appropriate classes. To generate the pairing parameters look at this page.

Let's now see how to use the factory.

Assume that the pairing parameters (for bilinear or multilinear maps) are stored in a file called Then, the following code instantiate the appropriate class implementing the Pairing interface.

import it.unisa.dia.gas.jpbc.*;
import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory;

Pairing pairing = PairingFactory.getPairing("");

For bilinear maps only, to use the PBC wrapper, the usePBCWhenPossible property of the pairing factory must be set.


Notice that, to effectively use the wrapper the usePBCWhenPossible property must be set before invoking the getPairing method.

Moreover, if PBC and the JPBC wrapper are not installed properly then the factory will resort to the JPBC pairing implementation.
The instructions to properly setup the PBC wrapper are here.

What an Element is?

The Element interface represents elements belonging to an algebraic structure (groups, rings and fields). This objects are mutable meaning that the internal value can be modified by invoking appropriate methods.