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

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


On Sun, 11 May 2025 19:02:55 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> Hi all,
>> 
>> I need a code review of the PEM API.  Privacy-Enhanced Mail (PEM) is a format for encoding and decoding cryptographic keys and certificates.  It will be integrated into JDK24 as a Preview Feature.  Preview features does not permanently define the API and it is subject to change in future releases until it is finalized.
>> 
>> Details about this change can be seen at [PEM API JEP](https://bugs.openjdk.org/browse/JDK-8300911).
>> 
>> Thanks
>> 
>> Tony
>
> 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/PEMRecord.java line 101:

> 99:         // including lowercase.  The onus is on the caller.
> 100:         if (type != null && (type.startsWith("-") || type.contains("BEGIN") ||
> 101:             type.contains("END") || type.endsWith("-"))) {

How about checking for `startsWith("BEGIN␣")` and `startsWith("END␣")`. Maybe some day there will be a type named "ENDPOINT" or "BACKEND NAME".

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

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


More information about the security-dev mailing list