RFR: 8358171: Additional code coverage for PEM API

Fernando Guallini fguallini at openjdk.org
Tue Jun 3 09:52:52 UTC 2025


On Mon, 2 Jun 2025 23:54:30 GMT, Matthew Donovan <mdonovan at openjdk.org> wrote:

>> The tests included in this PR add code coverage mainly to the following classes introduced/updated by JEP 470 (PEM): PEMDecoder, PEMEncoder, Pem, EncryptedPrivateKeyInfo and the Key factories. In addition, more tests are included for RSAPSS, multithreading, _jdk.epkcs8.defaultAlgorithm_ property and some negative testing
>
> test/jdk/java/security/PEM/PEMDecoderTest.java line 376:
> 
>> 374: 
>> 375:     // Run test with a given Entry
>> 376:     static DEREncodable test(PEMData.Entry entry, boolean withFactory) {
> 
> Would it be too much output to include print statements at the beginning of the test methods?
> Something like `System.out.printf("Testing %s %s%n", entry.name, entry.provider);`?

I will add that print statement 👍

> 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))

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2123315338
PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2123309884


More information about the security-dev mailing list