Post

Replies

Boosts

Views

Activity

CryptoTokenKit framework usage
Hi, I’m currently working on an app that uses a third-party SDK to perform smart card authentication via PKCS#11 APIs. Specifically, the app interacts with the smart card to retrieve certificates, detect the card reader, and perform encryption and decryption operations on provided data. I’m wondering if it's possible to replace the PKCS#11 APIs and the third-party SDK with Apple's CryptoTokenKit framework. Does CryptoTokenKit provide equivalent functionality for smart card authentication, certificate management, and encryption/decryption operations? Additionally, I’ve come across the following CryptoTokenKit documentation: CryptoTokenKit API - TKSmartCardSlotManager Could you provide an example code or any guidance on how to implement this functionality using CryptoTokenKit, particularly for interacting with smart cards, managing certificates, and performing cryptographic operations? Thank you for your assistance.
3
0
235
2w
How to resolve - unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0
I am trying to replace the deprecated unarchiveObjectWithData API with unarchivedObjectOfClass. My class looks something like this Class B:<<NSSecureCoding> { +(BOOL)supportsSecureCoding { return YES; } } Class C <<NSSecureCoding> { property of class B; + (BOOL)supportsSecureCoding { return YES; } } Class A<<NSSecureCoding> { property of class B property of class c (BOOL)supportsSecureCoding { return YES; } } Tried solutions: Option 1: Archive code NSData *archiveData = [NSKeyedArchiver archivedDataWithRootObject:(array of objects of type A) requiringSecureCoding:YES error:&error]; // Encrypting archiveData and writing to file Unarchive code // fetching data from file // decrypting it NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; NSKeyedUnarchiver *unArchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:decryptedData error:&error]; [unArchiver setRequiresSecureCoding:YES]; array of objects of Type A = [unArchiver decodeObjectOfClasses:classesSet forKey:NSKeyedArchiveRootObjectKey]; Issue: Unable to unarchive all the properties. Properties have nil values including properties of type NSString, BOOL, custom class Option: 2 Use +unarchivedObjectOfClass:fromData:error Unarchive code: NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; array of objects of Type A = [NSKeyedUnarchiver unarchivedObjectOfClasses:classesSet fromData:storeData error:&error] Issue: "UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'Class B'. Allowed classes are '{NSMutable Array}" Can someone please assist with this issue. I have tried all the available solutions online. I couldn't find a documentation from Apple on how to consume the new API in a correct way.
2
0
1.1k
Jul ’23
unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0 - Use +unarchivedObjectOfClass:fromData:error: instead
I am trying to replace the deprecated unarchiveObjectWithData API with unarchivedObjectOfClass. My class looks something like this Class B:< { (BOOL)supportsSecureCoding { return YES; } } Class C < { property of class B; (BOOL)supportsSecureCoding { return YES; } } Class A< { property of class B property of class c (BOOL)supportsSecureCoding { return YES; } } Tried solutions: Archive code NSData *archiveData = [NSKeyedArchiver archivedDataWithRootObject:(array of objects of type A) requiringSecureCoding:YES error:&error]; // Encrypting archiveData and writing to file Unarchive code // fetching data from file // decrypting it NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; NSKeyedUnarchiver *unArchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:decryptedData error:&error]; [unArchiver setRequiresSecureCoding:YES]; array of objects of Type A = [unArchiver decodeObjectOfClasses:classesSet forKey:NSKeyedArchiveRootObjectKey]; Issue: Unable to unarchive all the properties. Properties have nil values including properties of type NSString, BOOL, custom class Use +unarchivedObjectOfClass:fromData:error Unarchive code: NSSet *classesSet = [NSSet setWithObjects: [NSMutableArray classForCoder], [A classForCoder], [NSString classForCoder], [NSNumber classForCoder], [B classForCoder], [C classForCoder] , nil]; array of objects of Type A = [NSKeyedUnarchiver unarchivedObjectOfClasses:classesSet fromData:storeData error:&error] Issue: "UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'Class B'. Allowed classes are '{NSMutable Array}" Can someone please assist with this issue. I have tried all the available solutions online. I couldn't find a documentation from Apple on how to consume the new API in a correct way.
2
0
1.2k
Jul ’23
Need help in implementing the smart card based authentication in an iOS app
Hi, I am trying to implement an app which performs cert based authentication through smart card. I have few queries related to the same I have included com.apple.token in the key chain accessory group. I am able to fetch the certificates from the keychain using Yubi key Type c. But this is not working for Yubi key lighting port. Does Apple support lighting port readers? What is the need of crypto token kit extension if we are able to list the certificates from key chain just by adding com.apple.token in the entitlements file.
1
0
1.1k
Jun ’23