CryptoTokenKit

I am building a MAC app using crypto token. I have previously done this successfully for iPhone.

In iPhone we found if something crashed on the token session while performing a sign (meaning the function wasn't able to return a value) the token or the keychain freezes and stopped returning keychain items at the query for keychain items it will return status 0. The only way to solve this was to reboot the iphone.

In Mac something similar is happening, a crash at internet connection level made the extension get stuck and now event after restarting the mac it does not allow connection

this query let query: [String:Any] = [kSecAttrAccessGroup as String: kSecAttrAccessGroupToken, kSecAttrKeyClass as String : kSecAttrKeyClassPrivate,kSecClass as String : kSecClassIdentity, kSecReturnAttributes as String : kCFBooleanTrue as Any, kSecReturnRef as String: kCFBooleanTrue as Any, kSecMatchLimit as String: kSecMatchLimitAll, kSecReturnPersistentRef as String: kCFBooleanTrue as Any]

let status = SecItemCopyMatching(query as CFDictionary, &item) print("Status: (status.description)")

This generates:

Unable to connect to com.intereidas.dniMac.mac.TKExt:DniMac even after retries.

Status: 0

Found items: 0

This does not get fixed after mac restart, how can we make the token extension work again?

In Mac something similar is happening, a crash at internet connection level

What do you mean by “internet connection level” here? Is that just a subsystem within your appex? So, your appex is crashing due to a bug in your networking code?

the extension get stuck and now event after restarting the mac it does not allow connection

Is it actually launching your CTK appex process? If you monitor the system log for log messages coming from your process name, do you see any generated?

For hints and tips related to the system log, see Your Friend the System Log.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

HEllo, sorry for the misunderstanding on the info.

The case is everything was working fine.

I have this fucniton in the tokensession

func tokenSession(_ session: TKTokenSession, sign dataToSign: Data, keyObjectID: Any, algorithm: TKTokenKeyAlgorithm) throws -> Data {

///DO SOMe PROCESS

return Data() }

Everythin was working fine but while testing resolving a challenge from a website my mac lost connection and this function was not able to arrive to return data() This causes the token extension to not run again properly. This had happened to me on an ios device. After reboot al comes back to normal.

In the mac,t his is not the case. The tkExtension does come up on the process. I have attached the logs in ther eI found this line,

com.intereidas.dniMac.mac.TKExt:DniMac, error: Error Domain=CryptoTokenKit Code=-7 "(null)"

I guess there resides the issue but as mentioned before in ios gets fixed after rebooting not on mac.

CryptoTokenKit
 
 
Q