}
public Object[] getPeerCertificateChain(boolean force)
throws IOException {
// Look up the current SSLSession
SSLSession session = ssl.getSession();
if (session == null)
return null;
// Convert JSSE's certificate format to the ones we need
X509Certificate jsseCerts[] = null;
java.security.cert.X509Certificate x509Certs[] = null;
try {
try {
jsseCerts = session.getPeerCertificateChain();
} catch(Exception bex) {
// ignore.
}
if (jsseCerts == null)
jsseCerts = new X509Certificate[0];
if(jsseCerts.length <= 0 && force) {
session.invalidate();
ssl.setNeedClientAuth(true);
ssl.startHandshake();
session = ssl.getSession();
jsseCerts = session.getPeerCertificateChain();
if(jsseCerts == null)
jsseCerts = new X509Certificate[0];
}
x509Certs =
new java.security.cert.X509Certificate[jsseCerts.length];