Yubikey 5 NFC generate OTP in Python with ACR122U

738 views Asked by At

For a project I'm currently working on I need to be able to read the new Yubikey 5 NFC keys and generate a Yubico OTP.

Earlier I've managed to get Yubikey NEO to work by using Pyscard library in Python and performing the 2 following APDU commands:

[0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x05, 0x27, 0x20, 0x01, 0x01]

[0x00, 0x02, 0x30, 0x00, 0x00]

This still works for Yubikey NEO, it gives me the public ID and One Time Password of the Yubikey.

However for Yubikey 5 this doesn't seem to work. Can anyone point me in the right direction?

I'm using Python on Windows/Mac with the ACR122u NFC/RFID reader via USB.

Edit:

With opensc-tool on MacOS I have identified the Yubikey 5 NFC to be a OpenPGP card v2.1 different from the Personal Identity Verification card (Yubikey NEO). the guide on https://g10code.com/docs/openpgp-card-2.1.pdf is not helping me further towards generating One Time Passwords.

0

There are 0 answers