/** * Constructor for a {@link X509ExtendedTrustManager} that will trust any certificates that are currently valid. */ public ValidityCheckingX509ExtendedTrustManager() { this(new BlindTrustX509ExtendedTrustManager()); }
/** * {@inheritDoc} */ @Override public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { validateAuthType(authType); validateChain(chain); }
@Test(expected = IllegalArgumentException.class) public void checkClientTrusted1_nullNonNull() throws Exception { instance.checkClientTrusted(null, "RSA", new Socket()); }
@Test(expected = IllegalArgumentException.class) public void checkServerTrusted1_nullNonNull() throws Exception { instance.checkServerTrusted(null, "RSA", new Socket()); }
@Test public void getAcceptedIssuers() throws Exception { assertThat(instance.getAcceptedIssuers(), notNullValue()); }
@Test(expected = IllegalArgumentException.class) public void checkClientTrusted_nullNonNull() throws Exception { instance.checkClientTrusted(null, "RSA"); }
@Test(expected = IllegalArgumentException.class) public void checkServerTrusted2_nullNonNull() throws Exception { instance.checkServerTrusted(null, "RSA", (SSLEngine)null); }
/** * {@inheritDoc} */ @Override public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { validateAuthType(authType); validateChain(chain); }
@Test(expected = IllegalArgumentException.class) public void checkClientTrusted2_nullNonNull() throws Exception { instance.checkClientTrusted(null, "RSA", (SSLEngine)null); }
@Test(expected = IllegalArgumentException.class) public void checkServerTrusted_nullNonNull() throws Exception { instance.checkServerTrusted(null, "RSA"); }
new TrustManager[]{new BlindTrustX509ExtendedTrustManager()}, null);
/** * {@inheritDoc} */ @Override public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { validateAuthType(authType); validateChain(chain); }
@Test public void checkClientTrusted1() throws Exception { instance.checkClientTrusted(new X509Certificate[]{cert.certificate()}, "RSA", new Socket()); }
@Test public void checkServerTrusted1() throws Exception { instance.checkServerTrusted(new X509Certificate[]{cert.certificate()}, "RSA", new Socket()); }
/** * {@inheritDoc} */ @Override public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { validateAuthType(authType); validateChain(chain); }
@Test(expected = IllegalArgumentException.class) public void checkClientTrusted1_nonNullNull() throws Exception { instance.checkClientTrusted(new X509Certificate[]{cert.certificate()}, null, new Socket()); }
@Test(expected = IllegalArgumentException.class) public void checkServerTrusted1_nonNullNull() throws Exception { instance.checkServerTrusted(new X509Certificate[]{cert.certificate()}, null, new Socket()); }
/** * {@inheritDoc} */ @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { validateAuthType(authType); validateChain(chain); }
@Test(expected = IllegalArgumentException.class) public void checkClientTrusted1_nonNullEmpty() throws Exception { instance.checkClientTrusted(new X509Certificate[]{cert.certificate()}, "", new Socket()); }
@Test(expected = IllegalArgumentException.class) public void checkServerTrusted1_nonNullEmpty() throws Exception { instance.checkServerTrusted(new X509Certificate[]{cert.certificate()}, "", new Socket()); }