I am trying to use cryptographic assets via CryptoTokenKit framework.
It's said in the documentation
When the framework copies an item from a token to the keychain, it records the associated token’s identifier, or token ID, as part of the keychain item.
I use the following query without even importing CryptoTokenKit:
let query: [String: Any] = [kSecClass as String: kSecClassIdentity,
kSecAttrKeyType as String: kSecAttrKeyTypeRSA,
kSecMatchLimit as String: kSecMatchLimitAll,
kSecReturnAttributes as String: kCFBooleanTrue,
kSecReturnData as String: kCFBooleanTrue,
kSecReturnRef as String: true]
var identity: AnyObject?
checkStatus(status: SecItemCopyMatching(query as CFDictionary, &identity))
And I am able to retrieve Identity, which is located on USB Token. However, I am facing problem with exporting of private key from USB Token.
CTK framework should copy items from Token to Keychain. What shall be done, to achieve this?