Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bouke/swift-security
Proof of concept for accessing Keychain using Swift
https://github.com/bouke/swift-security
Last synced: about 1 month ago
JSON representation
Proof of concept for accessing Keychain using Swift
- Host: GitHub
- URL: https://github.com/bouke/swift-security
- Owner: Bouke
- License: mit
- Created: 2015-04-06T15:14:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-11T13:53:30.000Z (over 9 years ago)
- Last Synced: 2023-03-22T12:39:07.345Z (over 1 year ago)
- Language: Swift
- Homepage:
- Size: 125 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```swift
import Swift_Security
```To list all installed root certificates:
```swift
let certificates = root_certs()
println(certificates)
```Some basic info can be listed about the certificate as well:
```swift
certificates[0].commonName
certificates[0].subjectCountry
```Check the trust settings for a certificate.
```swift
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.
```swift
if var trust = nl?.trustSettings(.Admin) {
trust[.AppleSSL] = .Deny
println(trust.save())
}
```