hyperledger-archives / aries-framework-go

Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
https://wiki.hyperledger.org/display/ARIES/aries-framework-go
Apache License 2.0
239 stars 160 forks source link

Proposal: use dependency for EC operations indirectly through mathlib #3575

Open ale-linux opened 1 year ago

ale-linux commented 1 year ago

This proposal recommends changing the dependency used to handle the operations on elliptic curves needed by the BBS+ implementation.

Currently, an implementation from kilic is directly used. We recommend switching to mathlib: mathlib is a module that exposes a common set of API backed by a number of different libraries (amcl, ConsenSys/gnark-crypto and kilic). It currently supports the following curves: FP256BN, BN254, BLS12_377 and BLS12_381 (the latter in two different variants, standard and BBS compliant). mathlib is already being used by fabric, the idemix implementation used by fabric, the fabric token sdk and the fabric smart client.

The reasons that motivate this switch are:

var curve = ml.Curves[ml.BLS12_381_BBS]

which uses the customised, BBS+ compliant implementation of bls12-381 (which used to be here and is now implemented by mathlib) with

var curve = ml.Curves[ml.BLS12_381_BBS_GURVY]

which uses the version of bls12-381 backed by gnark-crypto with the necessary customisations to make it BBS+ compliant. The rest of the code wouldn't have to change

This proposal is supported by @ale-linux and @adecaro.

We would kindly ask @sudeshrshetty to please have a look - we're happy to discuss the proposal in-depth with the community.

sudeshrshetty commented 1 year ago

@ale-linux I appreciate the thorough details provided, and the proposal looks good to me.