RFR: 8298420: PEM API: Implementation (Preview) [v17]

Anthony Scarpino ascarpino at openjdk.org
Wed May 14 08:26:00 UTC 2025


On Tue, 13 May 2025 07:37:06 GMT, Krushna948 <duke at openjdk.org> wrote:

>> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   comments on the 11th
>
> src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java line 369:
> 
>> 367:         PBEKeySpec keySpec = new PBEKeySpec(password);
>> 368:         SecretKey skey;
>> 369:         Objects.requireNonNull(key);
> 
> @throws NullPointerException if the key or password are null.
> But when password null case looks not handled?

password should not allow null.  I will fix the code.

> src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java line 451:
> 
>> 449:      * @throws RuntimeException on an encryption errors.  The cause may include
>> 450:      * IllegalBlockSizeException, BadPaddingException, or InvalidKeyException.
>> 451:      * @throws NullPointerException if the key or password are null. Also, if
> 
> @throws NullPointerException if the key or password are null.
> Here it supposed to be -  throws NullPointerException if the key or enckey are null.?

Yes, comment is wrong.

> src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java line 548:
> 
>> 546:      * @throws InvalidKeyException if an error occurs during parsing of the
>> 547:      * encrypted data or creation of the key object.
>> 548:      *
> 
> Do we need to specify the RuntimeException cases in this documentation?

The exceptions should be specified

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2088065544
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2088069516
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2088100411


More information about the security-dev mailing list