< prev index next >

test/sun/security/ssl/X509TrustManagerImpl/CertRequestOverflow.java

Print this page
rev 14277 : [mq]: 8154947-Send-empty-list-of-authorities-in-CertificateRequest-if-server-has-too-many-of-them

*** 26,39 **** // system properties in samevm/agentvm mode. // /* * @test ! * @bug 7200295 * @summary CertificateRequest message is wrapping when using large * numbers of Certs ! * @run main/othervm CertRequestOverflow */ import java.io.*; import java.net.*; import java.util.*; --- 26,40 ---- // system properties in samevm/agentvm mode. // /* * @test ! * @bug 7200295 8154947 * @summary CertificateRequest message is wrapping when using large * numbers of Certs ! * @run main/othervm -Djdk.tls.allowDropCertReqAuthorites=true CertRequestOverflow ! * @run main/othervm -Djdk.tls.allowDropCertReqAuthorites=false CertRequestOverflow */ import java.io.*; import java.net.*; import java.util.*;
*** 74,83 **** --- 75,92 ---- * Turn on SSL debugging? */ static boolean debug = false; /* + * Is server allowed to send empty list of authorities in + * CertificateRequest message? + */ + static boolean allowDropAuthorities = + System.getProperty("jdk.tls.allowDropCertReqAuthorites", "") + .equalsIgnoreCase("true"); + + /* * If the client or server is doing some kind of object creation * that the other side depends on, and that thread prematurely * exits, you may experience a hang. The test harness will * terminate all hung threads after its timeout has expired, * currently 3 minutes by default, but you might try to be
*** 116,135 **** try { sslIS.read(); sslOS.write(85); sslOS.flush(); ! throw new Exception("SERVER TEST FAILED! " + "It is expected to fail with field length overflow"); } catch (SSLException ssle) { Throwable cause = ssle.getCause(); if (!(cause instanceof RuntimeException)) { System.out.println("We are expecting a RuntimeException!"); throw ssle; } System.out.println("The expected exception! " + ssle); } finally { sslSocket.close(); } System.out.println("SERVER TEST PASSED!"); --- 125,150 ---- try { sslIS.read(); sslOS.write(85); sslOS.flush(); ! if (!allowDropAuthorities) { throw new Exception("SERVER TEST FAILED! " + "It is expected to fail with field length overflow"); + } } catch (SSLException ssle) { + if (allowDropAuthorities) { + throw new RuntimeException("Unexpected exception at server side", + ssle); + } else { Throwable cause = ssle.getCause(); if (!(cause instanceof RuntimeException)) { System.out.println("We are expecting a RuntimeException!"); throw ssle; } System.out.println("The expected exception! " + ssle); + } } finally { sslSocket.close(); } System.out.println("SERVER TEST PASSED!");
*** 165,175 **** --- 180,195 ---- try { sslOS.write(280); sslOS.flush(); sslIS.read(); } catch (SSLException ssle) { + if (allowDropAuthorities) { + throw new RuntimeException("Unexpected exception at client side", + ssle); + } else { System.out.println("An expected exception!"); + } } finally { sslSocket.close(); } }
< prev index next >