Skip to content

Add fix for NPE on encrypt/decrypt#170

Merged
coltfred merged 3 commits into
mainfrom
fix-null-on-update
Jul 2, 2026
Merged

Add fix for NPE on encrypt/decrypt#170
coltfred merged 3 commits into
mainfrom
fix-null-on-update

Conversation

@coltfred

@coltfred coltfred commented Jul 1, 2026

Copy link
Copy Markdown
Member

Fixes #167

There are a couple cases where the cipher.update can return null. One is if the payload is too short for a block and another is to support GCM tag verification in the context of FIPS.

The comment says:

the new buffer with the result, or null if this cipher is a block cipher and the input data is too short to result in a new block.

So either way we should guard against it. I wrote a custom provider to use in the test that buffers everything internally just to show that it works if update returns null. Messing with FIPS for testing was something I didn't want to take on.

@coltfred coltfred merged commit b5ed6d8 into main Jul 2, 2026
7 checks passed
@coltfred coltfred deleted the fix-null-on-update branch July 2, 2026 15:14
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.

NullPointerException from CryptoUtils

3 participants