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

Sean Mullan mullan at openjdk.org
Wed May 7 16:49:33 UTC 2025


On Fri, 2 May 2025 06:09:52 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 with a new target base due to a merge or a rebase. The pull request now contains 66 commits:
> 
>  - major code review comments update
>  - Merge branch 'master' into pem
>  - Merge branch 'master' into pem
>  - javadoc updates
>  - code review comments
>  - merge with master
>  - better comment and remove commented out code
>  - Merge branch 'master' into pem
>  - Merge branch 'pem-merge' into pem
>  - merge
>  - ... and 56 more: https://git.openjdk.org/jdk/compare/e2ae50d8...0c540327

src/java.base/share/classes/sun/security/util/Pem.java line 56:

> 54:     private static ObjectIdentifier PBES2OID;
> 55: 
> 56:     // Lazy initialize singleton encoder.

s/initialize/initialized/

src/java.base/share/classes/sun/security/util/Pem.java line 301:

> 299:      * @return the string
> 300:      */
> 301:     public static String pemEncoded(String type, byte[] data) {

You could refactor the common code in these two methods into a separate method and call that with the type and data.

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

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


More information about the security-dev mailing list