Distribution problem with provision & certificate

I’m stuck in here, and cannot find a solution…

So, I can build for development without a problem. With adhoc provision, no problem again. When it comes to distribution provision, UE asks for wrong certificate and generates an error telling me that the provision does not include the certificate.
When I look at the properties screen, this is what I’m seeing:

The development provision tells “no valid certificates”, yet the first one in the list is the valid one.
For distribution, it seems ok, but is not working… Selecting any provision/certificate duo is not recognised on Windows.
Distribution is not even found by IPhonePackager…

This is the error log I’m receiving:


IPhonePackager: CWD: C:\Program Files (x86)\Epic Games\4.14\Engine\Binaries\DotNET\IOS
IPhonePackager: Initial Dir: C:\Program Files (x86)\Epic Games\4.14
IPhonePackager: Env CWD: C:\Program Files (x86)\Epic Games\4.14\Engine\Binaries\DotNET\IOS
IPhonePackager: BranchPath = EMRAH/C/Program Files (x86)/Epic Games/4.14/Engine/Binaries --- GameBranchPath = EMRAH/D/Unreal/HitMe/Binaries
IPhonePackager:
IPhonePackager: ----------
IPhonePackager: Executing command 'Clean' ...
IPhonePackager: Cleaning temporary files from PC ...
IPhonePackager:  ... cleaning: D:\Unreal\HitMe\Intermediate\IOS-Deploy\HitMe\Development\
IPhonePackager:
IPhonePackager: Loaded stub IPA from 'D:\Unreal\HitMe\Binaries\IOS\HitMe.stub' ...
IPhonePackager:  ... 'D:\Unreal\HitMe\Binaries\IOS\HitMe.stub' -> 'D:\Unreal\HitMe\Binaries\IOS\HitMe.ipa'
IPhonePackager:       Copy: D:\Unreal\HitMe\Binaries\IOS\HitMe.stub -> D:\Unreal\HitMe\Binaries\IOS\HitMe.ipa, last modified at 7.02.2017 12:44:31
IPhonePackager: Found Info.plist (D:\Unreal\HitMe\Saved\StagedBuilds\IOS\Info.plist) in stage, which will be merged in with stub plist contents
IPhonePackager: Using mobile provision 'XC: HitMe Development' to code sign
IPhonePackager:  ... Writing updated embedded.mobileprovision
IPhonePackager:   Looking for a certificate that matches the application identifier 'NNWVUJ3RJ4.com.markakod.hitme'
IPhonePackager:   .. Provision entry SN '30CDA9457E8001BE' matched 1 installed certificate(s)
IPhonePackager:   .. .. Installed certificate 'iPhone Developer: Emrah Gunduz (......)' is valid (choosing it) (range '7.02.2017 11:59:39' to '7.02.2018 11:59:39')
IPhonePackager: ... Found matching certificate 'iPhone Developer: Emrah Gunduz (......)' (valid from 7.02.2017 11:59:39 to 7.02.2018 11:59:39)
IPhonePackager: Found CFBundleVersion string '0.91' and updated it to '0.92'
IPhonePackager: Saving IPA ...
IPhonePackager:  ... Writing updated Info.plist
IPhonePackager: Opening source executable...
IPhonePackager: ... Processing one mach object (binary is thin)
IPhonePackager: ... Initial signature step (1,69 s elapsed so far)
IPhonePackager: IPP ERROR: Application exception: System.Security.Cryptography.CryptographicException: Keyset does not exist
IPhonePackager:
IPhonePackager:    at System.Security.Cryptography.Pkcs.PkcsUtils.CreateSignerEncodeInfo(CmsSigner signer, Boolean silent)
IPhonePackager:    at System.Security.Cryptography.Pkcs.SignedCms.Sign(CmsSigner signer, Boolean silent)
IPhonePackager:    at System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature(CmsSigner signer, Boolean silent)
IPhonePackager:    at MachObjectHandling.CodeDirectorySignatureBlob.SignCodeDirectory(X509Certificate2 SigningCert, DateTime SigningTime, CodeDirectoryBlob CodeDirectory)
IPhonePackager:    at iPhonePackager.CodeSignatureBuilder.PerformSigning()
IPhonePackager:    at iPhonePackager.CookTime.RepackageIPAFromStub()
IPhonePackager:    at iPhonePackager.Program.Main(String] args)
CommandUtils.Run: Run: Took 2,1006508s to run IPhonePackager.exe, ExitCode=1

I tried copying certificates+keys from system to login on keychain manager on macos.
Re-generated all certificate and provisions on developer site
Deleted all provisions re-created them on developer site
Deleted, re-installed all items on windows and macos
Created a new keychain, and tried everything from zero…
Nothing seems to work.

Compiling and packaging takes 45 minutes for each try, and I’m really tired of the situation.
Does anybody have any idea for me to try? If you encountered, how did you solve this problem?

Solved it after a calming coffee break…

I revoked all existing certificates.
Deleted app id specific provisioning profiles.
Generated a new certificate in xcode, not via certificate request.
Created an empty ios app with same namespace in xcode.
Let xcode take care of the profiles.
Then exported certificate+key from xcode. Copied downloaded profiles.

Now it works. Still, development profile shows “no certificate”, but both provisioning is working…

I had the same problem and solution was:

  1. Delete all provisioning profiles and certificates.
  2. Request new certificates and provisioning profiles only in Xcode (don’t download from Apple Developer Dashboard!)
  3. Download it directly in XCode.
  4. Export provisioning profiles from Xcode and install in UE4.
  5. Export certificates in Keychain and install in UE4.