Search in sources :

Example 6 with MyCertPath

use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.

the class invalidParams method testCertPathValidator11.

/**
     * Test for <code>validate(CertPath certpath, CertPathParameters params)</code> method
     * Assertion: throws InvalidAlgorithmParameterException params is not
     * instance of PKIXParameters or null
     */
public void testCertPathValidator11() throws NoSuchAlgorithmException, NoSuchProviderException, CertPathValidatorException {
    if (!PKIXSupport) {
        fail(NotSupportMsg);
        return;
    }
    CertPathValidator[] certPV = createCPVs();
    assertNotNull("CertPathValidator objects were not created", certPV);
    MyCertPath mCP = new MyCertPath(new byte[0]);
    invalidParams mPar = new invalidParams();
    for (int i = 0; i < certPV.length; i++) {
        try {
            certPV[i].validate(mCP, mPar);
            fail("InvalidAlgorithmParameterException must be thrown");
        } catch (InvalidAlgorithmParameterException e) {
        }
        try {
            certPV[i].validate(mCP, null);
            fail("InvalidAlgorithmParameterException must be thrown");
        } catch (InvalidAlgorithmParameterException e) {
        }
    }
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertPathValidator(java.security.cert.CertPathValidator) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException)

Example 7 with MyCertPath

use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.

the class CertPathTest method testGetEncodings.

/**
     * This test just calls <code>getEncodings()</code> method<br>
     */
public final void testGetEncodings() {
    CertPath cp1 = new MyCertPath(testEncoding);
    cp1.getEncodings();
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertPath(java.security.cert.CertPath) MyFailingCertPath(org.apache.harmony.security.tests.support.cert.MyFailingCertPath)

Example 8 with MyCertPath

use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.

the class CertPathTest method testHashCodeEqualsObject.

/**
     * Test for <code>hashCode()</code> method<br>
     * Assertion: hash code of equal objects should be the same
     */
public final void testHashCodeEqualsObject() {
    CertPath cp1 = new MyCertPath(testEncoding);
    CertPath cp2 = new MyCertPath(testEncoding);
    assertTrue((cp1.hashCode() == cp2.hashCode()) && cp1.equals(cp2));
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertPath(java.security.cert.CertPath) MyFailingCertPath(org.apache.harmony.security.tests.support.cert.MyFailingCertPath)

Example 9 with MyCertPath

use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.

the class CertPathTest method testWriteReplace.

/**
     * This test just calls <code>writeReplace()</code> method<br>
     */
public final void testWriteReplace() {
    try {
        MyCertPath cp1 = new MyCertPath(testEncoding);
        Object obj = cp1.writeReplace();
        assertTrue(obj.toString().contains("java.security.cert.CertPath$CertPathRep"));
    } catch (ObjectStreamException e) {
        fail("Unexpected ObjectStreamException " + e.getMessage());
    }
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) ObjectStreamException(java.io.ObjectStreamException)

Example 10 with MyCertPath

use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.

the class CertPathTest method testEqualsObject02.

/**
     * Test for <code>equals(Object)</code> method<br>
     * Assertion: object equals to other <code>CertPath</code>
     * instance with the same state
     */
public final void testEqualsObject02() {
    CertPath cp1 = new MyCertPath(testEncoding);
    CertPath cp2 = new MyCertPath(testEncoding);
    assertTrue(cp1.equals(cp2) && cp2.equals(cp1));
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertPath(java.security.cert.CertPath) MyFailingCertPath(org.apache.harmony.security.tests.support.cert.MyFailingCertPath)

Aggregations

MyCertPath (org.apache.harmony.security.tests.support.cert.MyCertPath)27 CertPath (java.security.cert.CertPath)13 MyFailingCertPath (org.apache.harmony.security.tests.support.cert.MyFailingCertPath)12 PKIXCertPathBuilderResult (java.security.cert.PKIXCertPathBuilderResult)7 TrustAnchor (java.security.cert.TrustAnchor)6 ObjectStreamException (java.io.ObjectStreamException)4 CertPathBuilderResult (java.security.cert.CertPathBuilderResult)4 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)3 CertPathValidator (java.security.cert.CertPathValidator)3 CertPathParameters (java.security.cert.CertPathParameters)2 PKIXParameters (java.security.cert.PKIXParameters)2 MyCertPathRep (org.apache.harmony.security.tests.support.cert.MyCertPath.MyCertPathRep)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 Timestamp (java.security.Timestamp)1 CertPathValidatorException (java.security.cert.CertPathValidatorException)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1 CertificateException (java.security.cert.CertificateException)1 CertificateFactory (java.security.cert.CertificateFactory)1