-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8266293: Key protection using PBEWithMD5AndDES fails with "java.security.InvalidAlgorithmParameterException: Salt must be 8 bytes long" #3822
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
…ity.InvalidAlgorithmParameterException: Salt must be 8 bytes long" only in patch2: unchanged:
|
👋 Welcome back weijun! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
I will take a look. Thanks. |
|
|
||
| byte[] salt = getSalt(); | ||
| if (KnownOIDs.findMatch(algorithm) == KnownOIDs.PBEWithMD5AndDES) { | ||
| // PBEWithMD5AndDES requires a 8-byte salt |
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.
nit: maybe use "PBES1 scheme such as PBEWithMD5AndDES requires a 8-byte salt"
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.
Sure. Updated.
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.
Changes look good.
|
@wangweij 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 98 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 |
|
/integrate |
|
@wangweij Since your change was applied there have been 98 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 04f7112. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
PKCS12KeyStorealways uses a 20-byte salt in encryption but PBEWithMD5AndDES only accepts 8-byte salt. With this code change, the salt used for this algorithm will be 8 bytes.RFC 2898 only requires the salt to be at least 8 bytes, but I don't intend to modify the
PBES1Core.javato accept a long salt. Otherwise, a newly generated PKCS #12 file using a long salt will not be recognized by an old JDK.Also, although
PBES1Core.javaalso take cares of another algorithm named PBEWithMD5AndDESede but it's not usable in a PKCS #12 keystore as we have not defined its Object Identifier anywhere.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3822/head:pull/3822$ git checkout pull/3822Update a local copy of the PR:
$ git checkout pull/3822$ git pull https://git.openjdk.java.net/jdk pull/3822/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3822View PR using the GUI difftool:
$ git pr show -t 3822Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3822.diff