Skip to content
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

Correct bug in BPS encryption algorithm #21

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

Correct bug in BPS encryption algorithm #21

wants to merge 1 commit into from

Conversation

johandroz
Copy link

There is a typo in the algorithm 3 (the encryption algorithm) in [1].
This has the consequence that when the plaintext length is longer than maxb (i.e. when you use the Mode of Operation described in the section 1.2 of [1]) and the plaintext length is a multiple of maxb, FPE_decrypt(FPE_encrypt(X)) != X.
You can test this case easily by changing the line 314 of mrfpe.c to n=112.
In this case, the radix s is 10 which mean maxb(s) = 56.
You can see that the plaintext obtained by decrypting the ciphertext is not equal to the original plaintext.

[1] BPS: a Format-Preserving Encryption Proposal, Eric Brier, Thomas Peyrin and Jacques Stern,
http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/bps/bps-spec.pdf

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