Robust error handling / Try sun.security.x509 first