RFR: 8368841: X25519 implementation differs from the specification in RFC 7748 [v3]

Anthony Scarpino ascarpino at openjdk.org
Tue Feb 24 18:19:34 UTC 2026


On Tue, 24 Feb 2026 18:07:26 GMT, Ben Perez <bperez at openjdk.org> wrote:

>> test/jdk/sun/security/ec/xec/TestXDH.java line 369:
>> 
>>> 367:         PrivateKey privateKey = kf.generatePrivate(privateSpec);
>>> 368:         KeySpec publicSpec = new XECPublicKeySpec(paramSpec,
>>> 369:             Convert.hexStringToBigInteger(b_pub));
>> 
>> Can this be replaced with `new BigInteger(b_pub, 16)`?  If so, the Convert.java change isn't needed.
>
> That would work. It does seem like this is the only place `hexStringToBigInteger` is used though, so keeping that functionality might be confusing or unnecessary.

You may consider removing the method from `Convert.java`.  This appears to be the only caller.  That means Convert usage can be cleaned up from `@build` and `import` on this test too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29750#discussion_r2848811608



More information about the security-dev mailing list