iOS remote build IPP exception Keyset does not exist

Hello UE4 community,

I am having a horrible time getting remote building to work for an iOS game (I was hoping to submit yesterday). Please help me. I’m losing my mind.

Scenario:

  • UE4.20 on Windows 10 / Max OS X 10.12.6 / Paid Apple Developer account
  • Certificates mobile provisions valid and working for local (not remote) iOS packaging
  • Prior to this issue I have been packaging and deploying my game .ipa to my iPad (ios12) happily / successfully many times
  • Issue has been introduced after needing to remote build due to adding iOS icons (.png) to Project Settings > Platforms > iOS > Required Icons.
  • SSH / Remote rsync commands appear to be working okay. I’m not seeing SSH Key errors.
  • I can revert to successful packaging by removing the icons and the remote build settings then removing the Saved, Intermediate, Build and Binaries folders from my project (I do this to clear out problematic iOS packaging issues).

TL:DR

  • CAN package for iOS and deploy .IPA file to a connected iPad WITHOUT remote build / Required icons
  • CANNOT package for iOS using remote build due to an IPP cryptography exception (keyset does not exist)

My Interpretation

I understand this issue to be caused by the Mac not having the appropriate certificates / key pair installed or trusted or something. I have been trying everything I have found on UE4 Answer Hub related to sorting these certs out, to no avail.

Certificate Method:
I have been creating and installing certificates (and device mobilprovisions) on the PC using \Engine\Binaries\DotNET\IOS\IPhonePackager.exe and the Apple Developer portal. These have worked for all local packaging tasks.
I am confused about how to create / import / manage the certificates & keys on the Mac using XCode / Keychain.
I find it very confusing knowing what certificate XCode installs when I sign in. Keychain makes it look like I don’t have a private key (in mac compatible format) for the correct certificate. I have the .key file for the certificate on the PC side but that appears to be a different format.

Error Message:

UATHelper: Packaging (iOS):     .. Provision entry SN '0xxxxxxxxxxxxx3' matched 1 installed certificate(s)
UATHelper: Packaging (iOS):     .. .. Installed certificate 'iPhone Developer: Wxxxxm Mxxxs (xxxxxxxxxxx)' is valid (choosing it) (range '17/12/2018 9:40:49 PM' to '17/12/2019 9:40:49 PM')
UATHelper: Packaging (iOS):   IPP ERROR: Application exception: System.Security.Cryptography.CryptographicException: Keyset does not exist
PackagingResults: Error: Application exception: System.Security.Cryptography.CryptographicException: Keyset does not exist
UATHelper: Packaging (iOS):   
UATHelper: Packaging (iOS):      at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
UATHelper: Packaging (iOS):      at System.Security.Cryptography.X509Certificates.X509Utils._ExportCertificatesToBlob(SafeCertStoreHandle safeCertStoreHandle, X509ContentType contentType, IntPtr password)
UATHelper: Packaging (iOS):      at System.Security.Cryptography.X509Certificates.X509Certificate.ExportHelper(X509ContentType contentType, Object password)
UATHelper: Packaging (iOS):      at iPhonePackager.CompileTime.CopyFilesNeededForMakeApp() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\IOS\iPhonePackager\CompileTime.cs:line 274
UATHelper: Packaging (iOS):      at iPhonePackager.CompileTime.CreateApplicationDirOnMac() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\IOS\iPhonePackager\CompileTime.cs:line 580
UATHelper: Packaging (iOS):      at iPhonePackager.CompileTime.PackageIPAOnMac() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\IOS\iPhonePackager\CompileTime.cs:line 620
UATHelper: Packaging (iOS):      at iPhonePackager.Program.Main(String[] args) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\IOS\iPhonePackager\iPhonePackager.cs:line 882
UATHelper: Packaging (iOS):   ERROR: System.Exception: IPP ERROR: Application exception: System.Security.Cryptography.CryptographicException: Keyset does not exist
UATHelper: Packaging (iOS):             at UnrealBuildTool.IOSToolChain.PostBuildSync(UEBuildTarget Target) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\IOS\IOSToolChain.cs:line 1949
UATHelper: Packaging (iOS):             at UnrealBuildTool.IOSPlatform.PostBuildSync(UEBuildTarget Target) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\IOS\UEBuildIOS.cs:line 684
UATHelper: Packaging (iOS):             at UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String[] Arguments, FileReference ProjectFile, Boolean bCatchExceptions) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 1683
UATHelper: Packaging (iOS):          (see C:\Users\Wil\AppData\Roaming\Unreal Engine\AutomationTool\Logs\G+Epic+Games+UE_4.20\UBT-GiftSlinger-IOS-Development_2.txt for full exception trace)
UATHelper: Packaging (iOS):   Total build time: 59.38 seconds (Remote executor: 18.96 seconds)
PackagingResults: Error: System.Exception: IPP ERROR: Application exception: System.Security.Cryptography.CryptographicException: Keyset does not exist
UATHelper: Packaging (iOS): Took 59.8194768s to run UnrealBuildTool.exe, ExitCode=1
UATHelper: Packaging (iOS): ERROR: UnrealBuildTool failed. See log for more details. (C:\Users\Wil\AppData\Roaming\Unreal Engine\AutomationTool\Logs\G+Epic+Games+UE_4.20\UBT-GiftSlinger-IOS-Development_2.txt)
UATHelper: Packaging (iOS):        (see C:\Users\Wil\AppData\Roaming\Unreal Engine\AutomationTool\Logs\G+Epic+Games+UE_4.20\Log.txt for full exception trace)
PackagingResults: Error: UnrealBuildTool failed. See log for more details. (C:\Users\Wil\AppData\Roaming\Unreal Engine\AutomationTool\Logs\G+Epic+Games+UE_4.20\UBT-GiftSlinger-IOS-Development_2.txt)
UATHelper: Packaging (iOS): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (iOS): BUILD FAILED

I have created brand new certificates and mobile provisions, following Darthlogan’s Mac based certificate creation method in this this postl, but it has made no difference. I also removed all old mobile provisions and the SSH key and added them afresh. Still no go.

Same result on a brand new project (FPS template).

Add certs etc then package > Works fine.

Change 1 iOS icon > Package > needs remote build
Set remote build server, ssh key > Package > Rsync action happens, but in the “Staging files before copying to Mac” phase the IPP exception Keyset does not exist error occurs (as in all previous attempts)

I have also just tried creating a completely new Windows user profile, importing dev cert & mobile provision, creating a new SSH key and packaging.

Same result.

Can anyone advise what is going on with this file path shown in the logs?
D:\Build++UE4\Sync\Saved\CsTools\Engine\Source\Programs\IOS\iPhonePackager\CompileTime.cs:line 620

D: is my systems DVD drive, so that is confusing me.

Log files attached. Log UBTlog UBTlog2

So, after a hell of a lot of stuffing around I have finally moved past this error. Not resolved in the sense that I never was able to pinpoint the true cause, but suppressed, stomped on and generally nulled.

I didn’t get any response through his forum, but was able to engage with another UE4 dev who has had similar experiences over on Reddit. Just being able to interact with someone about it got me through in the end.

Final resolution can be attributed to:

  1. Upgrade Mac to OS X 10.14 & Xcode 10.1
  2. Format PC and re-install Win 10 (Home), Drivers then UE4.21,4.20,4.18 and dependencies.
  3. Import Developer mobileprovision and certificate / key (Same ones I exported from Mac Keychain previously)
  4. Import mobileprovision and cert to project
  5. Set remote build server and username, create SSH key
  6. Build

My (purely guesswork) diagnosis: Somewhere among the backend UE4 toolset / certifcates on the PC there was a permission problem or a version conflict. I just couldn’t find it.

My advice? Once you have spent more than a couple of hours tracking down a build error like this - flatten it all a start from a clean slate. Even accounting for re-installation of stuff it is so much faster. And if anyone says “reformatting is not an option”… you sound like you are courting danger in the form of a system drive failure. Live like its about to die and you need to re-install quick and get back to work. I’ve blown about a week on this ■■■■. Lesson learned.

For me the solution was to import the mobileprovisioning and the certificate with the engine running AS ADMINISTRATOR!
In my case, it was distribution, not development.

same, I created an direct access to the engine and run as administrator, that solved the problem