-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8343232: PKCS#12 KeyStore support for RFC 9879: Use of Password-Based Message Authentication Code 1 (PBMAC1) #24429
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 mpowers! A progress list of the required criteria for merging this PR into |
|
@mcpowers 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 27 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 |
|
@mcpowers This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply issue a |
|
/keepalive |
|
@mcpowers The pull request is being re-evaluated and the inactivity timeout has been reset. |
src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/sun/security/util/PBKDF2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/sun/security/util/PBKDF2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/sun/security/util/PBKDF2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/sun/security/util/PBKDF2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/sun/security/util/PBKDF2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/javax/crypto/spec/PBMAC1ParameterSpec.java
Outdated
Show resolved
Hide resolved
wangweij
left a comment
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.
Some comments.
src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
Outdated
Show resolved
Hide resolved
wangweij
left a comment
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.
Everything looks fine.
|
|
||
| DerOutputStream out = new DerOutputStream(); | ||
| DerOutputStream tmp0 = new DerOutputStream(); | ||
| DerOutputStream tmp1 = new DerOutputStream(); |
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.
unused variable.
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.
fixed
| /* | ||
| * Encode PBKDF2 parameters from components. | ||
| */ | ||
| public static byte[] encode(byte[] salt, int iterationCount, |
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.
This method actually encodes more than the parameters. It also encodes the outer algorithm id. I guess that's ok, but I suggest adding a comment that says that.
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.
added
| /* | ||
| * Encode PBMAC1 parameters from components. | ||
| */ | ||
| static byte[] encode(byte[] salt, int iterationCount, int keyLength, |
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.
This is encoding more than the PBMAC1 parameters, it is also encoding the MacData structure. That should really be in the MacData class.
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.
I moved it to the MacData class as you suggest. macSalt ("NOT USED") and iterations (1) also belong in MacData and have been moved.
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.
The latest encode returns two algorithm identifiers concatenated together without any frame. I suggest we follow the PBKDF2Parameters.java style you described below ("The outer algorithm ID is also encoded in addition to the parameters"), which means moving the code around tmp2 and tmp3 from MacData::encode here simply call tmp1.writeBytes(PBMAC1Parameters.encode(...)) in MacData::encode.
Or, if you prefer to encode the PBMAC1 OID outside (which follows most AlgorithmParametersSpi classes), put the concatenation inside a SEQUENCE and return it. This is similar to #24429 (comment).
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.
I choose the latter.
seanjmullan
left a comment
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.
Looks good!
| // id-PBMAC1 OBJECT IDENTIFIER ::= { pkcs-5 14 } | ||
| tmp2.putOID(ObjectIdentifier.of(KnownOIDs.PBMAC1)); | ||
| tmp2.write(DerValue.tag_Sequence, tmp3); | ||
| tmp2.write(tmp3); |
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.
Since there is only one raw byte array in tmp3, the following lines
DerOutputStream tmp3 = new DerOutputStream();
tmp3.writeBytes(PBMAC1Parameters.encode(macSalt, iterations, keyLength, kdfHmac, hmac));
tmp2.write(tmp3);
is equivalent to
tmp2.writeBytes(PBMAC1Parameters.encode(macSalt, iterations, keyLength, kdfHmac, hmac));
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.
fixed
|
/integrate |
|
Going to push as commit 1781b18.
Your commit was automatically rebased without conflicts. |
JDK-8343232
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24429/head:pull/24429$ git checkout pull/24429Update a local copy of the PR:
$ git checkout pull/24429$ git pull https://git.openjdk.org/jdk.git pull/24429/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24429View PR using the GUI difftool:
$ git pr show -t 24429Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24429.diff
Using Webrev
Link to Webrev Comment