* @param chain The certificate chain in question.
* @return true if the user accepts the certificate chain.
*/
private boolean checkCertificates(X509Certificate[] chain)
{
CallbackHandler handler = new DefaultCallbackHandler();
try
{
Class c = Class.forName(Util.getSecurityProperty("jessie.certificate.handler"));
handler = (CallbackHandler) c.newInstance();
}
catch (Exception x)
{
}
String nl = Util.getProperty("line.separator");
ConfirmationCallback confirm = new ConfirmationCallback(
"The server's certificate could not be verified. There is no proof" + nl +
"that this server is who it claims to be, or that their certificate" + nl +
"is valid. Do you wish to continue connecting?",
ConfirmationCallback.ERROR, ConfirmationCallback.YES_NO_OPTION,
ConfirmationCallback.NO);
try
{
handler.handle(new Callback[] { confirm });
}
catch (Exception x)
{
return false;
}