Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Pinning - Always failing #309

Open
nilecoder opened this issue Nov 15, 2021 · 0 comments
Open

SSL Pinning - Always failing #309

nilecoder opened this issue Nov 15, 2021 · 0 comments

Comments

@nilecoder
Copy link

What's the problem?

Trying to load a self signed certificate like so:

    if let certPath = Bundle.module.url(forResource: "theCert", withExtension: "cer") {
            let certData = try! Data(contentsOf: certPath)
            let cert = SSLCert(data: certData)
            task.security = HTTPSecurity(certs: [cert], usePublicKeys: false)
}

 task.run { (response) in
            if let err = response.error {
                print("error: \(err)")
                return
            }

       // Do work
}

I have also tried using the SecKey initializer and even though I get back a valid value, pinning always fails. The task is canceled and I'm not sure why.

Can you lead me in the right direction?
Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant