You’re not setting all the fields of the
SecItemImportExportKeyParametersstructure. That structure contains various pointers; if those pointers contain junk values, that’d explain the crash.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Thats weird cause those other fields are optional so I didn't think it mattered but it did. Here is the parameters I had to use to prompt the user to enter a passphrase and export the key as a PKCS8 key in case anyone has the same issue I did.
SecItemImportExportKeyParameters params; params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION; params.flags = kSecKeySecurePassphrase; params.passphrase = NULL; params.alertTitle = CFSTR("Title"); params.alertPrompt = CFSTR("Prompt"); params.accessRef = NULL; params.keyAttributes = NULL; params.keyUsage = NULL;
Thank you for your help