Skip to content

Repository Modernization Plan - Phase 4A: Remove Legacy dlog Scheme and weak-bb Package#78

Open
Soumya8898 wants to merge 8 commits into
IBM:mainfrom
Soumya8898:Soumya8898/phase4/remove-weak-bb
Open

Repository Modernization Plan - Phase 4A: Remove Legacy dlog Scheme and weak-bb Package#78
Soumya8898 wants to merge 8 commits into
IBM:mainfrom
Soumya8898:Soumya8898/phase4/remove-weak-bb

Conversation

@Soumya8898

Copy link
Copy Markdown
Contributor

Remove Legacy dlog Scheme and weak-bb Package

Fixes #63

Motivation

The Idemix repository historically supported two cryptographic schemes:

  1. dlog (CL-signatures) — the original discrete-log based scheme using FP256BN/BN254 curves with a custom AMCL-based point serialization layer ("Translator")
  2. Aries (BBS+ signatures) — the modern scheme using BLS12-381, offering shorter proofs, faster verification, and better security margins

The dlog scheme had been functionally superseded by Aries for over a year. All downstream consumers (Hyperledger Fabric) have migrated to the Aries path. Keeping dlog around meant:

  • Maintaining two parallel implementations of every operation (issuance, signing, verification, revocation)
  • Carrying an unnecessary Translator abstraction layer that converted between math library types and legacy protobuf point representations
  • Preserving a weak-bb package whose only call sites were unreachable dead code
  • Confusing new contributors with two schemes that appear equivalent but aren't interchangeable

What Was Removed

weak-bb (Weak Boneh-Boyen signatures)

A standalone package implementing WbbKeyGen, WbbSign, and WbbVerify. It was designed for epoch-key generation in revocation. In practice, both the Aries and dlog RevocationAuthority.Sign() methods only supported AlgNoRevocation, which uses a dummy G2 generator as the epoch key — never calling weak-bb. The else branches that invoked WbbKeyGen were guarded by error returns making them unreachable dead code.

dlog scheme (CL-signature implementation)

The entire bccsp/schemes/dlog/ tree:

  • crypto/ — Core CL-signature operations: credential issuance, proof construction, revocation, nym signatures, plus protobuf schema (idemix.proto)
  • bridge/ — Adapter layer that mapped the generic handlers package interface to dlog-specific crypto calls
  • crypto/translator/amcl/ — Point serialization layer converting between *math.G1/*math.G2 and protobuf ECP/ECP2 types. This was the Translator interface used throughout handlers and keystore

Legacy factory and API surface

  • bccsp.New() — the factory function that wired up the dlog scheme via bridge adapters
  • NewIdemixMsp() previously created a dlog-backed MSP using the FP256BN_AMCL curve
  • idemixgen CLI supported 8 legacy curves and a --aries flag to switch between schemes
  • Legacy integration tests and pre-generated test fixtures for FP256BN/BN254 curves

What Was Added/Changed to Handle the Removal

Translator elimination

The Translator interface (G1ToProto/G1FromProto) was an indirection that the Aries path didn't need — for Gurvy-based curves, G1ToProto literally splits G1.Bytes() into two halves, and G1FromProto concatenates them back. We replaced all Translator usage with direct G1.Bytes() and curve.NewG1FromBytes() calls:

  • handlers/nym.goNymSecretKey and nymPublicKey now carry a *math.Curve instead of a Translator
  • keystore/kvsbased.go — Stores nym public keys as raw []byte instead of *amcl.ECP proto

Simplified API

  • NewAries(keyStore, curve, exportable) — no longer takes a Translator parameter
  • NewIdemixMsp() and NewIdemixMspAries() both create Aries-backed MSP instances using BLS12_381_BBS
  • idemixgen CLI is Aries-only: hardcoded to BLS12_381_BBS, no curve selection, no --aries flag

Revocation cleanup

RevocationAuthority.Sign() now validates alg == AlgNoRevocation upfront and returns the error immediately for unsupported algorithms, instead of branching into dead code paths.

Test infrastructure

  • msp/helpers_test.go and bccsp/helpers_test.go provide shared test setup functions
  • All handler and keystore tests use BLS12_381_BBS curve directly
  • Legacy test fixtures (testdata/idemix/) removed; Aries fixtures (testdata/aries/) provide full coverage

Result

The repository now has a single crypto scheme path (Aries/BBS+), no dead code, no unnecessary abstraction layers, and all 12 test packages pass cleanly.

Soumya Mohapatra added 7 commits June 7, 2026 22:53
The weak-bb (Weak Boneh-Boyen) package was only referenced in
unreachable code paths. Both aries/revocation.go and
dlog/crypto/revocation_authority.go called WbbKeyGen in an else
branch that always returned an error ('the specified revocation
algorithm is not supported'). The only supported algorithm is
AlgNoRevocation, which never uses weak-bb.

Changes:
- Delete bccsp/schemes/weak-bb/ entirely
- Remove dead else branch from aries RevocationAuthority.Sign()
- Remove dead else branch from dlog createCRI()
- Remove weak-bb test section from dlog idemix_test.go

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
Replace the dlog Translator interface (G1ToProto/G1FromProto) with
direct G1.Bytes()/curve.NewG1FromBytes() calls. The Translator was
a trivial indirection — Gurvy's G1ToProto just splits G1.Bytes()
into X and Y halves, and G1FromProto concatenates them back.

- handlers/nym.go: NymSecretKey, nymPublicKey, NymKeyDerivation,
  NymPublicKeyImporter, NymKeyImporter now use *math.Curve instead
  of idemix.Translator
- keystore/kvsbased.go: Store nym PK as raw []byte instead of
  *amcl.ECP proto; remove dlog/amcl imports

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- bccsp/bccsp.go: Delete the legacy New() factory function entirely.
  Simplify NewAries() to no longer take a Translator parameter.
- msp/idemixmsp.go: NewIdemixMsp() now uses Aries (BBS+) directly
  instead of the legacy dlog scheme. NewIdemixMspAries() unchanged.
  Remove amcl import.
- tools/idemixgen/main.go: Remove all legacy curve options, the
  --aries flag (always Aries now), the Translator interface, and
  the dlog Idemix struct usage. Aries-only with BLS12_381_BBS.
- tools/idemixgen/idemixca/idemixca.go: Delete (legacy-only).
  The Aries variant (iedmixca_aries.go) remains.

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
Delete the entire bccsp/schemes/dlog/ directory:
- bridge/ (adapter from handlers to dlog crypto)
- crypto/ (core CL-signature implementation + protobuf)
- crypto/translator/amcl/ (point serialization + proto types)

Delete legacy integration tests:
- bccsp/bccsp_test.go (tested the legacy New() factory)
- bccsp/legacy_test.go (legacy-specific test scenarios)

The only remaining crypto scheme is Aries (BBS+).

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- Add bccsp/helpers_test.go with NewDummyKeyStore() helper (was
  previously defined in the deleted bccsp_test.go)
- Update aries_test.go: remove amcl/translator import and usage,
  update NewAries() calls to new signature (no translator param)

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- nymsigner_test.go: replace amcl.Fp256bn with math.Curves, update
  NewNymSecretKey/NewNymPublicKey calls to new signatures
- signer_test.go: same pattern — remove amcl import, use BLS12_381_BBS
- user_test.go: replace Translator field with Curve field, remove amcl

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- kvsbased_test.go: use BLS12_381_BBS curve, remove Translator field,
  fix duplicate Curve field, update NewNymSecretKey call
- perf_test.go: remove amcl import, replace idemix.New with NewAries
- smartcard_test.go: use BLS12_381_BBS curve, fix NewNymPublicKey and
  NewNymSecretKey calls to new signatures
- msp/idemixmsp_test.go: replace dlog issuer key generation with
  Aries issuer for the bad-IPK test case
- idemixca_test.go: remove legacy TestIdemixCa test, remove dlog imports

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
@Soumya8898 Soumya8898 changed the title Repository Modernization Plan - Phase 4A: Repository Modernization Plan - Phase 4A: Remove Legacy dlog Scheme and weak-bb Package Jun 7, 2026
- Delete msp/audit_legacy_test.go (used legacy testdata/idemix/)
- Delete msp/idemixmsp_test.go (used legacy testdata/idemix/)
- Delete msp/testdata/idemix/ (legacy scheme fixtures)
- Add msp/helpers_test.go (setupWithTypeAndVersion, getDefaultSigner)
- Delete bccsp/smartcard_test.go (used legacy FP256BN testdata)
- Delete bccsp/testdata/ (legacy smartcard fixtures)
- Fix user_test.go: update expected Bytes() to match BLS12_381_BBS

The Aries-specific tests (idemixmsp_aries_test.go, audit_aries_test.go,
schemes/aries/smartcard_test.go) provide full coverage of these paths.

Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
@Soumya8898 Soumya8898 force-pushed the Soumya8898/phase4/remove-weak-bb branch from 2becba5 to fc80bf5 Compare June 7, 2026 18:04
@Soumya8898

Copy link
Copy Markdown
Contributor Author

@adecaro as you already raised a PR after adding the modernization, I will check like what other things that can be added in our modernization plan, so for the next subphase for this phase 4, I am not keeping that. Will ensure to add those in next phases.

Already added in the description like whole plan for this sub-phase of phase 4, but if any changes that I can add here please let me know.

Thanks🙏

@adecaro

adecaro commented Jun 30, 2026

Copy link
Copy Markdown
Member

Hi @Soumya8898 , we need to pause removing these schemes because we might still need unfortunately for retro compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Idemix Repository Modernization Plan

2 participants