RFR: 8305310: Calculate PublicKey from PrivateKey
Weijun Wang
weijun at openjdk.org
Fri Mar 31 12:41:16 UTC 2023
On Fri, 31 Mar 2023 11:15:19 GMT, Matthew Donovan <duke at openjdk.org> wrote:
>> This code change is for DHKEM, which requires the function
>>
>> pk(skX): The KEM public key corresponding to the KEM private key skX.
>>
>> Only implemented for EC and XDH. Might add PKCS #11 support later.
>
> src/jdk.crypto.ec/share/classes/sun/security/ec/ECPrivateKeyImpl.java line 217:
>
>> 215: return new ECPublicKeyImpl(w, ecParams);
>> 216: } catch (InvalidKeyException e) {
>> 217: throw new ProviderException("Should not happen", e);
>
> On the remote chance that this exception is thrown, the message doesn't help the user. A better message might be "Unexpected error creating public key" or even just not having a message and using the `ProviderException(Throwable)`constructor.
>
> This message is also used in XDHPrivateKeyimpl.
Good suggestion.
> test/jdk/sun/security/util/InteralPrivateKey/Correctness.java line 39:
>
>> 37: * @modules java.base/sun.security.util
>> 38: */
>> 39: public class Correctness {
>
> There's a misspelling in the directory name for this class: InteralPrivateKey vs. InternalPrivateKey
Sharp eye!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13250#discussion_r1154425496
PR Review Comment: https://git.openjdk.org/jdk/pull/13250#discussion_r1154425633
More information about the security-dev
mailing list