Search in sources :

Example 1 with X509TrustManagerImpl

use of org.apache.harmony.xnet.tests.support.X509TrustManagerImpl in project robovm by robovm.

the class X509TrustManagerTest method test_checkClientTrusted_01.

public void test_checkClientTrusted_01() throws Exception {
    X509TrustManagerImpl xtm = new X509TrustManagerImpl();
    X509Certificate[] xcert = null;
    try {
        xtm.checkClientTrusted(xcert, "SSL");
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException expected) {
    }
    xcert = new X509Certificate[0];
    try {
        xtm.checkClientTrusted(xcert, "SSL");
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException expected) {
    }
    xcert = setX509Certificate();
    try {
        xtm.checkClientTrusted(xcert, null);
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException expected) {
    }
    try {
        xtm.checkClientTrusted(xcert, "");
        fail("IllegalArgumentException wasn't thrown");
    } catch (IllegalArgumentException expected) {
    }
}
Also used : X509TrustManagerImpl(org.apache.harmony.xnet.tests.support.X509TrustManagerImpl) X509Certificate(java.security.cert.X509Certificate)

Example 2 with X509TrustManagerImpl

use of org.apache.harmony.xnet.tests.support.X509TrustManagerImpl in project robovm by robovm.

the class X509TrustManagerTest method test_checkClientTrusted_02.

/**
     * javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[] chain, String authType)
     */
public void test_checkClientTrusted_02() throws Exception {
    X509TrustManagerImpl xtm = new X509TrustManagerImpl();
    X509Certificate[] xcert = setInvalid();
    try {
        xtm.checkClientTrusted(xcert, "SSL");
        fail("CertificateException wasn't thrown");
    } catch (CertificateException expected) {
    }
}
Also used : X509TrustManagerImpl(org.apache.harmony.xnet.tests.support.X509TrustManagerImpl) CertificateException(java.security.cert.CertificateException) X509Certificate(java.security.cert.X509Certificate)

Example 3 with X509TrustManagerImpl

use of org.apache.harmony.xnet.tests.support.X509TrustManagerImpl in project robovm by robovm.

the class X509TrustManagerTest method test_checkServerTrusted_02.

/**
     * javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[] chain, String authType)
     */
public void test_checkServerTrusted_02() throws Exception {
    X509TrustManagerImpl xtm = new X509TrustManagerImpl();
    X509Certificate[] xcert = setInvalid();
    try {
        xtm.checkServerTrusted(xcert, "SSL");
        fail("CertificateException wasn't thrown");
    } catch (CertificateException expected) {
    }
}
Also used : X509TrustManagerImpl(org.apache.harmony.xnet.tests.support.X509TrustManagerImpl) CertificateException(java.security.cert.CertificateException) X509Certificate(java.security.cert.X509Certificate)

Example 4 with X509TrustManagerImpl

use of org.apache.harmony.xnet.tests.support.X509TrustManagerImpl in project robovm by robovm.

the class X509TrustManagerTest method test_checkClientTrusted_03.

/**
     * javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[] chain, String authType)
     */
public void test_checkClientTrusted_03() throws Exception {
    X509TrustManagerImpl xtm = new X509TrustManagerImpl();
    X509Certificate[] xcert = setX509Certificate();
    xtm.checkClientTrusted(xcert, "SSL");
}
Also used : X509TrustManagerImpl(org.apache.harmony.xnet.tests.support.X509TrustManagerImpl) X509Certificate(java.security.cert.X509Certificate)

Example 5 with X509TrustManagerImpl

use of org.apache.harmony.xnet.tests.support.X509TrustManagerImpl in project robovm by robovm.

the class X509TrustManagerTest method test_checkServerTrusted_03.

/**
     * javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[] chain, String authType)
     */
public void test_checkServerTrusted_03() throws Exception {
    X509TrustManagerImpl xtm = new X509TrustManagerImpl();
    X509Certificate[] xcert = setX509Certificate();
    xtm.checkServerTrusted(xcert, "SSL");
}
Also used : X509TrustManagerImpl(org.apache.harmony.xnet.tests.support.X509TrustManagerImpl) X509Certificate(java.security.cert.X509Certificate)

Aggregations

X509TrustManagerImpl (org.apache.harmony.xnet.tests.support.X509TrustManagerImpl)7 X509Certificate (java.security.cert.X509Certificate)6 CertificateException (java.security.cert.CertificateException)2