RFR: 8297878: KEM: Implementation [v10]

Weijun Wang weijun at openjdk.org
Wed Apr 26 20:55:57 UTC 2023


On Wed, 26 Apr 2023 20:21: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:
>> 
>>   no more pk/sk, AIOOBE to IOOBE
>
> src/java.base/share/classes/javax/crypto/KEM.java line 606:
> 
>> 604:      * @param publicKey the receiver's public key, must not be {@code null}
>> 605:      * @return the encapsulator for this key
>> 606:      * @throws InvalidKeyException if {@code publicKey} is invalid
> 
> What about throwing `NullPointerException` if `publicKey` is `null`? In this case a `RuntimeException` seems more appropriate, and throwing NPE seems more consistent with how you treat `null` parameters of other methods.

Every other crypto engine class throws IKE when initing with a null key, including `Signature`, `Cipher`, `KeyAgreement`, 'Mac`. So I follow the same style.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13256#discussion_r1178371353



More information about the security-dev mailing list