Skip to content

OTP calculateHmacSha1 requiring touch doesn't work after requesting device info #98

@jefftharris

Description

@jefftharris

Upon insertion of a USB Yubikey, I am attempting to read device info such as serial number and then compute an HMAC-SHA1. The device info reads successfully, but the YubiOtpSession.calculateHmacSha1 doesn't seem to notice that the key needs a touch. The call fails with a CommandRejectedException with messsage "No data". If I do not read the device info, the calculateHmacSha1 call properly waits for the key touch. If I use NFC, I can both read the device info and calculate the HMAC-SHA1 with a single press of the key (YubiKey NEO).

To retrieve the device info, I am following the code from the Android demo app in the com.yubico.yubikit.android.app.ui.management.ManagementViewModel.readDeviceInfo method. It checks for various connection types and uses the DeviceUtil.readInfo method to read the data.

Logging for the failed calculateHmacSha1 call. The feature report never returns a tailing 89 value indicating the need for a touch.

14:22:03.325 YubikeyMgr                      D  YubiKey log: Creating new CachedOtpConnection
14:22:03.349 YubikeyMgr                      D  YubiKey log: USB connection opened: com.yubico.yubikit.android.transport.usb.connection.UsbOtpConnection@19a7ab9
14:22:03.352 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.355 YubikeyMgr                      D  YubiKey log: Sending payload over HID to slot 0x12: 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 00 00 00 00 00 00 00 00 00 00 00 00 00 
14:22:03.355 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.356 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.357 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 80 
14:22:03.359 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.359 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 81 
14:22:03.362 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.362 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 82 
14:22:03.368 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.368 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 83 
14:22:03.371 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.372 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 84 
14:22:03.373 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.374 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 85 
14:22:03.375 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.376 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 86 
14:22:03.377 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.378 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 00 00 00 00 00 87 
14:22:03.380 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.380 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 12 b5 d6 00 00 00 89 
14:22:03.382 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.383 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.386 YubikeyMgr                      D  YubiKey log: Sending payload over HID to slot 0x38: 74 00 65 00 73 00 74 00 31 00 32 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
14:22:03.391 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.392 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.392 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 74 00 65 00 73 00 74 80 
14:22:03.394 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.395 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 31 00 32 00 33 00 81 
14:22:03.396 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.397 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 38 d0 9c 00 00 00 89 
14:22:03.398 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:22:03.413 UsbDeviceConnectionJNI          D  close
14:22:03.413 YubikeyMgr                      D  YubiKey log: USB connection closed: com.yubico.yubikit.android.transport.usb.connection.UsbOtpConnection@19a7ab9

Logging for the successful calculateHmacSha1 call without the debug info. The read report with the trailing 89 value is present indicating (I believe) touch is required.

14:01:55.110 YubikeyMgr                      I  Use YubiKey com.yubico.yubikit.android.transport.usb.UsbYubiKeyDevice@2f6fdb
14:01:55.112 YubikeyMgr                      D  YubiKey log: Creating new CachedOtpConnection
14:01:55.144 YubikeyMgr                      D  YubiKey log: USB connection opened: com.yubico.yubikit.android.transport.usb.connection.UsbOtpConnection@c0577aa
14:01:55.146 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.155 YubikeyMgr                      D  YubiKey log: Sending payload over HID to slot 0x12: 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 00 00 00 00 00 00 00 00 00 00 00 00 00 
14:01:55.159 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.164 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.164 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 80 
14:01:55.174 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.174 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 81 
14:01:55.176 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.177 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 82 
14:01:55.179 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.183 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 83 
14:01:55.185 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.185 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 84 
14:01:55.190 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.192 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 85 
14:01:55.194 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.195 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 63 63 63 63 63 86 
14:01:55.197 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.198 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 63 63 00 00 00 00 00 87 
14:01:55.200 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.201 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 12 b5 d6 00 00 00 89 
14:01:55.206 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 89 
14:01:55.228 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.244 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.252 YubikeyMgr                      D  YubiKey log: Sending payload over HID to slot 0x38: 74 00 65 00 73 00 74 00 31 00 32 00 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
14:01:55.259 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.260 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.261 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 74 00 65 00 73 00 74 80 
14:01:55.265 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.266 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 31 00 32 00 33 00 81 
14:01:55.268 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 00 
14:01:55.268 YubikeyMgr                      D  YubiKey log: WRITE FEATURE REPORT: 00 38 d0 9c 00 00 00 89 
14:01:55.276 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 89 
14:01:55.297 YubikeyMgr                      D  YubiKey log: READ FEATURE REPORT: 00 03 02 00 03 07 05 af 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions