Posts

Post not yet marked as solved
1 Replies
I was able to retrieve encrypted pem format with the below code :  NSData *data = NULL;      CFDataRef exportKey;     const char* password = "password";     exportKey = CFDataCreate(NULL, (unsigned char*)password, strlen(password));     SecItemImportExportKeyParameters keyParams;     keyParams.version = SECKEYIMPORTEXPORTPARAMS_VERSION;      keyParams.flags = 0;      keyParams.passphrase = exportKey;      keyParams.alertTitle = 0;      keyParams.alertPrompt = 0;     keyParams.accessRef = NULL;     keyParams.keyAttributes = NULL;     keyParams.keyUsage = NULL;       status = SecItemExport(          keyRef,          kSecFormatWrappedPKCS8,          kSecItemPemArmour,          &keyParams,          &data);