Fix passwordless pkcs12 files for Java #307
Merged
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.
In #296 user discovered that Java's keytool was unable to read PKCS#12 files generated by trust-manager which had no password set. We've not dug into why, but presumably keytool's implementation treats an empty password the same as a missing password somehow.
This wasn't caught in tests because our PKCS#12 library can parse the resulting files just fine.
By changing to use the "passwordless" encoder when no password is present, we can create files which both our tests and keytool can read. It's possible that some other tools can't handle the passwordless encoder and could break, but Java is (anecdotally) what we'd expect to be the largest consumer of PKCS#12 trust stores, so we'll optimise for that.
No test is provided here because keytool requires a JRE and it feels like too much to add a JRE to our test environment just for this. Instead, I've attached fixed-pkcs12.zip which contains examples of fixed PKCS#12 files created using this branch. The password for the password-protected example is
abc123
Closes #296