Add BIP-374 DLEQ proof verification#107
Conversation
Implement DLEQ proof verification and generation as per BIP-374. This includes functions to verify and generate DLEQ proofs for ECDH computations without revealing private keys.
This file contains tests for BIP-374 DLEQ proof verification and generation, including various scenarios for tagged hashing, proof generation, and verification.
Added tests to verify failure conditions for DLEQ proof generation.
|
Added edge case hardening based on cryptographic review: Verification (
Generation (
Tests:
Spec Compliance Note: This implements BIP-374 DLEQ verification for BIP-375 Silent Payments use cases. The optional message parameter ( Validation:
No breaking changes to existing API signatures. |
What about extending bitcoinfuzz with DLEQ-related targets? It could be tested against the reference implementation, NBitcoin, or rust-dleq. |
|
If the nonce derivation skips the required
|
Add BIP-374 DLEQ proof verification
Description
Adds DLEQ (Discrete Log Equality) proof verification as specified in BIP-374. This complements the existing BIP-375 PSBT field support in #79 by providing the actual cryptographic verification.
What this adds
verify_dleq_proof(A, B, C, proof)- Verify a BIP-374 DLEQ proofgenerate_dleq_proof(a, B)- Generate a DLEQ proof (for testing/coordinators)tagged_hash(tag, data)- BIP-340 style tagged hashingWhy this matters
BIP-375 Silent Payments PSBTs include DLEQ proofs (
PSBT_GLOBAL_SP_DLEQ) to prove ECDH shares were computed correctly. Without verification, signing devices must trust the coordinator's math.With this, a signing device can:
Usage
Implementation notes
ec_pubkey_negate()returns a new point (doesn't modify in-place)Related
References