private static void CopyCertToRootStoreIfNeeded(X509Certificate2 cert, Server server) { try { if (CertificateUtils.IsSelfSignedCertificate(cert)) { CertificateUtils.CopyCertToRootStore(cert); } } catch (CryptographicException innerException) { throw new UnableToAddCertificateToRootStoreException(cert.Thumbprint, server.Name, innerException); } catch (SecurityException innerException2) { throw new UnableToAddCertificateToRootStoreException(cert.Thumbprint, server.Name, innerException2); } }