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

Implement Blowfish CFB, OFB and CTR modes #653

Merged
merged 7 commits into from
Nov 6, 2019
Merged

Conversation

cbeuw
Copy link
Contributor

@cbeuw cbeuw commented Oct 1, 2019

While CFB, OFB and CTR modes are available options for Blowfish Encrypt and Decrypt operations, internally only ECB and CBC modes were implemented. If a mode other than these two were chosen, it falls back to ECB mode. This results in #578, in which changing the IV has no effect with CFB mode selected, since it is actually operating with ECB mode, and the IV is not taken into account.

This PR retains the existing code for block encryption/decryption, and the modes are implemented using digitalbazaar/forge's implementations of general block cipher modes of operation. The outputs are tested against pyCryptoDome's Blowfish implementation.

This PR also updates some API tests in response to forge 0.9.1's explicit requirement of IV size.

I also made some redactions:

  • The option to format ciphertext output as base64, and to supply base64 ciphertext input are removed to bring the options in line with the rest of encryption/decryption operations. Users can use "From base64" and "To base64" operations to achieve the same thing.
  • PCBC mode was an option. I have removed it because:
    1. It's rarely used and rarely implemented
    2. It wasn't implemented to begin with
    3. Although I could implement it natively for this repo, I couldn't find any reference implementation of Blowfish-PCBC, which makes testing the correctness of my code almost impossible

@cj23153
Copy link

cj23153 commented Oct 19, 2019

you good

@n1474335 n1474335 merged commit 9872578 into gchq:master Nov 6, 2019
@n1474335
Copy link
Member

n1474335 commented Nov 6, 2019

Excellent work. Thanks very much for this contribution.

@cbeuw
Copy link
Contributor Author

cbeuw commented Nov 6, 2019

Thanks!

@cbeuw cbeuw deleted the blowfish-fix branch November 19, 2019 09:36
This pull request was closed.
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.

3 participants