Package org.apache.harmony.security.provider.cert

Examples of org.apache.harmony.security.provider.cert.X509CertFactoryImpl


    /**
     * engineGenerateCertificate(InputStream inStream) method testing.
     */
    public void testEngineGenerateCertificate() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        Certificate cert;
       
        // DER encoded certificate generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCertEncoding());
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("First generated certificate is null", cert);
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("Second generated certificate is null", cert);
       
        try {
            certFactory.engineGenerateCertificate(bais);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }

        // Base64 testing
        bais = new ByteArrayInputStream(
                CertFactoryTestData.getBase64CertEncoding());
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("First generated certificate is null", cert);
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("Second generated certificate is null", cert);
       
        try {
            certFactory.engineGenerateCertificate(bais);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }
    }
View Full Code Here


   
    /**
     * engineGenerateCertificates(InputStream inStream) method testing.
     */
    public void testEngineGenerateCertificates() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
       
        // DER encoded certificate generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCertEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCertificates(bais).size());
       
        // Base64 testing
        bais = new ByteArrayInputStream(
                CertFactoryTestData.getBase64CertEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCertificates(bais).size());
    }
View Full Code Here

   
    /**
     * engineGenerateCRL(InputStream inStream) method testing.
     */
    public void testEngineGenerateCRL() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        CRL crl;
       
        // DER encoded crt generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCRLEncoding());
        crl = certFactory.engineGenerateCRL(bais);
        assertNotNull("First generated CRL is null", crl);
        crl = certFactory.engineGenerateCRL(bais);
        assertNotNull("Second generated CRL is null", crl);
       
        try {
            certFactory.engineGenerateCRL(bais);
            fail("Expected CRLException was not thrown.");
        } catch (CRLException e) {
        }

        // Base64 testing
        bais = new ByteArrayInputStream(CertFactoryTestData
                .getBase64CRLEncoding());

        crl = certFactory.engineGenerateCRL(bais);
        assertNotNull("First generated CRL is null", crl);
        crl = certFactory.engineGenerateCRL(bais);
        assertNotNull("Second generated CRL is null", crl);
       
        try {
            certFactory.engineGenerateCRL(bais);
            fail("Expected CRLException was not thrown.");
        } catch (CRLException e) {
        }
    }
View Full Code Here

   
    /**
     * engineGenerateCRLs(InputStream inStream) method testing.
     */
    public void testEngineGenerateCRLs() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
       
        // DER encoded crt generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCRLEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCRLs(bais).size());

        // Base64 testing
        bais = new ByteArrayInputStream(CertFactoryTestData
                .getBase64CRLEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCRLs(bais).size());
    }
View Full Code Here

   
    /**
     * engineGenerateCertPath(InputStream inStream) method testing.
     */
    public void testEngineGenerateCertPath() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        ByteArrayInputStream bais =
                new ByteArrayInputStream(
                        CertFactoryTestData.getCertPathPkiPathEncoding());
        certFactory.engineGenerateCertPath(bais);

        try {
            certFactory.engineGenerateCertPath(bais);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }
    }
View Full Code Here

    /**
     * engineGenerateCertPath(InputStream inStream, String encoding) method
     * testing.
     */
    public void testEngineGenerateCertPath1() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        ByteArrayInputStream bais =
                new ByteArrayInputStream(
                        CertFactoryTestData.getCertPathPKCS7Encoding());
        certFactory.engineGenerateCertPath(bais, "PKCS7");

        try {
            certFactory.engineGenerateCertPath(bais, "PKCS7");
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }
    }
View Full Code Here

        ArrayList certList = new ArrayList();
        for (int i=0; i<2; i++) {
            certList.add(certificate);
        }

        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        certFactory.engineGenerateCertPath(certList);

        certList.add(new Integer(5));
        try {
            certFactory.engineGenerateCertPath(certList);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }
    }
View Full Code Here

     * engineGetCertPathEncodings() method testing.
     */
    public void testEngineGetCertPathEncodings() {
        try {
            Iterator it =
                new X509CertFactoryImpl().engineGetCertPathEncodings();
            Object encoding  = it.next();
            assertNotNull("Default encodings should not be null", encoding);
            it.remove();
            fail("UnsupportedOperationException should be thrown");
        } catch (UnsupportedOperationException e) {
View Full Code Here

    /**
     * engineGenerateCertificate(InputStream inStream) method testing.
     */
    public void testEngineGenerateCertificate() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
        Certificate cert;
       
        // DER encoded certificate generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCertEncoding());
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("First generated certificate is null", cert);
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("Second generated certificate is null", cert);
       
        try {
            certFactory.engineGenerateCertificate(bais);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }

        // Base64 testing
        bais = new ByteArrayInputStream(
                CertFactoryTestData.getBase64CertEncoding());
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("First generated certificate is null", cert);
        cert = certFactory.engineGenerateCertificate(bais);
        assertNotNull("Second generated certificate is null", cert);
       
        try {
            certFactory.engineGenerateCertificate(bais);
            fail("Expected CertificateException was not thrown.");
        } catch (CertificateException e) {
        }
    }
View Full Code Here

   
    /**
     * engineGenerateCertificates(InputStream inStream) method testing.
     */
    public void testEngineGenerateCertificates() throws Exception {
        X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
       
        // DER encoded certificate generation testing
        ByteArrayInputStream bais =
            new ByteArrayInputStream(
                    CertFactoryTestData.getCertEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCertificates(bais).size());
       
        // Base64 testing
        bais = new ByteArrayInputStream(
                CertFactoryTestData.getBase64CertEncoding());
        assertEquals("The size of collection is not correct", 2, certFactory
                .engineGenerateCertificates(bais).size());
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.provider.cert.X509CertFactoryImpl

Copyright © 2018 www.massapicom. 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.