-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8286907: keytool should warn about weak PBE algorithms #12056
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
Conversation
👋 Welcome back hchao! A progress list of the required criteria for merging this PR into |
@haimaychao The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
@@ -1837,6 +1837,15 @@ private void doGenSecretKey(String alias, String keyAlgName, | |||
useDefaultPBEAlgorithm = false; | |||
} | |||
|
|||
String[] weakAlgs = new String[] {"DES", "DESEDE", "MD5", "SHA1", "RC2", "RC4"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding the weak algorithms here, the security property jdk.security.legacyAlgorithms
should probably be used. We can decompose the PBE algorithm name to parts and make the comparison. For example, "PBEWithSHA1AndDESede" should only match "DESede" but not "DES".
@haimaychao This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. 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 316 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. ➡️ To integrate this PR with the above commit message to the |
I tried using Also, since this check only looks at |
Yes, the issue for |
I said "one solution is to add RC2_40 and RC2_128" but now I'm not sure if it's the right solution. We can always resolve this in a separate issue, but I think we'd better have an agreement on whether the current decomposer implementation is correct about "RC2" not covering "RC2_40". If yes and one day we decide to disable AES, then we should disable all of AES_128, AES_192 and AES_256 since there are algorithm names like AES_192/OFB/NoPadding and PBEWithHmacSHA384AndAES_128. This does not sound very right to me. Valerie is adding PBES2Core$HmacSHA512_224AndAES_256 in another PR now. In that case, SHA512 should not cover HmacSHA512_224 (although we are not likely to disable HmacSHA512 before disabling HmacSHA512_224 first). So this is a little complicated. |
Yeah, this is a little tricky. My feeling is that if you disable an algorithm like "RC2", it should cover all uses of it no matter what the keysize. If you only want to disable certain keysizes, then you should add a Hmac is another good corner case. It would be nice if we could have exceptions, like "SHA512", "!HmacSHA512". But that's a little more involved, and requires some more thought as to whether that is a good idea. |
@wangweij @seanjmullan For the scenario, i.e. PBEWithSHA1AndRC2_40 after SHA1 removal, we probably could |
Anyway, we can resolve the RC2_40 and AES_128 issues in another fix. The current code change looks fine for this bug. |
@seanjmullan @wangweij Thanks for the review. |
/integrate |
Going to push as commit b00b70c.
Your commit was automatically rebased without conflicts. |
@haimaychao Pushed as commit b00b70c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review the fix to address the problem in keytool -genseckey and -importpass.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12056/head:pull/12056
$ git checkout pull/12056
Update a local copy of the PR:
$ git checkout pull/12056
$ git pull https://git.openjdk.org/jdk pull/12056/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12056
View PR using the GUI difftool:
$ git pr show -t 12056
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12056.diff