Search in sources :

Example 61 with CertPath

use of java.security.cert.CertPath in project robovm by robovm.

the class CertPathTest method testHashCode.

/**
     * Test for <code>hashCode()</code> method<br>
     * Assertion: returns hash of the <code>Certificate</code> instance
     */
public final void testHashCode() {
    CertPath cp1 = new MyCertPath(testEncoding);
    CertPath cp2 = new MyCertPath(testEncoding);
    CertPath cp3 = new MyCertPath(testEncoding1);
    assertTrue(cp1.hashCode() == cp2.hashCode());
    assertTrue(cp1.hashCode() != cp3.hashCode());
}
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 62 with CertPath

use of java.security.cert.CertPath in project robovm by robovm.

the class CertPathTest method testCertPath.

//
// Tests
//
/**
     * Test for <code>CertPath(String type)</code> method<br>
     * Assertion: returns hash of the <code>Certificate</code> instance
     */
public final void testCertPath() {
    try {
        CertPath cp1 = new MyCertPath(testEncoding);
        assertEquals("MyEncoding", cp1.getType());
        assertTrue(Arrays.equals(testEncoding, cp1.getEncoded()));
    } catch (CertificateEncodingException e) {
        fail("Unexpected CertificateEncodingException " + e.getMessage());
    }
    try {
        CertPath cp1 = new MyCertPath(null);
    } catch (Exception e) {
        fail("Unexpected exception " + e.getMessage());
    }
}
Also used : MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertificateEncodingException(java.security.cert.CertificateEncodingException) MyCertPath(org.apache.harmony.security.tests.support.cert.MyCertPath) CertPath(java.security.cert.CertPath) MyFailingCertPath(org.apache.harmony.security.tests.support.cert.MyFailingCertPath) ObjectStreamException(java.io.ObjectStreamException) CertificateEncodingException(java.security.cert.CertificateEncodingException)

Example 63 with CertPath

use of java.security.cert.CertPath in project robovm by robovm.

the class CertPathTest method testEqualsObject04.

/**
     * Test for <code>equals(Object)</code> method<br>
     * Assertion: object not equals to other which is not
     * instance of <code>CertPath</code>
     */
public final void testEqualsObject04() {
    CertPath cp1 = new MyCertPath(testEncoding);
    assertFalse(cp1.equals("MyEncoding"));
}
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 64 with CertPath

use of java.security.cert.CertPath in project robovm by robovm.

the class CertPathTest method testGetEncodedString.

/**
     * This test just calls <code>getEncoded(String)</code> method<br>
     *
     * @throws CertificateEncodingException
     */
public final void testGetEncodedString() throws CertificateEncodingException {
    CertPath cp1 = new MyCertPath(testEncoding);
    cp1.getEncoded("MyEncoding");
}
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 65 with CertPath

use of java.security.cert.CertPath in project robovm by robovm.

the class CertPathTest method testGetCertificates.

//
// the following tests just call methods
// that are abstract in <code>CertPath</code>
// (So they just like signature tests)
//
/**
     * This test just calls <code>getCertificates()</code> method<br>
     */
public final void testGetCertificates() {
    CertPath cp1 = new MyCertPath(testEncoding);
    cp1.getCertificates();
}
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

CertPath (java.security.cert.CertPath)86 X509Certificate (java.security.cert.X509Certificate)36 CertificateFactory (java.security.cert.CertificateFactory)29 Certificate (java.security.cert.Certificate)19 CertPathValidator (java.security.cert.CertPathValidator)18 CertPathValidatorException (java.security.cert.CertPathValidatorException)18 MyCertPath (org.apache.harmony.security.tests.support.cert.MyCertPath)17 CertificateException (java.security.cert.CertificateException)15 ArrayList (java.util.ArrayList)15 PKIXParameters (java.security.cert.PKIXParameters)14 MyFailingCertPath (org.apache.harmony.security.tests.support.cert.MyFailingCertPath)14 TrustAnchor (java.security.cert.TrustAnchor)12 HashSet (java.util.HashSet)12 ByteArrayInputStream (java.io.ByteArrayInputStream)11 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)11 CertPathBuilderResult (java.security.cert.CertPathBuilderResult)11 PKIXBuilderParameters (java.security.cert.PKIXBuilderParameters)10 PKIXCertPathValidatorResult (java.security.cert.PKIXCertPathValidatorResult)10 X509CertSelector (java.security.cert.X509CertSelector)10 CertPathBuilder (java.security.cert.CertPathBuilder)9