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

Support streaming API for CBC #396

Closed
fgaud opened this issue Apr 17, 2024 · 1 comment · Fixed by #410
Closed

Support streaming API for CBC #396

fgaud opened this issue Apr 17, 2024 · 1 comment · Fixed by #410
Assignees
Labels
enhancement New feature or request

Comments

@fgaud
Copy link

fgaud commented Apr 17, 2024

Problem:

I would like to be able to use CBC in a streaming fashion. Unfortunately, currently the CBC encryptor always puts padding after an encryption operation and expects padding during a decryption operation.

OpenSSL solves that problem with finalize methods (for ex. https://docs.rs/openssl/latest/openssl/envelope/struct.Open.html#method.finalize)

Solution:

There are two possible options

  • Add CBC support to EncryptingKey and DecryptingKey types, and have the caveat that the inputs must be divisible by the block size, and leave padding decisions to the caller.

  • Introduce a StreamingPaddedBlockEncryptingKey and StreamingPaddedBlockDecryptingKey that implements the streaming and padding concepts.

The later would be nicer but more work

  • Does this change any public APIs? No it add more APIs
  • Which algorithm(s) will this impact? CBC

Requirements / Acceptance Criteria:

What must a solution address in order to solve the problem? How do we know the solution is complete?

Ideally we can encrypt/decrypt in a streaming fashion.

  • RFC links: N/A
  • Related Issues: None
  • Will the Usage Guide or other documentation need to be updated? Maybe depending on the solution
  • Testing: How will this change be tested? Call out new integration tests, functional tests, or particularly
    interesting/important unit tests. Probably through unit tests

Out of scope:

Is there anything the solution will intentionally NOT address?

@justsmth
Copy link
Contributor

FYI -- this API is now available in v1.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants