Proof of concept for accessing Keychain using Swift
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.playground
Swift-Security.xcodeproj
Swift-Security
Swift-SecurityTests
LICENSE
README.md

README.md

Swift-Security

Package for typed access to Security (Keychain) services. I built this over the weekend to check how hard it would be to block root certificates, using Swift.

When included as a framework, import it as any other framework:

import Swift_Security

To list all installed root certificates:

let certificates = root_certs()
println(certificates)

Some basic info can be listed about the certificate as well:

certificates[0].commonName
certificates[0].subjectCountry

Check the trust settings for a certificate.

let nl = first(certificates.filter { $0.subjectCountry == "NL" })
println(nl?.commonName)
println(nl?.trustSettings(.Admin))

Change the trust setting for a certificate. This doesn't work in a playground, as a UI dialog for confirming this action will be spawned by OS X.

if var trust = nl?.trustSettings(.Admin) {
    trust[.AppleSSL] = .Deny
    println(trust.save())
}