private void test_generateCrl(CertificateFactory cf) throws Exception {
        byte[] valid = VALID_CRL_PEM.getBytes(Charset.defaultCharset());
        CRL c = cf.generateCRL(new ByteArrayInputStream(valid));
        assertNotNull(c);

        valid = VALID_CRL_PEM_CRLF.getBytes(Charset.defaultCharset());
        CRL c2 = cf.generateCRL(new ByteArrayInputStream(valid));
        assertNotNull(c2);
        assertEquals(c, c2);

        valid = TestUtils.decodeBase64(VALID_CRL_DER_BASE64);
        c2 = cf.generateCRL(new ByteArrayInputStream(valid));
        assertNotNull(c);
        assertEquals(c, c2);

        // The RI only supports PKCS#7 with generateCRLs, not generateCRL.
        // See https://github.com/google/conscrypt/issues/987
        if (!StandardNames.IS_RI) {
            valid = TestUtils.decodeBase64(VALID_CRL_PKCS7_DER_BASE64);
            c2 = cf.generateCRL(new ByteArrayInputStream(valid));
            assertNotNull(c);
            assertEquals(c, c2);
        }

        valid = TestUtils.decodeBase64(VALID_CRL_PKCS7_DER_BASE64);
        Collection<? extends CRL> crls = cf.generateCRLs(new ByteArrayInputStream(valid));
        assertEquals(1, crls.size());
        assertEquals(c, crls.iterator().next());

        valid = VALID_CRL_PKCS7_PEM.getBytes(Charset.defaultCharset());
        crls = cf.generateCRLs(new ByteArrayInputStream(valid));
        assertEquals(1, crls.size());
        assertEquals(c, crls.iterator().next());

        try {
            byte[] invalid = INVALID_CRL_PEM.getBytes(Charset.defaultCharset());
            cf.generateCRL(new ByteArrayInputStream(invalid));
            fail();
        } catch (CRLException expected) {
        }

        try {
            c = cf.generateCRL(new ByteArrayInputStream(new byte[0]));
            // Bouncy Castle returns null on empty inputs rather than throwing an exception,
            // which technically doesn't satisfy the method contract, but we'll accept it
            assertTrue((c == null) && cf.getProvider().getName().equals("BC"));
        } catch (CRLException maybeExpected) {
            assertNotEquals("BC", cf.getProvider().getName());
        }

        try {
            c = cf.generateCRL(new ByteArrayInputStream(new byte[] { 0x00 }));
            // Bouncy Castle returns null on short inputs rather than throwing an exception,
            // which technically doesn't satisfy the method contract, but we'll accept it
            assertTrue((c == null) && cf.getProvider().getName().equals("BC"));
        } catch (CRLException maybeExpected) {
            assertNotEquals("BC", cf.getProvider().getName());
        }

    }
Generates a type 1 key identifier according to RFC 3280 4.2.1.2.
common/src/test/java/org/conscrypt/java/security/cert/CertificateFactoryTest.java