Last active
November 16, 2017 13:58
-
-
Save alexisakers/d8c3e3a86bdf7a02f6d3204dc8aea04a to your computer and use it in GitHub Desktop.
Get the description of a Security OSStatus
This file contains 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
#!/usr/bin/swift | |
import Foundation | |
import Security | |
guard CommandLine.arguments.count > 1 else { | |
print("USAGE: osstatus [code]") | |
exit(-1) | |
} | |
guard let code = OSStatus(CommandLine.arguments[1]) else { | |
print("Not a valid status code.") | |
exit(-1) | |
} | |
guard let description = SecCopyErrorMessageString(code, nil) else { | |
print("Unknown error") | |
exit(-1) | |
} | |
print(description) | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
macOS script to get the description of Security error codes.
Install
Usage
$ osstatus -25300 The specified item could not be found in the keychain.