         // against policy setting to ignore certificate errors and so on.
         var evaluateResult: SecTrustResultType = .invalid
         guard let serverTrust = serverTrust else {
+            return false
+        }
+        guard let domain = domain else {
             return false
         }
         SecTrustEvaluate(serverTrust, &evaluateResult)

    func evaluateCertificateMismatch(_ policy: AFRememberingSecurityPolicy?, summary certificateSummary: String?, forDomain domain: String?)
}

var trustedCertificates: [AnyHashable: Any] = [:]

func SecTrustGetLeafCertificate(trust: SecTrust?) -> SecCertificate? {
    // Returns the leaf certificate from a SecTrust object (that is always the

        }
    }

    class func storeCertificateData(_ certificate: CFData?, forDomain domain: String) {
        let certificateData = certificate as Data?
        trustedCertificates[domain] = certificateData
        self.saveTrustedCertificates()
    }

    class func certificateData(forDomain domain: String) -> CFData? {
        guard let certificateData = trustedCertificates[domain] as? Data else { return nil  }
        return certificateData as CFData
    }
