RFR: 8358171: Additional code coverage for PEM API

Matthew Donovan mdonovan at openjdk.org
Tue Jun 3 11:43:52 UTC 2025


On Tue, 3 Jun 2025 09:43:38 GMT, Fernando Guallini <fguallini at openjdk.org> wrote:

>> test/jdk/java/security/PEM/PEMData.java line 49:
>> 
>>> 47:         +OO4oO0VNduC44gUN1nrk7/wdNSpL+xXNEX52Dsff+2RD/fop224ANvB
>>> 48:         -----END PRIVATE KEY-----
>>> 49:         """, KeyPair.class, "SunEC");
>> 
>> When possible, we've been replacing hard-coded provider names with the system property, such as `System.getProperty("test.provider.name", "SunEC")`. 
>> 
>> Is that appropriate for these tests?
>
> I think that may not applicable for these tests, as there are multiple providers in this file to support all of the PEM decodings. It would need something like:"test.provider.1.name", "test.provider.2.name" and so on, it may be too confusing.

Yeah that wouldn't be good.

>> test/jdk/sun/security/pkcs/pkcs8/PKCS8Test.java line 34:
>> 
>>> 32:  *          java.base/sun.security.x509
>>> 33:  * @run main PKCS8Test
>>> 34:  * @run main/othervm -Dtest.provider.name=SunJCE PKCS8Test
>> 
>> I'm curious why you're specifying the provider name this way instead of using the `System.getProperty("test.provider.name", "SunJCE")` pattern?
>
> That is because this test is covering the scenarios with and without passing a provider ([line 80](https://github.com/openjdk/jdk/blob/6f18e8b29750bbb1281b35a0c0a66873ae5c61f8/test/jdk/sun/security/pkcs/pkcs8/PKCS8Test.java#L80))

Ah, I see that now. Thanks

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2123554558
PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2123555016


More information about the security-dev mailing list