// Ensure that this request came in on an SSLSocket
if (actual.getSocket() == null)
return;
if (!(actual.getSocket() instanceof SSLSocket))
return;
SSLSocket socket = (SSLSocket) actual.getSocket();
// Look up the current SSLSession
SSLSession session = socket.getSession();
if (session == null)
return;
// if (debug >= 2)
// log(" verify: Has current SSLSession");
// Verify that there is a client certificate chain present
X509Certificate jsseCerts[] = null;
try {
jsseCerts = session.getPeerCertificateChain();
if (jsseCerts == null)
jsseCerts = new X509Certificate[0];
} catch (SSLPeerUnverifiedException e) {
log(" verify: SSLPeerUnverifiedException");
jsseCerts = new X509Certificate[0];
}
// if (debug >= 2)
// log(" verify: Certificate chain has " +
// jsseCerts.length + " certificates");
if (jsseCerts.length > 0)
return;
// Force a new handshake to request the client certificates
// if (debug >= 2)
// log(" verify: Invalidating current session");
session.invalidate();
// if (debug >= 2)
// log(" verify: Forcing new SSL handshake");
socket.setNeedClientAuth(true);
try {
socket.startHandshake();
} catch (IOException e) {
log(" verify: ", e);
}
// Revalidate the existence of the required certificates
session = socket.getSession();
if (session == null)
return;
try {
jsseCerts = session.getPeerCertificateChain();
if (jsseCerts == null)