changed code to verify java.security.cert.X509Certificate chains as well