Skip to content

Add key commitment to prevent invisible salamanders attack #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

holmesworcester
Copy link

Implements the AEaH (AE-and-Hash) transform from the 'Committing Authenticated Encryption: Generic Transforms with Hash Functions' paper to prevent the invisible salamanders attack by ensuring a ciphertext can only be decrypted to a single plaintext.

Changes:

  1. Add keyCommitment field to Cipher type
  2. Add commitment generation and verification
  3. Add tests to verify the implementation

Implements a key binding strategy that ensures a ciphertext can only be decrypted with the exact key used for encryption, preventing the invisible salamanders attack.

This implementation:
1. Derives a committed key from the original key and nonce
2. Uses the committed key for encryption/decryption operations
3. Ensures an attacker cannot create different keys that decrypt to different messages

References: https://soatok.blog/2024/09/10/invisible-salamanders-are-not-what-you-think/
and the paper 'Committing Authenticated Encryption: Generic Transforms with Hash Functions'
@holmesworcester holmesworcester force-pushed the fix/invisible-salamanders-attack branch from c420a8e to e90a674 Compare March 20, 2025 18:42
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.

1 participant