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

Use readFully() to read exactly the number of bytes we expect from the Stream #28515

Merged
merged 16 commits into from
May 4, 2018

Commits on Feb 2, 2018

  1. Changes the encryption/decryption method

    Calls explicitly `doFinal()` on the byte array of plaintext and
    ciphertext, instead of making use of Cipher{Input,Output}Stream.
    
    While functionally equivelant, CipherInputStream merhod does not
    work well with BouncyCastle (FIPS) Security Provider's implementation
    of AES GCM as the byte array that is read from the `CipherInputStream`
    backed `DataInputStream` is always some bytes short (17 vs 20 for
    the case of `keystore.seed` value).
    jkakavas committed Feb 2, 2018
    Configuration menu
    Copy the full SHA
    2ea6d2a View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2018

  1. Zerofill sensitive data

    jkakavas committed Feb 4, 2018
    Configuration menu
    Copy the full SHA
    8241318 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2018

  1. Changed how data is read from the stream

    After receiving feedback from the discussion in the upstream [1],
    reverted back to using CipherInputStream. Instead of using
    `read()` and checking that the bytes read are what we expect,
    use `readFully()` which will read exactly the number of bytes
    while keep reading until the end of the stream or throw an
    `EOFException` if not all bytes can be read.
    
    This approach keeps the simplicity of using CipherInputStream while
    working as expected with both Security Providers
    
    [1] https://www.bouncycastle.org/devmailarchive/msg15559.html
    jkakavas committed Feb 8, 2018
    Configuration menu
    Copy the full SHA
    63a4fcd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4cc56cf View commit details
    Browse the repository at this point in the history
  3. Replaced * imports

    jkakavas committed Feb 8, 2018
    Configuration menu
    Copy the full SHA
    13ae59b View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2018

  1. Configuration menu
    Copy the full SHA
    248c73d View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2018

  1. Configuration menu
    Copy the full SHA
    a31ab4f View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2018

  1. Addresses feedback

    Adds test that ensures readFully() does not read garbage after the
    encrypted data.
    jkakavas committed Mar 14, 2018
    Configuration menu
    Copy the full SHA
    e3d79a5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f3274bb View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2018

  1. Configuration menu
    Copy the full SHA
    0526e03 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f93e9bf View commit details
    Browse the repository at this point in the history
  3. Remove irrelevant test

    jkakavas committed Apr 16, 2018
    Configuration menu
    Copy the full SHA
    460ee62 View commit details
    Browse the repository at this point in the history
  4. Adds test for trailing garbage

    Ensures we fail if for some reason readFully can't consume the
    entire stream (for instance if stream contains trailing garbage)
    jkakavas committed Apr 16, 2018
    Configuration menu
    Copy the full SHA
    e853a6a View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2018

  1. Addresses feedback

    Adds aditional explicit check for full stream consumption
    Adds tests
    jkakavas committed Apr 17, 2018
    Configuration menu
    Copy the full SHA
    3c56cfd View commit details
    Browse the repository at this point in the history

Commits on May 3, 2018

  1. Configuration menu
    Copy the full SHA
    1539793 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b90e9b View commit details
    Browse the repository at this point in the history