Yubico / yubikit-android

Yubico Mobile Android SDK - YubiKit
Apache License 2.0
108 stars 40 forks source link

Is NFC device a Yubico key? #78

Closed AdamVe closed 1 year ago

AdamVe commented 1 year ago

It is simple to verify that a USB device is known YubiKey by comparing the USB PID values. Because this is a bit more complicated for NFC devices, this PR adds two different methods which clients can use to verify that the NFC connection was created by YubiKey.

  1. DeviceUtil.readInfo(YubiKeyConnection connection, UsbPid) will throw UnknownKeyException if the device connected through connection is not manufactured by Yubico. To use this method, one needs to add dependency to the :support module which might not be ideal.
  2. bool NfcYubiKeyDevice.isYubiKey() will return true if the device is manufactured by Yubico. The disadvantage of this method is that it opens several sessions (Management and YubiOTP) on the NFC device, which might degrade the performance if used every time when a NFC connection is observed.