I'm trying to use an Android smartcard emulator (to see if a smartcard can fit into my workflow) with GnuPG on Debian Sid.

I have libNFC configured with a pn532 breakout that can see the applet on the phone.
I have spent a literal hour googling this and turned up no relevant results other than "Android supports NFC OpenPGP smartcards!" and "Yubikey NEO supports NFC!"


From a GnuPG point of view, there is no difference between NFC and directly plugged smart cards. No matter whether you use a traditional smart card, a USB plug or NFC, in all cases the driver exposes the smart card through the PC/SC or CCID protocols.

What you need to make sure to use an NFC smart card with OpenPGP:

  • the NFC chip actually supports the OpenPGP smartcard protocol
  • the NFC driver exposes the card through the PC/SC or CCID interface
  • communication actually works -- NFC support in Linux is a little bit awkward, and your setup seems rather fragile, too
  • GnuPG picks up the smartcard through scdaemon

scdaemon usually is quite good at picking up available OpenPGP smart cards, but especially if multiple smart card readers are available, it might require some additional setup. man scdaemon provides some relevant information on how to setup and debug OpenPGP smart card issues; there is no general solution.

Anyway, start small and break up into smaller tasks: first make sure the NFC communication is actually working as expected with another, simpler application or some debug tools and then switch over to testing with the OpenPGP smartcard emulation.

  • NFC is indeed working via nfc-tools with a mifare classic, and it can detect the phone when the emulator is open. the problem is that scdaemon doesn't use libnfc readers without further setup (and the pn532 is UART, so no automatic detection) – BaconWaifu Jul 8 '17 at 12:24
  • uart is the protocol used for communication between libnfc and the card reader, not the protocol used for communication with the card. libnfc does not support PC/SC or CCID by default, you might be successfull adding the PSCS Relay from the Virtual Smart Card Architecture project. – Jens Erat Jul 8 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.