Skip to content

Conversation

@wangweij
Copy link
Contributor

@wangweij wangweij commented Dec 9, 2024

Allow Generic as an algorithm in the KeyAgreement::generateSecret(alg) method.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8347059 to be approved

Issues

  • JDK-8189441: Define algorithm names for keys derived from KeyAgreement (Bug - P4)
  • JDK-8347059: Define algorithm names for keys derived from KeyAgreement (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22650/head:pull/22650
$ git checkout pull/22650

Update a local copy of the PR:
$ git checkout pull/22650
$ git pull https://git.openjdk.org/jdk.git pull/22650/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22650

View PR using the GUI difftool:
$ git pr show -t 22650

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22650.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 9, 2024

👋 Welcome back weijun! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 9, 2024

@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:

8189441: Define algorithm names for keys derived from KeyAgreement

Reviewed-by: mullan

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 275 new commits pushed to the master branch:

  • 8cf0735: 8348102: java/net/httpclient/HttpClientSNITest.java fails intermittently
  • a36e166: 8348241: ZGC: Unnecessarily reinitialize ZFragmentationLimit's default value
  • b720517: 8348108: Race condition in AggregatePublisher.AggregateSubscription
  • 17a408c: 8348169: Destruct values on free in Treap
  • 25bb698: 8348195: More u2 conversion warnings after JDK-8347147
  • 893d00a: 8346388: Cannot use DllMain in libawt for static builds
  • 1c7641d: 8347563: C2: clean up ModRefBarrierSetC2
  • 86a8b48: 8337458: Remove debugging code print_cpool_bytes
  • 16a1d0a: 8348135: Fix couple of problem listing entries in test/hotspot/jtreg/ProblemList-Virtual.txt
  • 16dcf15: 8348263: C2 SuperWord: TestMemorySegment.java has failing IR rules with AlignVector after JDK-8343685
  • ... and 265 more: https://git.openjdk.org/jdk/compare/07c9f7138affdf0d42ecdc30adcb854515569985...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 9, 2024
@openjdk
Copy link

openjdk bot commented Dec 9, 2024

@wangweij The following label will be automatically applied to this pull request:

  • security

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.

@openjdk openjdk bot added the security security-dev@openjdk.org label Dec 9, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 9, 2024

@wangweij
Copy link
Contributor Author

wangweij commented Dec 9, 2024

The comparison of algorithm names was inconsistent, sometimes equals and sometimes equalsIgnoreCase. This is even more suspicious in the P11KeyAgreement where both were used. My understanding is that equalsIgnoreCase should always be used because key algorithm has always been case-insensitive. Also, since the "TlsPremasterSecret" algorithm is only used internally, it is always provided with the correct case.

@mlbridge
Copy link

mlbridge bot commented Dec 19, 2024

Mailing list message from Michael StJohns on security-dev:

I ran into a few problems related to a similar approach in my own code.?
Basically, PKCS12 requires some sort of OID/Algorithm identifier to map
to/from the algorithm name.??? Anything that you allow for here ideally
needs to be supported by KeyStore there. It doesn't help that PKCS11 has
CKK_GENERIC_SECRET.? It also doesn't help that you can't get the actual
OID from the PKCS12 file in all cases.

If this is actually a master secret - maybe 1.3.112.4.30.1283 makes the
most sense?? Alternately, maybe OpenJDK can assign an OID for GENERIC_SECRET

I ended up with three "generic" secret keys:

1) A generic key - output of a key agreement - can be coerced into any
regular symmetric secret key, but can't be used to seed a KDF
2) A master key - randomly generated or output of a key agreement or KDF
- input to a KDF (TPM uses the first part of this, most crypto protocols
use the second)
3) A password - randomly generated, or the output of a KDF from a master
key.?? (The latter is used with a number symmetric key diversification
schemes)

None of these are easy to store in a key store... :-(

Later, Mike

On 12/18/2024 5:33 PM, Weijun Wang wrote:

@seanjmullan
Copy link
Member

Can you also replace the link in Key.getAlgorithm with the new section you will be adding?

@wangweij
Copy link
Contributor Author

wangweij commented Jan 3, 2025

Can you also replace the link in Key.getAlgorithm with the new section you will be adding?

OK, and maybe more. I just found SecretKeySpec and EncodedKeySpec.

@openjdk openjdk bot changed the title 8189441: Define algorithm names for keys derived from KeyAgreement 8189441: Define algorithm names for keys derived from KeyAgreement and KEM Jan 3, 2025
@wangweij
Copy link
Contributor Author

wangweij commented Jan 3, 2025

I've modified too many files and I think they should belong to https://bugs.openjdk.org/browse/JDK-8346736. We should only touch KEM and KeyAgreement here.

@seanjmullan
Copy link
Member

I've modified too many files and I think they should belong to https://bugs.openjdk.org/browse/JDK-8346736. We should only touch KEM and KeyAgreement here.

Makes sense.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jan 6, 2025
@wangweij wangweij changed the title 8189441: Define algorithm names for keys derived from KeyAgreement and KEM 8189441: Define algorithm names for keys derived from KeyAgreement Jan 6, 2025
@wangweij
Copy link
Contributor Author

wangweij commented Jan 6, 2025

I've reverted all changes not related to KeyAgreement and put them in #22929, including the KEM one, since it involves no behavior change and is pure clarification. I've also removed the "KEM" word from the bug title.

Copy link
Member

@seanjmullan seanjmullan left a comment

Choose a reason for hiding this comment

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

A few more minor comments.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Jan 23, 2025
@wangweij
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 27, 2025

Going to push as commit aba60a9.
Since your change was applied there have been 336 commits pushed to the master branch:

  • 03106eb: 8344119: CUPSPrinter does not respect PostScript printer definition specification in case of reading ImageableArea values from PPD files
  • ad01dfb: 8346920: Serial: Support allocation in old generation when heap is almost full
  • 1d8ccb8: 8342465: Improve API documentation for java.lang.classfile
  • 7d6055a: 8348429: Update cross-compilation devkits to Fedora 41/gcc 13.2
  • f1e0797: 8348586: Optionally silence make warnings about non-control variables
  • ffeb9b5: 8342807: Update links in java.base to use https://
  • afcc2b0: 8348562: ZGC: segmentation fault due to missing node type check in barrier elision analysis
  • 175e58b: 8332980: [IR Framework] Add option to measure IR rule processing time
  • b8c68c0: 8348207: Linux PPC64 PCH build broken after JDK-8347909
  • 70eec90: 8338303: Linux ppc64le with toolchain clang - detection failure in early JVM startup
  • ... and 326 more: https://git.openjdk.org/jdk/compare/07c9f7138affdf0d42ecdc30adcb854515569985...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 27, 2025
@openjdk openjdk bot closed this Jan 27, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 27, 2025
@openjdk
Copy link

openjdk bot commented Jan 27, 2025

@wangweij Pushed as commit aba60a9.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@wangweij wangweij deleted the 8189441 branch January 27, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated security security-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants