RFR: 8360564: Implement JEP 524: PEM Encodings of Cryptographic Objects (Second Preview) [v7]

Sean Mullan mullan at openjdk.org
Mon Oct 27 20:33:07 UTC 2025


On Wed, 22 Oct 2025 19:25:43 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> src/java.base/share/classes/java/security/PEMDecoder.java line 298:
>> 
>>> 296:      * @param str a String containing PEM data
>>> 297:      * @return a {@code DEREncodable}
>>> 298:      * @throws IllegalArgumentException on error in decoding or no PEM data found
>> 
>> It looks like this method will throw `EOFException` and not `IllegalArgumentException` if there is no PEM data because it calls decode with a `ByteArrayInputStream` so uses that method which throws an `EOFException`.
>> 
>> Same comment for method that takes a `Class` argument.
>
> EOFException is a child of IOException, so the catch covers this.

Ah, ok, although I think it is odd for `EOFException` (or even `IOException`) to be the cause for reading from a String or byte array.

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

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


More information about the security-dev mailing list