     private let validateCertificateChain: Bool
     private let validateHost: Bool
 
-    public init(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool) {
+    @nonobjc public init(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool) {
         self.pinnedPublicKeys = publicKeys
+        self.validateCertificateChain = validateCertificateChain
+        self.validateHost = validateHost
+    }
+
+    public init(certificatesData: [Data], validateCertificateChain: Bool, validateHost: Bool) {
+        self.pinnedPublicKeys = PinPublicKeys.publicKeys(from: certificatesData)
         self.validateCertificateChain = validateCertificateChain
         self.validateHost = validateHost
     }

        }
        return false
    }

    private func certificateData(for trust: SecTrust) -> [Data] {
        var certificates: [SecCertificate] = []

        for index in 0..<SecTrustGetCertificateCount(trust) {
            if let certificate = SecTrustGetCertificateAtIndex(trust, index) {
                certificates.append(certificate)
            }
        }

        return certificateData(for: certificates)
    }

    private func certificateData(for certificates: [SecCertificate]) -> [Data] {
        return certificates.map { SecCertificateCopyData($0) as Data }
    }
}

public class PinPublicKeys: NSObject, ServerTrustPolicy {

        }

        if certificateChainEvaluationPassed {
            for serverPublicKey in PinPublicKeys.publicKeys(for: serverTrust) as [AnyObject] {
                for pinnedPublicKey in pinnedPublicKeys as [AnyObject] {
                    if serverPublicKey.isEqual(pinnedPublicKey) {
                        return true
