Add additional data support to timelock encryption for replay attack prevention#93
Add additional data support to timelock encryption for replay attack prevention#93alienx5499 wants to merge 2 commits intodrand:mainfrom
Conversation
|
Hey @AnomalRoil |
AnomalRoil
left a comment
There was a problem hiding this comment.
I think there is a misunderstanding. The additional data wouldn't be encrypted, only used in the commitment / key sharing, typically by being added to the hash in step 5 in Algo 1 in https://eprint.iacr.org/2023/189 when generating
This isn't adding proper support for AD as AD is typically used in cryptographic schemes, I'm afraid.
I think it requires first adding a new method in the IBE package in Kyber before adding support in tlock.
|
Hi @AnomalRoil, I'll reimplement following your feedback:
Question: You mentioned adding methods to Kyber first. Should I:
Which approach do you prefer? Thanks! |
|
hi @AnomalRoil,
Once kyber#66 merges, I'll update this tlock PR to use those new functions and remove the wrapper approach. |
|
hi @AnomalRoil, tlock now uses the new Encrypt/Decrypt…WithAD functions (commit 5ba9120). once kyber#66 merges and releases, I’ll drop the replace directive and update go.mod. this PR now matches the cryptographic approach you described. |
Summary
Implements Issue #55 by adding support for additional data in timelock encryption commitments. This allows binding encryption to specific context (e.g., transaction hash, public key) to prevent replay attacks in blockchain use cases.
Changes
Core Implementation
TimeLockWithAdditionalData: New function that encrypts data with additional contextTimeUnlockWithAdditionalData: New function that decrypts and verifies additional data[4 bytes length][additional data][original data])TimeLock/TimeUnlockfunctions unchangedFiles Modified
tlock.go: Added new functions with wrapper-based implementationADDITIONAL_DATA_STATUS.md: Implementation documentation and statusKey Features
Usage Example
Technical Notes
Testing
The implementation has been thoroughly tested with comprehensive test cases covering:
Closes #55