|
1 | | -[](https://travis-ci.com/upbcuk/upb.crypto.math) |
2 | | -## upb.crypto.math |
3 | | - |
4 | | -upb.crypto.math is a library providing a number of mathematical tools needed in many cryptographic applications. |
5 | | - |
6 | | -These include: |
7 | | - |
8 | | -* Elliptic curve groups with pairings |
9 | | - * Type 1: |
10 | | - * Supersingular Curve with Tate pairing |
11 | | - * Type 3: |
12 | | - * Barreto-Naehrig |
13 | | -* Hashing |
14 | | - * SHA-256 |
15 | | - * SHA-512 |
16 | | -* Mathematical structures: |
17 | | - * Ring of integers modulo n |
18 | | - * Ring of polynomials |
19 | | - |
20 | | -## Example Code |
21 | | - |
22 | | -As a starting point, we provide exemplary code of common tasks. |
| 1 | + |
| 2 | +## Math |
| 3 | + |
| 4 | +The Cryptimeleon Math library provides the mathematical foundation for the other Cryptimeleon libraries. |
| 5 | +It provides basics such as mathematical groups, rings and fields, e.g. Zn, as well as implementations of cryptographic pairings. |
| 6 | +Furthermore, it provides serialization support for the implemented structures. |
| 7 | + |
| 8 | +## Security Disclaimer |
| 9 | +**WARNING: This library is meant to be used for prototyping and as a research tool *only*. It has not been sufficiently vetted for use in security-critical production environments. All implementations are to be considered experimental.** |
| 10 | + |
| 11 | +## Table Of Contents |
| 12 | + |
| 13 | +* [Features Overview](#features) |
| 14 | +* [Quickstart Guide](#quickstart) |
| 15 | + * [Maven Installation](#installation-with-maven) |
| 16 | + * [Gradle Installation](#installation-with-gradle) |
| 17 | + * [Tutorials](#tutorials) |
| 18 | +* [Pairing Performance](#note-regarding-pairing-performance) |
| 19 | +* [Miscellaneous Information](#miscellaneous-information) |
| 20 | +* [Authors](#authors) |
| 21 | + |
| 22 | +## Features |
| 23 | + |
| 24 | +Below we give a more detailed list of features. |
| 25 | + |
| 26 | +### Groups |
| 27 | + |
| 28 | +Math offers the following algebraic groups: |
| 29 | + |
| 30 | +* Bilinear groups: |
| 31 | + * Type 1 and type 3 pairings |
| 32 | +* Elliptic curves without pairings: |
| 33 | + * `Secp256k1` |
| 34 | +* Symmetric group Sn |
| 35 | +* Cartesian product group |
| 36 | + |
| 37 | +### Rings |
23 | 38 |
|
24 | | -##### Setting up a Type 3 Bilinear Group |
| 39 | +Math offers the following algebraic rings and fields: |
25 | 40 |
|
26 | | -Given a security parameter `securityParameter`, we can set up a type 3 bilinear group using this library as follows: |
| 41 | +* Boolean ring |
| 42 | +* Cartesian product ring |
| 43 | +* Field extension class for polynomials of the form x^d + c |
| 44 | +* Integer ring |
| 45 | +* Polynomial ring |
| 46 | +* Ring Zn and Field Zp for prime p |
27 | 47 |
|
28 | | -```java |
29 | | -BilinearGroupFactory fac = new BilinearGroupFactory(securityParameter); |
30 | | -fac.setRequirements(BilinearGroup.Type.TYPE_3); |
31 | | -BilinearGroup group = fac.createBilinearGroup(); |
32 | | -``` |
| 48 | +### Other Features |
33 | 49 |
|
34 | | -This chooses a type 3 bilinear group from predefined ones. Alternatively, the library enables it to register new groups by defining a `BilinearGroupProvider`. |
| 50 | +Math also implements a number of other features: |
35 | 51 |
|
36 | | -##### Register your own Bilinear Group Implementation |
| 52 | +* Multi-exponentiation algorithms |
| 53 | +* Deferred evaluation of group operations for automatic application of those multi-exponentiation algorithms |
| 54 | +* Serialization features that integrate with the implemented algebraic structures |
| 55 | +* Group operation counting capabilities |
| 56 | +* A random generator |
| 57 | +* Hash function implementations such as SHA256 and SHA512 |
37 | 58 |
|
38 | | -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`. |
39 | | -Then, your group can be registered in the `BilinearGroupFactory` as follows: |
| 59 | +## Quickstart |
40 | 60 |
|
41 | | -```java |
42 | | -BilinearGroupFactory fac = new BilinearGroupFactory(securityParameter); |
43 | | -fac.registerProvider(Arrays.asList(new BarretoNaehrigProvider(), new MyBilinearGroupProvider())); |
44 | | -fac.setRequirements(BilinearGroup.Type.TYPE_3); |
45 | | -BilinearGroup group = fac.createBilinearGroup(); |
| 61 | +### Installation With Maven |
| 62 | +To add the newest Math version as a dependency, add this to your project's POM: |
| 63 | + |
| 64 | +```xml |
| 65 | +<dependency> |
| 66 | + <groupId>org.cryptimeleon</groupId> |
| 67 | + <artifactId>math</artifactId> |
| 68 | + <version>1.0.0</version> |
| 69 | +</dependency> |
46 | 70 | ``` |
47 | 71 |
|
48 | | -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. |
| 72 | +### Installation With Gradle |
49 | 73 |
|
50 | | -## Notes |
| 74 | +Math is published via Maven Central. |
| 75 | +Therefore, you need to add `mavenCentral()` to the `repositories` section of your project's `build.gradle` file. |
| 76 | +Then, add `implementation group: 'org.cryptimeleon', name: 'math', version: '1.0.0'` to the `dependencies` section of your `build.gradle` file. |
51 | 77 |
|
52 | | -The library was implemented at Paderborn University in the research group ["Codes und Cryptography"](https://cs.uni-paderborn.de/en/cuk/). |
| 78 | +For example: |
| 79 | + |
| 80 | +```groovy |
| 81 | +repositories { |
| 82 | + mavenCentral() |
| 83 | +} |
| 84 | +
|
| 85 | +dependencies { |
| 86 | + implementation group: 'org.cryptimeleon', name: 'math', version: '1.0.0' |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +### Tutorials |
53 | 91 |
|
54 | | -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. |
| 92 | +We recommend you go through our [short Math tutorial](https://cryptimeleon.github.io/getting-started/5-minute-tutorial.html) to get started. |
55 | 93 |
|
56 | | -## Licence |
57 | | -Apache License 2.0, see LICENCE file. |
| 94 | +We also provide a walkthrough where we show you how to implement a pairing-based signature scheme [here](https://cryptimeleon.github.io/getting-started/pairing-tutorial.html). |
| 95 | + |
| 96 | +## Note Regarding Pairing Performance |
| 97 | + |
| 98 | +The included java pairings are not optimized for performance. |
| 99 | +We recommend you use our [Mcl wrapper library](https://github.com/cryptimeleon/mclwrap) if you care about pairing performance. |
| 100 | +It includes an optimized type 3 pairing. |
| 101 | + |
| 102 | +## Miscellaneous Information |
| 103 | + |
| 104 | +- Official Documentation can be found [here](https://cryptimeleon.github.io/). |
| 105 | + - The *For Contributors* area includes information on how to contribute. |
| 106 | +- Math adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 107 | +- The changelog can be found [here](CHANGELOG.md). |
| 108 | +- Math is licensed under Apache License 2.0, see [LICENSE file](LICENSE). |
| 109 | + |
| 110 | +## Authors |
| 111 | +The library was implemented at Paderborn University in the research group ["Codes und Cryptography"](https://cs.uni-paderborn.de/en/cuk/). |
0 commit comments