Skip to content

Clean up record-chunking code, and make it apply only to aes128gcm #55

Closed

Description

@rfk

As of #52, this crate does not support encrypting or decrypting across multiple records with the legacy aesgcm encoding. However, given the way that the chunking code is currently implemented in a shared helper, this was implemented in a deliberately ham-fisted way: we allow the record-chunking code to run, then check how many records it produced, and throw an error if it produced multiple records.

Let's take the opportunity to actually clean up this code, taking advantage of that fact that we now only need to support aes128gcm. In practice I think this means something like:

  • Getting rid of the shared EceWebPush trait; a big part of its job is providing the shared record-chunking code, which no longer needs to be shared.
    • Maybe we'll want to keep it around for e.g. common error handling, but it might be simpler to just duplicate that...
  • Making a "chunk plaintext into records" iterator that's specific to the aes128gcm scheme, which takes the plaintext and the padding length and return record-sized chunks to be encrypted.
    • We don't need a "chunk ciphertext into records" equivalent because Rust's &[u8].chunks already exists.
  • Making a much simpler aesgcm encryption routine that throws an error if the plaintext+padding size exceeds the size of a single record
  • Making a much simpler aesgcm decryption routine that throws an error if the ciphertext size exceeds the size of a single record.

Activity

  1. added 10 commits that reference this issue on Mar 23, 2021
    b278f90
    00adaac
    e54b1d0
    f8002b0
    f3371b2
    796c464
    e58c0b1
    c0995bc
    0e286a9
    aaa12b1
  2. rfk commented on Mar 30, 2021

    @rfk
    ContributorAuthor

    This was fixed in #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions