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
8279066: entries.remove(entry) is useless in PKCS12KeyStore #6910
Conversation
…12 keystore 8279066: Still see private key entries without certificates in a PKCS12 keystore
|
Hi @gerry1888, thanks for making a comment in an OpenJDK project! All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user gerry1888 for the summary. If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use. |
Webrevs
|
I still think it's useful even if I can't see the certificate chain. I'd rather see the entry if it actually exists in the keystore and I think removing it is odd because it still exists in the keystore. Also, sometimes I use keytool without a storepass just to see what is in it, and then if I see the certificates are not showing up, I can try again with the password. |
OK, I've updated the change to simply removing that |
@wangweij This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 57 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
Going to push as commit fb623f1.
Your commit was automatically rebased without conflicts. |
Mailing list message from Michael StJohns on security-dev: On 12/21/2021 1:26 PM, Sean Mullan wrote: I got curious and took a look at P11KeyStore.java - Speaking personally, I've always found it a bit annoying that a Not suggesting that a change necessarily needs to be made, but perhaps Mike |
Before password-less PKCS12 keystores are supported, certificates in a PKCS12 file are always encrypted. Therefore if one loads the keystore with a null pass, it contains
PrivateKeyEntry
s without certificates. This has always been awkward (and most likely useless) so when JDK-8076190 introduced the password-less feature I also added a line to remove such an entry.jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java
Line 2272 in a729a70
Unfortunately, the line is not coded correctly, it should have been
remove(key)
but here it'sremove(value)
.This code change correctly removes the entry.
That said, this behavior, although weird, has been there from the beginning since PKCS12 keystore was introduced. If you can find out a usage of a private key entry without any certificate and think it's worth kept that way, I can simply remove the
remove
call and leave the entry there.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6910/head:pull/6910
$ git checkout pull/6910
Update a local copy of the PR:
$ git checkout pull/6910
$ git pull https://git.openjdk.java.net/jdk pull/6910/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6910
View PR using the GUI difftool:
$ git pr show -t 6910
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6910.diff