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

Fix passwordless pkcs12 files for Java #307

Merged
merged 1 commit into from Feb 26, 2024

Conversation

SgtCoDFish
Copy link
Member

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

A 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.

Signed-off-by: Ashley Davis <ashley.davis@venafi.com>
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 26, 2024
Copy link
Contributor

@erikgb erikgb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2024
@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erikgb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot jetstack-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2024
@jetstack-bot jetstack-bot merged commit 133e58c into cert-manager:main Feb 26, 2024
4 checks passed
@SgtCoDFish SgtCoDFish deleted the fix-passwordless-pkcs12 branch February 26, 2024 15:05
@SgtCoDFish
Copy link
Member Author

Thanks for the fast review Erik ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundle generating empty truststore.p12 when no password is provided
3 participants