Yubico / yubikit-ios

Yubico Mobile iOS SDK - YubiKit
Apache License 2.0
198 stars 44 forks source link

YubiKitDeviceCapabilities returns supportsMFIAcessoryKey on iPad w/ USB-C #50

Closed Ken-CA closed 3 years ago

Ken-CA commented 4 years ago

On the new iPad Pro devices, apple has swapped out the lightning port for a USB-C connection and (as indicated in the YK docs) only limited support is provided for using the keys. Key reading and decryption appear to work fine, however accessorySession support appears to be non-functional. This is expected as it appears iADP2 is not supported by Apple over USB-C.

When using the iOS library on the iPad w/ USB-C, the call to YubiKitDeviceCapabilities.supportsMFIAccessoryKey returns YES and the call to [YubiKitManager.shared.accessorySession startSession] also works. The problem is that since iADP2 is not supported, the subsequent call to perform KVO on accessorySession fails to notify the app when the session state changes (i.e. connects or disconnects). Again, this is expected as I would imagine the iOS library has no way to know the key is present or not.

What would be more useful is to have the call to YubiKitDeviceCapabilities.supportsMFIAccessoryKey return NO for iPads (and other devices) that do not actually support the MFI protocol. On can then use this to skip over the startSession and closeSession calls to track session state. Without this change, it is necessary to add code in client applications that checks the iPad type...which is less than optimal.

Ken-CA commented 4 years ago

Adding to the above, I took a look at the iOS SDK code for 3.1.0 and the following code is provided in the device additions (UIDeviceAdditions.m) code:

if ([self ykf_deviceName:deviceName isInList:@[@"iPad8,1", @"iPad8,2", @"iPad8,3", @"iPad8,4", @"iPad8,5", @"iPad8,6", @"iPad8,7", @"iPad8,8"]]) {
        return YKFDeviceModelIPadPro3;
    }

Which correctly identified Gen3 models. There currently is no similar line for Gen4 iPads. The above code results in the capabilities check returning the correct value of NO.

Ken-CA commented 4 years ago

Basically, the following additional devices should be added to the capability check, return NO for support of the accessory protocol:

iPad8,9 : iPad Pro 11 inch 2nd Gen (WiFi)
iPad8,10 : iPad Pro 11 inch 2nd Gen (WiFi+Cellular)
iPad8,11 : iPad Pro 12.9 inch 4th Gen (WiFi)
iPad8,12 : iPad Pro 12.9 inch 4th Gen (WiFi+Cellular)
mtamburro commented 3 years ago

Hi-- It's new device time again. The new iPad Air devices have USB-C: iPad 13,1 iPad 13,2.