question

JonathanEllis-6522 avatar image
0 Votes"
JonathanEllis-6522 asked RobCaplan edited

Binding framework referencing Security.framework results in BI1078: bgen: Do not know how to make a signature...

I have an iOS framework I'm trying to generate Xamarin bindings for.

Up until now it's always worked fine, but I've now added a new method which returns a SecKey (from Security.framework).

Sharpie generated the following:

 [Export("key")]
 unsafe SecKeyRef *Key { get; }

However, this doesn't compile as it can't find SecKeyRef, and there are various recommendations that this should actually be changed to:

 [Export("key")]
 SecKey Key { get; }

Having now changed this, SecKey is clearly being picked up correctly as a symbol, but I'm getting BI1078 "Do not know how to make a signature for Security.SecKey.

This appears to be identical to the issue reported in the very last post of this thread:

https://forums.xamarin.com/discussion/104161/failing-to-bind-to-securityinterface-framework

Any assistance would be much appreciated! Thanks

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered JarvanZhang-MSFT edited

Hello,​

Welcome to our Microsoft Q&A platform!

Hi, JonathanEllis. For this issue, try to change the type to IntPtr for test. SecKeyRef is a type in native iOS, it is just IntPtr in Xamarin.iOS. We need to represent the a pointer or handle to the platform-specific type in .Net.

Similar issues:
https://stackoverflow.com/questions/37855022/btoucherror-bi1017do-not-know-how-to-make-a-signature-for-system-int32-in-met
https://stackoverflow.com/questions/64719935/xamarin-ios-binding-library-cannot-use-the-seckey-api-from-the-security-framewor#

Best Regards,

Jarvan Zhang



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi

Thanks for your reply.

So, if I change it to IntPtr then it builds -- great! -- BUT is this gonna be OK for a consumer of my framework?

Sorry, I'm not a Xamarin developer, I'm just trying to provide our SDK for consumption by Xamarin devs.

If I give them a SecKey as an IntPtr, are they going to be able to re-cast it to a SecKey where needed? How does this work in Xamarin?

Looking at the code here it looks like the Xamarin.iOS SecKey class uses IntPtr as the internal type. So would the developer then re-create the SecKey by instantiating it with the provided IntPtr?

Some explanation here would be appreciated!

Thanks


0 Votes 0 ·

SecKeyRef is a type in native iOS, it is just IntPtr in Xamarin.iOS. We need to represent the a pointer or handle to the platform-specific type in .Net.

Check the link:
https://github.com/xamarin/xamarin-macios/blob/4a050c5ae67cf6cc1144af6a7f03707491b5c0a2/src/Security/Certificate.cs#L928

0 Votes 0 ·