microg / microg/GmsCore

Consider using chained APDUs instead of extended APDUs for CTAP2/NFC

Open
#1,809 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🔐 FIDO / WebAuthN / Passkeys enhancement
Dominant language
Java
Stars
14.6k
Forks
3.2k
Avg merge
12d 11h
Merged PRs (30d)
4

Description

The CTAP2 transport specification for NFC allows two different encodings for long (fragmented) requests and responses: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#nfc-fragmentation .

Extended APDUs are simpler to implement, however not all hardware (smartphones) supports these very large (~1KB) commands, some chipsets (e.g NXP PN532) are limited to 255 bytes. See also https://github.com/DangerousThings/flexsecure-applets/blob/master/docs/4-android.md#maximum-nfc-transceive-length , https://github.com/NXPNFCLinux/linux_libnfc-nci/issues/116 .

I suggest checking the chipset capabilities using IsoDep.getMaxTransceiveLength (https://developer.android.com/reference/android/nfc/tech/IsoDep#getMaxTransceiveLength()) before attemting so send extended APDUs, and fall back to chained APDUs otherwise.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the CTAP2 NFC fragmentation specification and Android's IsoDep.getMaxTransceiveLength() API. Locate the NFC transport implementation in the repository, then verify that the available transceive length is checked before extended APDUs are used and that chained APDUs handle smaller limits. Done means long requests and responses work on hardware limited to 255 bytes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
authentication, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.