RFR: 8358171: Additional code coverage for PEM API
Matthew Donovan
mdonovan at openjdk.org
Tue Jun 3 00:16:53 UTC 2025
On Mon, 2 Jun 2025 12:14:13 GMT, Fernando Guallini <fguallini 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/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?
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);`?
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?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2122345088
PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2122351612
PR Review Comment: https://git.openjdk.org/jdk/pull/25588#discussion_r2122357087
More information about the security-dev
mailing list