@Test
    public void testExplicitEcParams() {
        ServiceTester.test("CertificateFactory")
            .withAlgorithm("X509")
            // Bouncy Castle allows explicit EC params in certificates, even though they're
            // barred by RFC 5480
            .skipProvider("BC")
            .run((p, algorithm) -> {
                try {
                    X509Certificate c = certificateFromPEM(p, EC_EXPLICIT_KEY_CERT);
                    c.verify(c.getPublicKey());
                    fail();
                } catch (InvalidKeyException expected) {
                    // TODO: Should we throw CertificateParsingException at parse time
                    // instead of waiting for when the user accesses the key?
                } catch (CertificateParsingException expected) {
                }
            });
    }
Confirm that explicit EC params aren't accepted in certificates.
common/src/test/java/org/conscrypt/java/security/cert/X509CertificateTest.java