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

Weijun Wang weijun at openjdk.org
Tue May 13 22:32:16 UTC 2025


On Tue, 13 May 2025 19:46:27 GMT, Sean Mullan <mullan 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/java/security/PEMDecoder.java line 464:
> 
>> 462:      *
>> 463:      * <p>If {@code provider} is {@code null}, a new instance is returned with
>> 464:      * the default provider configuration.
> 
> IMHO, I think this is working around a bug in the calling code and an NPE should be thrown instead.

Yes, it's not worth calling `withFactory(null)` to remove preferred provider configuration. We already have `PEMDecoder.of()`.

> src/java.base/share/classes/java/security/PEMEncoder.java line 62:
> 
>> 60:  * configured to encrypt the key with that password. Alternatively, a
>> 61:  * private key encrypted as an {@code EncryptedKeyInfo} object can be encoded
>> 62:  * directly to PEM by passing it to the encode method
> 
> s/encode method/`encode` or `encodeToString` methods./

Add a period at the end. Do we need to say `of a normal PEMEncoder` since encryption is done elsewhere.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2087720438
PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2087698926


More information about the security-dev mailing list