|
| 1 | +## upb.crypto.math |
| 2 | + |
| 3 | +upb.crypto.math is a library providing a number of mathematical tools needed in many cryptographic applications. |
| 4 | + |
| 5 | +These include: |
| 6 | + |
| 7 | +* Elliptic curve groups with pairings |
| 8 | + * Type 1: |
| 9 | + * Supersingular Curve with Tate pairing |
| 10 | + * Type 3: |
| 11 | + * Barreto-Naehrig |
| 12 | +* Hashing |
| 13 | + * SHA-256 |
| 14 | + * SHA-512 |
| 15 | +* Mathematical structures: |
| 16 | + * Ring of integers modulo n |
| 17 | + * Ring of polynomials |
| 18 | + |
| 19 | +## Example Code |
| 20 | + |
| 21 | +As a starting point, we provide exemplary code of common tasks. |
| 22 | + |
| 23 | +##### Setting up a Type 3 Bilinear Group |
| 24 | + |
| 25 | +Given a security parameter `securityParameter`, we can set up a type 3 bilinear group using this library as follows: |
| 26 | + |
| 27 | +```java |
| 28 | +BilinearGroupFactory fac = new BilinearGroupFactory(securityParameter); |
| 29 | +fac.setRequirements(BilinearGroup.Type.TYPE_3); |
| 30 | +BilinearGroup group = fac.createBilinearGroup(); |
| 31 | +``` |
| 32 | + |
| 33 | +This chooses a type 3 bilinear group from predefined ones. Alternatively, the library enables it to register new groups by defining a `BilinearGroupProvider`. |
| 34 | + |
| 35 | +##### Register your own Bilinear Group Implementation |
| 36 | + |
| 37 | +Suppose you have your own implementation of a type 3 bilinear group and you want to use it in our library. To do so, you only need write a `MyBilinearGroupProvider` that implements the interface `BilinearGroupProvider`. |
| 38 | +Then, your group can be registered in the `BilinearGroupFactory` as follows: |
| 39 | + |
| 40 | +```java |
| 41 | +BilinearGroupFactory fac = new BilinearGroupFactory(securityParameter); |
| 42 | +fac.registerProvider(Arrays.asList(new BarretoNaehrigProvider(), new MyBilinearGroupProvider())); |
| 43 | +fac.setRequirements(BilinearGroup.Type.TYPE_3); |
| 44 | +BilinearGroup group = fac.createBilinearGroup(); |
| 45 | +``` |
| 46 | + |
| 47 | +As an example have a look at our module [upb.crypto.mclwrap](https://github.com/upbcuk/upb.crypto.mclwrap), which includes the pairing library [mcl](https://github.com/herumi/mcl) in our environment. |
| 48 | + |
| 49 | +## Notes |
| 50 | + |
| 51 | +The library was implemented at Paderborn University in the research group ["Codes und Cryptography"](https://cs.uni-paderborn.de/en/cuk/). |
| 52 | + |
| 53 | +This module is the base of [CRACO](https://github.com/upbcuk/upb.crypto.craco) and [CLARC](https://github.com/upbcuk/upb.crypto.clarc) providing cryptographic constructions, and an anonymous credential and reputation system, respectively. |
| 54 | + |
| 55 | +## Licence |
| 56 | +Apache License 2.0, see LICENCE file. |
0 commit comments