iOS Question Can't compile B4i-Bridge due to "MAC verification failed during PKCS12 import"

Sandman

Expert
Licensed User
Longtime User
I'm struggling to compile B4i-Bridge, even after trying several times and following every single detail in the guides.

I get this error message when sending to builder:
Compiling B4i-Bridge:
B4i Version: 8.51
Parsing code.    (0.01s)
Building folders structure.    (0.00s)
Running custom action.    (0.02s)
Compiling code.    (0.03s)
Building designer app.    (0.01s)
Building Xcode project.    (0.07s)
Preparing project for builder.    (0.04s)
    Project size: 0.23 MB
Sending data to remote compiler.    Error
Error: security: SecKeychainItemImport: MAC verification failed during PKCS12 import (wrong password?)

That error message isn't uncommon in the forum and I think I've read every single post about it, and I still haven't been able to solve it. All in all I've tried two full workdays to get this working, without progress. I just don't know what else to try now.

Here are all details that I can think of:

Build server
  • MacOS Sonoma 14.2.1
  • XCode 15.2
  • Version 8.50
  • Tried with jdk-14.0.1
  • Tried with jdk-14.0.2
  • Instructions say to use jdk-11, and links to another page, where jdk-11 isn't available so I haven't tried that

B4i
The certificate guide shows Apple website, and they have updated some things in it since the video guide was made, but I am as certain as I can be that I have chosen the things intended in the video guide.

Whatever I do, I get the same error message. Can somebody see what I have done wrong?

(If needed I'm willing to screenshot my way through the process on the Apple website to show what options I picked.)
 

Sandman

Expert
Licensed User
Longtime User
Thank you, I entered the id and tried using both Java 14 and 19 and neither work - I get the exact same error message.

I can think of three more things to try, to solve this:

  1. You could compress your PC Java folder and upload to something like Sprend (https://sprend.com) and then I could try with it - just to exclude the PC java version.

  2. We could do the same for the java you use on your mac - just to exclude that too.

  3. I do it all over once again and screenshot my way through the Apple process, update this thread and hopefully you can see where I made a mistake.

1 and 2 should be fairly quick and simple to test, to once and for all kill the possiblity of bad java versions being the problem. I mean, if it's acceptable to you and you have the outgoing bandwidth to handle that upload (I don't know how broadband works where you live). If I try with your java folders and it works, I'm willing to do the work to diff our installations and see if I can figure out what is different.

But I'm open to whatever you suggest. Desperation is setting in.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Update. I searched online for the error message and found this post on Stack Overflow:

It discusses this exact error message, and the solution they found. I checked my mac and I do have a security command in the terminal, just as the post mentions.

If this command is used by the builder, I could perhaps try to mimic the builder and run some command in the terminal on the mac and see if that works? If we're lucky (so to speak), I would get the error message in the terminal, and then we might have more information on where the issue is. (I would need information on what command to run.)

ADDITION. I should also mention that my password for the private sign key does not contain any characters that would need escaping.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Another update. I have gone through the whole process in the Apple website again by following this guide:



I documented everything with screenshots. Hopefully somebody can tell me if I've made an error somewhere.

1. I created a brand new private sign key in an empty folder (that I specified in Configure Paths in B4i)
1726055837448.png


2. This is my keys folder so far
1726055879761.png


3. I have no new devices to add so that step is skipped

4. Logged in to Apple website

5. I created a new App ID

1726056035041.png

There's a long list of options here, but I chose App IDs, because that best matched the instructions.


1726056088857.png

I chose App.


1726056295076.png

I gave it a description and a wildcard bundle id. The instructions say to just enter * here, but that isn't accepted by Apple, so I prefix it with b4i. I selected no capabilities/app services.


1726056388965.png

I confirmed the App ID.



6. I created a certificate

1726056775051.png


The instructions say to create a production certificate, but that phrase isn't used by Apple anymore. (It is used when talking about certificates for push notifications and watchkit services - clearly not what I'm looking for.) But the guide says to pick a certificate of type "App Store and Ad Hoc". I picked "iOS Distribution (App Store Connect and Ad Hoc)" because it matched the guide best.



1726056887742.png

I uploaded the certSigningRequest.csr that I created just a few minutes before.


1726056953734.png

I downloaded the generated certificate as default.cer into the keys directory.


1726057074050.png

This is what the keys folder looks like now.


7. I created a privisioning profile

1726057216564.png

The guide said to choose "Distribution -> Ad Hoc", and this exact option is available so I picked that.


1726057306628.png

I picked the App Id created above.


1726057391249.png

I picked the certificate created above.


1726057444037.png


I selected all devices.


1726057524611.png

I named and generated the provisioning file.


1726057576323.png

I downloaded the provisioning file into the keys folder.


1726057647220.png


This is what the keys folder looks like now.



After this I followed this guide to build B4i-Bridge.



8. Create a new B4i project for B4i-Bridge

1726057960850.png

I set the package name identical to the guide, which also matches the b4i.* app id I used above.


1726058056309.png

Not part of the guide, but I verified that I'm using the hosted builder, using the temporary username I have.


I chose to Build B4i-Bridge App, and failed with the same error message:
B4X:
B4i Version: 8.51
Parsing code.    (0.01s)
Building folders structure.    (0.01s)
Running custom action.    (0.03s)
Compiling code.    (0.02s)
Building designer app.    (0.02s)
Building Xcode project.    (0.09s)
Preparing project for builder.    (0.36s)
    Project size: 0.23 MB
Sending data to remote compiler.    Error
Error: security: SecKeychainItemImport: MAC verification failed during PKCS12 import (wrong password?)


I also tested with my local builder, and got the same error message.
 

Attachments

  • 1726056198345.png
    1726056198345.png
    35.1 KB · Views: 24
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've just made some tests.

I got this error with OpenJdk 19. There is an issue here that needs further investigation.

However it did work with OpenJDK 14.0.1: https://www.b4x.com/b4j/files/java/jdk-14.0.1.zip
Make sure to update Tools - Configure Paths.

Please confirm that it worked and I'll update the instructions.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Please confirm that it worked and I'll update the instructions.

It did not work.

I have now tested with all of these:
1726059987291.png


The selected one, the one ending in _fresh, is downloaded just now from the link you posted.

However, I did find something strange that perhaps might be relevant. I started wondering if perhaps the Paths setting had a bug where it didn't use the path if it was pasted instead of Browsed. (I tend to paste the path from Explorer, it's quicker.) To test this I entered a completely fake path:

1726060157864.png


Then I tried building B4i-Bridge again, and to my surprise the IDE didn't complain. Instead I got the same error again.

1726060257607.png


After that I created a new folder, named empty_folder:

1726060459986.png


In it I created a new file, named javac.exe, zero bytes large. Just something so the IDE would let be Browse to it.

1726060513568.png


In Paths I Browsed to it:

1726060560852.png



Then I tried to build B4i-Bridge again. No complaints about the java, but the same error message again.

So I'm wondering what java the IDE picks up, and if/how it even uses it..?
 

Attachments

  • 1726060251045.png
    1726060251045.png
    12.5 KB · Views: 18
Upvote 0

Sandman

Expert
Licensed User
Longtime User
I can confirm that it worked as described in #10.

Thank you for helping me.

I have a lot of built-up frustration from struggling with this for three days. Once I calm down and get some code out the door, I believe I will post a couple of Wishes related to this in the near future.
 
Upvote 0
Top