On Fri, 12 Sep 2025 18:33:53 GMT, Weijun Wang <[email protected]> wrote:

>> src/java.base/share/classes/sun/security/ec/ECPrivateKeyImpl.java line 255:
>> 
>>> 253:                     if (seq.data.available() != 0) {
>>> 254:                         DerValue derValue = seq.data.getDerValue();
>>> 255:                         if (derValue.isContextSpecific((byte) 1)) {
>> 
>> If any of these `if`s is false `null` is returned. Would you rather throw an 
>> IAE?
>
> I see there could be a
> 
> parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL,
> 
> Shall we skip it?

This only checks if one is available in the private key material.  If there is 
none, null is fine.

The domain parameters are kept as part of private key SEC1v2 encoding and can 
be read when generating a private key with a KeyFactory.   Translating the 
encoding could be error-prone, and maybe incompatible.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27147#discussion_r2349784363

Reply via email to