Search in sources :

Example 51 with CRL

use of java.security.cert.CRL in project j2objc by google.

the class IosCertificateFactory method engineGenerateCRLs.

@Override
public Collection<? extends CRL> engineGenerateCRLs(InputStream inStream) throws CRLException {
    List<CRL> result = new ArrayList<CRL>();
    CRL crl;
    while ((crl = engineGenerateCRL(inStream)) != null) {
        result.add(crl);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) CRL(java.security.cert.CRL)

Example 52 with CRL

use of java.security.cert.CRL in project j2objc by google.

the class CertificateFactorySpiTest method testCertificateFactorySpi02.

/**
 * Test for <code>CertificateFactorySpi</code> constructor
 * Assertion: constructs CertificateFactorySpi
 */
public void testCertificateFactorySpi02() throws CertificateException, CRLException {
    CertificateFactorySpi certFactorySpi = new MyCertificateFactorySpi();
    MyCertificateFactorySpi.putMode(true);
    ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
    DataInputStream dis = new DataInputStream(bais);
    try {
        certFactorySpi.engineGenerateCertPath(bais);
        fail("CertificateException must be thrown");
    } catch (CertificateException e) {
    }
    certFactorySpi.engineGenerateCertPath(dis);
    try {
        certFactorySpi.engineGenerateCertPath(bais, "aa");
        fail("CertificateException must be thrown");
    } catch (CertificateException e) {
    }
    try {
        certFactorySpi.engineGenerateCertPath(dis, "");
        fail("IllegalArgumentException must be thrown");
    } catch (IllegalArgumentException e) {
    }
    certFactorySpi.engineGenerateCertPath(dis, "ss");
    try {
        certFactorySpi.engineGenerateCertificate(bais);
        fail("CertificateException must be thrown");
    } catch (CertificateException e) {
    }
    try {
        certFactorySpi.engineGenerateCertificates(null);
        fail("CertificateException must be thrown");
    } catch (CertificateException e) {
    }
    Certificate cert = certFactorySpi.engineGenerateCertificate(dis);
    assertNull("Result must be null", cert);
    Collection<? extends Certificate> col = certFactorySpi.engineGenerateCertificates(dis);
    assertNull("Result must be null", col);
    try {
        certFactorySpi.engineGenerateCRL(bais);
        fail("CRLException must be thrown");
    } catch (CRLException e) {
    }
    try {
        certFactorySpi.engineGenerateCRLs(null);
        fail("CRLException must be thrown");
    } catch (CRLException e) {
    }
    CRL crl = certFactorySpi.engineGenerateCRL(dis);
    assertNull("Result must be null", crl);
    Collection<? extends CRL> colcrl = certFactorySpi.engineGenerateCRLs(dis);
    assertNull("Result must be null", colcrl);
    List<Certificate> list = null;
    try {
        certFactorySpi.engineGenerateCertPath(list);
        fail("NullPointerException must be thrown");
    } catch (NullPointerException e) {
    }
    Iterator<String> enc = certFactorySpi.engineGetCertPathEncodings();
    assertTrue("Incorrect Iterator", enc.hasNext());
}
Also used : CertificateFactorySpi(java.security.cert.CertificateFactorySpi) MyCertificateFactorySpi(org.apache.harmony.security.tests.support.cert.MyCertificateFactorySpi) CertificateException(java.security.cert.CertificateException) DataInputStream(java.io.DataInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) MyCertificateFactorySpi(org.apache.harmony.security.tests.support.cert.MyCertificateFactorySpi) CRL(java.security.cert.CRL) CRLException(java.security.cert.CRLException) Certificate(java.security.cert.Certificate)

Example 53 with CRL

use of java.security.cert.CRL in project j2objc by google.

the class CRLTest method testIsRevoked.

/**
 * Test for <code>isRevoked()</code> method
 */
public final void testIsRevoked() {
    CRL crl = new MyCRL("TEST_TYPE");
    crl.isRevoked(null);
}
Also used : CRL(java.security.cert.CRL)

Example 54 with CRL

use of java.security.cert.CRL in project j2objc by google.

the class CRLTest method testConstructor.

// 
// Tests
// 
/**
 * Test for <code>CRL(String type)</code> constructor<br>
 */
public final void testConstructor() {
    for (int i = 0; i < validValues.length; i++) {
        CRL crl = new MyCRL(validValues[i]);
        assertEquals(validValues[i], crl.getType());
    }
    for (int i = 0; i < invalidValues.length; i++) {
        CRL crl = new MyCRL(invalidValues[i]);
        assertEquals(invalidValues[i], crl.getType());
    }
    try {
        CRL crl = new MyCRL(null);
    } catch (Exception e) {
        fail("Unexpected exception for NULL parameter");
    }
}
Also used : CRL(java.security.cert.CRL)

Example 55 with CRL

use of java.security.cert.CRL in project j2objc by google.

the class CRLTest method testGetType01.

/**
 * Test #1 for <code>getType()</code> method<br>
 * Assertion: returns <code>CRL</code> type
 */
public final void testGetType01() {
    CRL crl = new MyCRL("TEST_TYPE");
    assertEquals("TEST_TYPE", crl.getType());
}
Also used : CRL(java.security.cert.CRL)

Aggregations

CRL (java.security.cert.CRL)59 CertificateException (java.security.cert.CertificateException)21 X509CRL (java.security.cert.X509CRL)21 CRLException (java.security.cert.CRLException)19 ByteArrayInputStream (java.io.ByteArrayInputStream)14 Certificate (java.security.cert.Certificate)13 File (java.io.File)9 IOException (java.io.IOException)9 X509Certificate (java.security.cert.X509Certificate)9 CertificateFactory (java.security.cert.CertificateFactory)8 ArrayList (java.util.ArrayList)8 DataInputStream (java.io.DataInputStream)6 InputStream (java.io.InputStream)6 CertificateFactorySpi (java.security.cert.CertificateFactorySpi)6 MyCertificateFactorySpi (org.apache.harmony.security.tests.support.cert.MyCertificateFactorySpi)6 FileInputStream (java.io.FileInputStream)5 X509CRLSelector (java.security.cert.X509CRLSelector)4 Collection (java.util.Collection)4 GeneralSecurityException (java.security.GeneralSecurityException)3 List (java.util.List)3