frankmorgner / OpenSCToken

Use OpenSC in macOS CryptoTokenKit.
GNU General Public License v3.0
76 stars 14 forks source link

Handle tokens that do not report a serial number #10

Closed michaelweiser closed 5 years ago

michaelweiser commented 5 years ago

At least one specific implementation of CardOS5 cards does not seem to report a serial number which makes OpenSCToken terminate with:

OpenSCToken: (CoreFoundation) Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' +[NSString stringWithUTF8String:]: NULL cString'

This change makes OpenSCToken work for these cards as well.

michaelweiser commented 5 years ago

thanks, looks good. However, please add the following check:

if (p15card->tokeninfo != NULL && p15card->tokeninfo->serial_number != NULL)

Done plus explanatory comment.

frankmorgner commented 5 years ago

thanks

akemnade commented 5 years ago

is related to

https://github.com/OpenSC/OpenSC/pull/1791