RFR: 8347938: Switch to latest ML-KEM private key encoding [v2]

Mark Powers mpowers at openjdk.org
Thu May 1 13:22:47 UTC 2025


On Thu, 1 May 2025 11:55:20 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/util/KeyUtil.java line 506:
>> 
>>> 504:                 if (seed == null) return null;
>>> 505:                 skOctets = new byte[seed.length + 2];
>>> 506:                 skOctets[0] = (byte)0x80;
>> 
>> Is there any value in using the DerValue class to put a name on these constants? I think what you have is easy enough to read.
>
> You mean I can use `DerValue.TAG_CONTEXT + 0` instead of 0x80? I can, but yes it's no more readable than the number itself. It's probably all about consistency. If I use `TAG_CONTEXT` here, I might also need to use `tag_OctetString`, `tag_Sequence`.

I agree. Leave it the way you have it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24969#discussion_r2070260625


More information about the security-dev mailing list