Skip to content

Add fix for NPE on encrypt/decrypt#170

Open
coltfred wants to merge 2 commits into
mainfrom
fix-null-on-update
Open

Add fix for NPE on encrypt/decrypt#170
coltfred wants to merge 2 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.

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