Last active
August 29, 2015 14:02
-
-
Save rsobik/9a66c8469de7fcae9499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
var unmanagedTrust : Unmanaged<SecTrust>? | |
let status = SecTrustCreateWithCertificates(nil, nil, &unmanagedTrust) | |
let trust = unmanagedTrust!.takeUnretainedValue() | |
assert(SecTrustGetCertificateCount(trust) > 0) | |
let certificate = SecTrustGetCertificateAtIndex(trust, 0).takeUnretainedValue() | |
let serverCertData = SecCertificateCopyData(certificate).takeRetainedValue() | |
dump(serverCertData) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment