RFR: 8325448: Hybrid Public Key Encryption [v10]

Weijun Wang weijun at openjdk.org
Thu Mar 13 20:06:56 UTC 2025


On Thu, 13 Mar 2025 18:37:49 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   switch to Asserts.assertThrows in test; use traditional javadoc style
>
> src/java.base/share/classes/javax/crypto/spec/HPKEParameterSpec.java line 195:
> 
>> 193:      * <a href="https://www.rfc-editor.org/rfc/rfc9180.html#name-key-encapsulation-mechanism">Section 7.1 of RFC 9180</a>.
>> 194:      */
>> 195:     public static final int KEM_DHKEM_P_256_HKDF_SHA256 = 0x10;
> 
> Do we really need `KEM_` at the beginning? Seems redundant since `DHKEM` has "KEM" in it. Same comment for the KDF constants.

I was hoping that IDE auto-completion would eliminate the need to type the full name. Adding `KEM` at the beginning could amend the type-unsafety of current algorithm identifiers -- it somehow prevents putting a KDF id as the first argument of an `of` call accidentally. Maybe that is just my wishful thinking?

Also, there will be KEM names like "X_WING" in the future.

I've also thought about defining `enum`s for the three types of algorithm identifiers to finally solve the type-unsafety issue. However, I hesitate to add them since it's such a think layer and users who need it can easily create their own.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18411#discussion_r1994231141


More information about the security-dev mailing list