Issue 623 : Make BaseFont subset prefix generation deterministic #627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a configurable SecureRandom to BaseFont class to make a possibility to generate a deterministic subset prefix.
By default the generated String is still random.
Related Issue: #623
Unit test is provided within the commit. Tested within our implementation using a FixedSecureRandom from BC, and the generated subset prefix is deterministic, as expected.
Some comments:
I do not understand a reason for the method PdfReader.shuffleSubsetNames(). To my opinion, it could be removed, as if you remove it from code, it does not brake any unit tests. Nevertheless, I left this method with the old behavior for backward compatibility.
My solution is pretty simple and straight-forward, so if you have better ideas how it could be implemented, please feel free to make the changes in my original PR.
Best regards,
Aleksandr.