Package java.security.cert

Examples of java.security.cert.CertificateFactory.generateCRLs()


        // Testing the CRLs generation on the base of PKCS7 SignedData object
        ByteArrayInputStream bais = new ByteArrayInputStream(
                Base64.decode(pkcs7so.getBytes()));

        Collection crls = factory.generateCRLs(bais);
        assertNotNull("Factory returned null on correct PKCS7 data", crls);
        assertEquals("The size of collection differs from expected",
                2, crls.size());

        if (publicKey != null) {
View Full Code Here


                }
            }

            if (expected_size == error) { // exception throwing test
                try {
                    factory.generateCRLs(new ByteArrayInputStream(encoding));
                    fail("Expected exception was not thrown");
                } catch (Exception e) { }
            } else {
                Collection crls =
                    factory.generateCRLs(new ByteArrayInputStream(encoding));
View Full Code Here

                    factory.generateCRLs(new ByteArrayInputStream(encoding));
                    fail("Expected exception was not thrown");
                } catch (Exception e) { }
            } else {
                Collection crls =
                    factory.generateCRLs(new ByteArrayInputStream(encoding));
                assertNotNull("Factory returned null on correct data", crls);
                assertEquals("The size of collection differs from expected",
                        expected_size, crls.size());
                verifyCRLs(crls);
            }
View Full Code Here

       
        ByteArrayInputStream bais;
        for (int i=0; i<good.length; i++) {
            bais = new ByteArrayInputStream(
                    (good[i][0] + pkcs7so + good[i][1]).getBytes());
            Collection crls = factory.generateCRLs(bais);
            assertNotNull("Factory returned null on correct PKCS7 data", crls);
            assertEquals("The size of collection differs from expected",
                    2, crls.size());
            if (publicKey != null) {
                // verify the signatures
View Full Code Here

                fail("Expected exception was not thrown");
            } catch (Exception e) { }
            bais = new ByteArrayInputStream(
                    (good[0][0] + bad_content[i] + good[0][1]).getBytes());
            try {
                factory.generateCRLs(bais);
                fail("Expected exception was not thrown");
            } catch (Exception e) { }
        }

        for (int i=0; i<bad.length; i++) {
View Full Code Here

        for (int i=0; i<bad.length; i++) {
            bais = new ByteArrayInputStream(
                    (bad[i][0] + pkcs7so + bad[i][1]).getBytes());
            try {
                factory.generateCRLs(bais);
                fail("Expected exception was not thrown");
            } catch (Exception e) { }
            bais = new ByteArrayInputStream(
                    (bad[i][0] + pkcs7so + bad[i][1]).getBytes());
            try {
View Full Code Here

        CertificateFactory fact = CertificateFactory.getInstance("X.509");
        for (int i = 0; i < CRLCOLLECTION_URLS.length; i++) {
            URL certUrl = new URL(BASE_URL + CRLCOLLECTION_URLS[i]);
            try {
                InputStream is = certUrl.openStream();
                Collection crls = fact.generateCRLs(is);
                assertTrue("The CRLs in \"" + certUrl.toExternalForm()
                        + "\" were not parsed correctly", crls != null
                        && crls.size() > 0);
            } catch (IOException e) {
                // the certificate could not be found, skip it
View Full Code Here

        CertificateFactory cf = new myCertificateFactory(spi, defaultProvider,
                defaultType);
        assertEquals("Incorrect type", cf.getType(), defaultType);
        assertEquals("Incorrect provider", cf.getProvider(), defaultProvider);
        try {
            cf.generateCRLs(null);
            fail("CRLException must be thrown");
        } catch (CRLException e) {
        }
               
        cf = new myCertificateFactory(null, null, null);
View Full Code Here

               
        cf = new myCertificateFactory(null, null, null);
        assertNull("Incorrect type", cf.getType());
        assertNull("Incorrect provider", cf.getProvider());
        try {
            cf.generateCRLs(null);
            fail("NullPointerException must be thrown");
        } catch (NullPointerException e) {
        }
    }
   
View Full Code Here

        Collection<? extends CRL> crls = null;
        InputStream is = null;
        try {
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            is = new FileInputStream(crlFile);
            crls = cf.generateCRLs(is);
        } catch(IOException iex) {
            throw iex;
        } catch(CRLException crle) {
            throw crle;
        } catch(CertificateException ce) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.