Skip to content

Instantly share code, notes, and snippets.

@ianmcmahon
Created February 16, 2015 02:33
Show Gist options
  • Save ianmcmahon/fac7a488caa640fa81f1 to your computer and use it in GitHub Desktop.
Save ianmcmahon/fac7a488caa640fa81f1 to your computer and use it in GitHub Desktop.
let tag:NSData = ("com.prototechnical.Crytter.keys.user" as NSString).dataUsingEncoding(NSUTF8StringEncoding)!
let parameters: [String: AnyObject] = [
kSecAttrKeyType: kSecAttrKeyTypeRSA,
kSecAttrKeySizeInBits: 2048,
kSecAttrIsPermanent: true,
kSecAttrApplicationTag: tag
]
println(parameters as NSDictionary)
var publicKeyPtr, privateKeyPtr: Unmanaged<SecKey>?
let result = SecKeyGeneratePair(parameters, &publicKeyPtr, &privateKeyPtr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment