Hi,
when creating a CryptoTokenKit extension according to https://developer.apple.com/documentation/cryptotokenkit/authenticating-users-with-a-cryptographic-token, it is neccessary to register it under the securityagent in order to make the CTK usable before login. i.e. we want to run
sudo -u _securityagent /Applications/HostApp.app/Contents/MacOS/HostApp
However, even with the empty application the command fails with
illegal hardware instruction sudo -u _securityagent /Applications/HostApp.app/Contents/MacOS/HostApp
I see that it always crashes when the HostApp is sandboxed, but it does not work even without sandboxing (i am sharing the error report message below).
i actually noticed that when the HostApp is sandboxed and I run the above command, the extension starts to be usable even before login, even though i see the HostApp crash. The same does not happen without the sandbox
So I am curious how to in fact properly register the CTK extension under security agent? Also am not sure how to unregister it from the _securityagent
thank you for your help
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: Exited process [9395]
Responsible: Terminal [399]
User ID: 92
Date/Time: 2025-03-21 18:54:03.0684 +0100
OS Version: macOS 15.3.2 (24D81)
Report Version: 12
Bridge OS Version: 9.3 (22P3060)
Anonymous UUID: 41F9918C-5BCA-01C7-59C2-3E8CFC3F8653
Sleep/Wake UUID: 8AB66C75-3C32-41D4-9BD4-887B0FB468FE
Time Awake Since Boot: 4300 seconds
Time Since Wake: 1369 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: WMClientWindowManager
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process: exc handler [9396]
Application Specific Signatures:
API Misuse
Thread 0 Crashed:: Dispatch queue: WMClientWindowManager
0 libxpc.dylib 0x7ff80667b2bd _xpc_api_misuse + 113
1 libxpc.dylib 0x7ff80665f0e4 xpc_connection_set_target_uid + 187
2 WindowManagement 0x7ffd0b946693 -[WMClientWindowManager _createXPCConnection] + 1011
3 WindowManagement 0x7ffd0b947361 -[WMClientWindowManager _xpcConnection] + 65
4 WindowManagement 0x7ffd0b9447c9 __31-[WMClientWindowManager stages]_block_invoke + 41
5 libdispatch.dylib 0x7ff8067af7e2 _dispatch_client_callout + 8
6 libdispatch.dylib 0x7ff8067bca2c _dispatch_lane_barrier_sync_invoke_and_complete + 60
7 WindowManagement 0x7ffd0b9446fc -[WMClientWindowManager stages] + 268
8 AppKit 0x7ff80b1fd0b7 __54-[NSWMWindowCoordinator initializeStageFramesIfNeeded]_block_invoke + 30
9 libdispatch.dylib 0x7ff8067af7e2 _dispatch_client_callout + 8
10 libdispatch.dylib 0x7ff8067b0aa2 _dispatch_once_callout + 20
11 AppKit 0x7ff80b1fd060 -[NSWMWindowCoordinator initializeStageFramesIfNeeded] + 296
12 AppKit 0x7ff80a3b3701 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 888
13 AppKit 0x7ff80a3b2f77 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1222
14 AppKit 0x7ff80a3b2aa9 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
15 SwiftUI 0x7ff917f321e0 0x7ff91776f000 + 8139232
16 SwiftUI 0x7ff917a8e2f2 0x7ff91776f000 + 3273458
17 SwiftUI 0x7ff917bccfba 0x7ff91776f000 + 4579258
18 SwiftUI 0x7ff917f2ca8e 0x7ff91776f000 + 8116878
19 SwiftUI 0x7ff917f24a65 0x7ff91776f000 + 8084069
20 SwiftUI 0x7ff917f21540 0x7ff91776f000 + 8070464
21 SwiftUI 0x7ff91849e9f1 0x7ff91776f000 + 13826545
22 SwiftUICore 0x7ffb13103ea5 0x7ffb12c81000 + 4730533
23 SwiftUICore 0x7ffb13102e0f 0x7ffb12c81000 + 4726287
24 SwiftUI 0x7ff91849e903 0x7ff91776f000 + 13826307
25 SwiftUI 0x7ff91849bc1c 0x7ff91776f000 + 13814812
26 AppKit 0x7ff80a54f191 -[NSApplication _doOpenUntitled] + 422
27 AppKit 0x7ff80a4efc59 __58-[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:]_block_invoke + 237
28 AppKit 0x7ff80a963818 __102-[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:withFullFidelity:completionHandler:]_block_invoke + 101
29 AppKit 0x7ff80a4ef6fa __97-[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:]_block_invoke_3 + 148
30 AppKit 0x7ff80a4eee8f -[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:] + 635
31 AppKit 0x7ff80a96373d -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:withFullFidelity:completionHandler:] + 269
32 AppKit 0x7ff80a3a6259 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 529
33 AppKit 0x7ff80a3a5eb9 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 679
34 Foundation 0x7ff807a4b471 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 307
35 Foundation 0x7ff807a4b285 _NSAppleEventManagerGenericHandler + 80
36 AE 0x7ff80e0e4e95 0x7ff80e0da000 + 44693
37 AE 0x7ff80e0e4723 0x7ff80e0da000 + 42787
38 AE 0x7ff80e0de028 aeProcessAppleEvent + 409
39 HIToolbox 0x7ff81217b836 AEProcessAppleEvent + 55
40 AppKit 0x7ff80a39ee6a _DPSNextEvent + 1725
41 AppKit 0x7ff80adf38b8 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1290
42 AppKit 0x7ff80a38faa9 -[NSApplication run] + 610
43 AppKit 0x7ff80a362d34 NSApplicationMain + 823
44 SwiftUI 0x7ff9177a7da1 0x7ff91776f000 + 232865
45 SwiftUI 0x7ff917af0d40 0x7ff91776f000 + 3677504
46 SwiftUI 0x7ff917d8fef8 0x7ff91776f000 + 6426360
47 Crescendo CryptoTokenKit 0x10b1baf6e static HostApp.$main() + 30
48 Crescendo CryptoTokenKit 0x10b1bd2f9 main + 9 (HostApp.swift:24)
49 dyld 0x7ff8065c82cd start + 1805
Selecting any option will automatically load the page