<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=26&amp;t=1106" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2013-11-13T03:49:30+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=26&amp;t=1106</id>
<entry>
<author><name><![CDATA[Jansen]]></name></author>
<updated>2013-11-13T03:49:30+01:00</updated>
<published>2013-11-13T03:49:30+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4609#p4609</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4609#p4609"/>
<title type="html"><![CDATA[Re: [QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4609#p4609"><![CDATA[
Hi hiviah,<br /><br />wow, i'm impressed. Sorry for my late answer. I did not have much time for this project lately and forgot to subscribe to this thread <img src="https://forum.yubico.com/images/smilies/icon_e_sad.gif" alt=":(" title="Sad" />. But soon there will be more free time in which i can try your tips.<br /><br />Thanks again, Jan<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2493">Jansen</a> — Wed Nov 13, 2013 3:49 am</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hiviah]]></name></author>
<updated>2013-08-22T17:01:01+01:00</updated>
<published>2013-08-22T17:01:01+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4293#p4293</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4293#p4293"/>
<title type="html"><![CDATA[Re: [QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4293#p4293"><![CDATA[
I think I've finally found a way to do it with libnfc, namely libnfc's <em>pn53x-tamashell</em> scripting tool to send APDUs via low-level commands to PN532. Here's an equivalent of sending two APDUs &quot;00 A4 04 00 07 A0 00 00 05 27 20 01&quot; and &quot;00 01 38 00 09 53 61 6D 70 6C 65 20 23 32&quot;. These two APDUs first select AID A0 00 00 05 27 20 01, then invoke HMAC-SHA functionality that I configured on slot 2:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">#poll for card until one is present in reader's field<br />4a  01  00  <br />#send APDU to select AID A0 00 00 05 27 20 01<br />40 01 00 A4 04 00 07 A0 00 00 05 27 20 01<br />#send APDU to compute HMAC-SHA1 on slot 2, data is 9-bytes long string 53 61 6D 70 6C 65 20 23 32 (&quot;Sample #2&quot; in ASCII)<br />40 01 00 01 38 00 09 53 61 6D 70 6C 65 20 23 32<br /></div><br /><br />Actual response below, &quot;UU ... UU&quot; is where UID is, &quot;xx xx ... xx&quot; is where the HMAC-SHA response is, &quot;90 00&quot; in Rx are ISO-7816 return SW codes meaning &quot;OK&quot;:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$ pn53x-tamashell read-yubikey-hmac-slot-2.tamashell <br />NFC reader: pn532_spi:/dev/spidev0.0 opened<br />&gt; #poll for card until one is present in reader's field<br />&gt; 4a  01  00<br />Tx: 4a  01  00  <br />Rx: 01  01  00  44  28  07  UU  UU  UU  UU  UU  UU  UU  11  78  f7  b1  02  59  75  62  69  6b  65  79  4e  45  4f  72  33  <br />&gt; #send APDU to select AID A0 00 00 05 27 20 01<br />&gt; 40 01 00 A4 04 00 07 A0 00 00 05 27 20 01<br />Tx: 40  01  00  a4  04  00  07  a0  00  00  05  27  20  01  <br />Rx: 00  03  01  00  03  87  07  02  00  00  00  90  00  <br />&gt; #send APDU to compute HMAC-SHA1 on slot 2<br />&gt; 40 01 00 01 38 00 09 53 61 6D 70 6C 65 20 23 32<br />Tx: 40  01  00  01  38  00  09  53  61  6d  70  6c  65  20  23  32  <br />Rx: 00  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  xx  90  00  <br />&gt; <br />&gt; Bye!<br /></div><br /><br />Similarly, the tamashell code for sending the APDUs for reading NFC NDEF Type 4 message would be (I didn't test it as I reprogrammed my Yubikey):<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">#poll for card until one is present in reader's field<br />4a  01  00  <br />#send APDU to select AID D2 76 00 00 85 01 01 00<br />40 01 00 A4 04 00 07 D2 76 00 00 85 01 01 00<br /># select file E104 where the NFC NDEF message usually is - check capability container in E103 for actual location!<br />40 01 00 A4 00 0C 02 E1 04<br />#use APDU INS B0 to read the message<br />40 01 00 B0 00 00 00<br /></div><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2457">hiviah</a> — Thu Aug 22, 2013 5:01 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hiviah]]></name></author>
<updated>2013-08-06T16:39:20+01:00</updated>
<published>2013-08-06T16:39:20+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4210#p4210</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4210#p4210"/>
<title type="html"><![CDATA[Re: [QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4210#p4210"><![CDATA[
<div class="quotetitle">Jansen wrote:</div><div class="quotecontent"><br />I've asked Identive for the pcsc driver (I'm unable to find it on their website.).<br /></div><br /><br />I have two readers that are known to be working with pcsc: Omnikey Cardman 5321 (you need IFD driver downloaded from HID site for the RFID part, even for Linux, though) and ACR122T. The ACR122T reader has also PN532 chip usable with libnfc, but also works with pcsc and OpenSC (no extra drivers necessary in Linux).<br /><br /><div class="quotetitle">Jansen wrote:</div><div class="quotecontent"><br />Rfidiot seems to work with libnfc, but also fails<br /></div><br /><br />I've found out the same thing, RFIDIOt doesn't work for sending APDUs with &quot;-R READER_LIBNFC&quot; reader, only with the default &quot;-R READER_PCSC&quot;. I guess it's because RFIDIOt is so old, APDU sending might only work with some ancient libnfc version.<br /><br />If you find a solution on how to send the APDU with libnfc, please post it. I haven't been able to find a working example either. This one thread gets quite close, but not sure if it works yet: <!-- m --><a class="postlink" href="http://www.libnfc.org/community/topic/977/sending-apdus/">http://www.libnfc.org/community/topic/9 ... ing-apdus/</a><!-- m --><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2457">hiviah</a> — Tue Aug 06, 2013 4:39 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jansen]]></name></author>
<updated>2013-07-11T18:20:55+01:00</updated>
<published>2013-07-11T18:20:55+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4132#p4132</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4132#p4132"/>
<title type="html"><![CDATA[Re: [QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4132#p4132"><![CDATA[
Hi hiviah, thanks for your answer.<br /><br />Sadly, I'm still struggling to receive the ndef message. <br />I cannot get opensc to work, because libpcsc-lite does not seem to support my reader.<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">00000008 configfile.l:298:DBGetReaderList() Parsing conf file: /etc/reader.conf.d/libccidtwin<br />00000088 readerfactory.c:978:RFInitializeReader() Attempting startup of ADRB 00 00 using /usr/lib/pcsc/drivers/serial/libccidtwin.so<br />00000078 readerfactory.c:868:RFBindFunctions() Loading IFD Handler 3.0<br />00000029 ifdhandler.c:1840:init_driver() Driver version: 1.4.9<br />00000486 ifdhandler.c:1857:init_driver() LogLevel: 0x0003<br />00000008 ifdhandler.c:1868:init_driver() DriverOptions: 0x0000<br />00000089 ifdhandler.c:83:CreateChannelByNameOrChannel() Lun: 0, device: /dev/ttyUSB0<br />00001413 ccid_serial.c:744:OpenSerialByName() Set serial port baudrate to 115200 and correct configuration<br />00001751 ccid_serial.c:252:ReadSerial() Got 0x00<br />00000009 ccid_serial.c:767:OpenSerialByName() Get firmware failed. Maybe the reader is not connected<br />00000363 ifdhandler.c:117:CreateChannelByNameOrChannel() failed<br />00000011 readerfactory.c:1009:RFInitializeReader() Open Port 0x0 Failed (/dev/ttyUSB0)<br />00000005 readerfactory.c:312:RFAddReader() ADRB init failed.<br />00000011 readerfactory.c:529:RFRemoveReader() UnrefReader() count was: 1<br />00000006 readerfactory.c:1029:RFUnInitializeReader() Attempting shutdown of ADRB 00 00.<br />00000004 readerfactory.c:905:RFUnloadReader() Unloading reader driver.<br />00000034 pcscdaemon.c:525:main() pcsc-lite 1.8.6 daemon ready.<br /></div><br />I've asked Identive for the pcsc driver (I'm unable to find it on their website.).<br /><br />Rfidiot seems to work with libnfc, but also fails<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$ rfidiot-cli.py -d -R READER_LIBNFC apdu 00 a4 04 00 07 &quot;D2760000850101&quot; &quot;00&quot; apdu 00 a4 00 0c 02 &quot;E104&quot; &quot;&quot; apdu 00 b0 00 00 &quot;&quot; &quot;&quot; 00<br />*** Warning - no pyscard installed or pcscd not running<br />2013-07-11 19:13:04,356: DEBUG - Loading libnfc.so.4<br />2013-07-11 19:13:04,357: DEBUG - libnfc libnfc-1.7.0-rc7-39-g18fe330<br />2013-07-11 19:13:04,357: DEBUG - NFC Readers:<br />LibNFC ver libnfc-1.7.0-rc7-39-g18fe330 devices (1):<br />    No: 0               arygon:/dev/ttyUSB0 00V6.6<br />2013-07-11 19:13:04,609: DEBUG - Connecting to NFC reader number: None<br />2013-07-11 19:13:04,725: DEBUG - Opened NFC reader arygon:/dev/ttyUSB0 00V6.6<br />2013-07-11 19:13:04,726: DEBUG - Initing NFC reader<br />2013-07-11 19:13:04,893: DEBUG - Configuring NFC reader<br /><br />rfidiot-cli v0.1 (using RFIDIOt v1.0e)<br />2013-07-11 19:13:05,153: DEBUG - Powered down field<br />2013-07-11 19:13:05,183: DEBUG - Powered up field<br />  Reader: LibNFC arygon:/dev/ttyUSB0 00V6.6<br /><br /><br />  Sending APDU: 00A4040007D276000085010100<br /><br />In send_apdu - for libnfc: 00A4040007D276000085010100<br />2013-07-11 19:13:05,183: DEBUG - Sending 13 byte APDU: 00a4040007d276000085010100<br />2013-07-11 19:13:05,226: DEBUG - APDU rxlen = -2<br />2013-07-11 19:13:05,226: ERROR - Error sending/receiving APDU<br />Traceback (most recent call last):<br />  File &quot;/usr/local/bin/rfidiot-cli.py&quot;, line 155, in &lt;module&gt;<br />    if card.send_apdu('','','','',cla,ins,p1,p2,lc,data,le):<br />  File &quot;/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py&quot;, line 1466, in send_apdu<br />    self.data = result&#91;0:-4&#93;<br />TypeError: 'int' object has no attribute '__getitem__'<br />2013-07-11 19:13:05,229: DEBUG - Deconfiguring NFC reader<br />2013-07-11 19:13:05,289: DEBUG - Disconnected NFC reader<br /></div><br /><br />So i tried to 'manually' send the apus with libnfc's &quot;nfc_initiator_transceive_bytes&quot;, because the manual says &quot;The contact-less (NFC) mode of operation is automatically enabled when the device is not plugged into the USB port. In NFC mode, the device exposes a ISO14443A interface, supporting the ISO14443-4 (T=CL) protocol. The command set is identical to the CCID mode of operation.&quot; Should this work?<br /><br />Unitl now, I have had no success, but I'm working on it.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2493">Jansen</a> — Thu Jul 11, 2013 6:20 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[hiviah]]></name></author>
<updated>2013-07-10T16:54:23+01:00</updated>
<published>2013-07-10T16:54:23+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4130#p4130</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4130#p4130"/>
<title type="html"><![CDATA[Re: [QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4130#p4130"><![CDATA[
If the reader is supported by pcsc-lite (which seems it is according to quick search), you could use opensc-tool from <a href="https://github.com/OpenSC/OpenSC" class="postlink">OpenSC</a> or rfidiot-cli from <a href="http://rfidiot.org/" class="postlink">RFIDIOt</a> by sending APDUs to Neo.<br /><br />Example:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">opensc-tool -s &quot;00 A4 04 00 07 D2 76 00 00 85 01 01 00&quot; -s &quot;00 A4 00 0C 02 E1 04&quot; -s &quot;00 B0 00 00 00&quot;</div><br /><br />First APDU selects the NDEF application, second APDU selects the file 0xE104 which contains NDEF message, third APDU reads it. Use something like python's  nfc.ndef to parse the returned message (note that the message is prefixed with two length bytes, which need to be stripped).<br /><br />Alternatively via RFIDIOt:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">./rfidiot-cli.py -r 1 apdu 00 a4 04 00 07 &quot;D2760000850101&quot; &quot;00&quot; apdu 00 a4 00 0c 02 &quot;E104&quot; &quot;&quot; apdu 00 b0 00 00 &quot;&quot; &quot;&quot; 00</div><br /><br />Note that correctly you should first read the location of the NDEF message from Capability Container (file 0xE103), see <a href="http://apps4android.org/nfc-specifications/NFCForum-TS-Type-4-Tag_2.0.pdf" class="postlink">NDEF Tag Type 4 docs</a>.<br /><br />You can read the Capability Container using these APDUs, parse according to docs:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">./rfidiot-cli.py -r 1 apdu 00 a4 04 00 07 &quot;D2760000850101&quot; &quot;00&quot; apdu 00 a4 00 0c 02 &quot;E103&quot; &quot;&quot; apdu 00 b0 00 00 &quot;&quot; &quot;&quot; 00</div><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2457">hiviah</a> — Wed Jul 10, 2013 4:54 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jansen]]></name></author>
<updated>2013-07-09T17:17:46+01:00</updated>
<published>2013-07-09T17:17:46+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4127#p4127</id>
<link href="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4127#p4127"/>
<title type="html"><![CDATA[[QUESTION] Reading Yubikey NEO ndef message with libnfc]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=1106&amp;p=4127#p4127"><![CDATA[
Hi, <br /><br />for a little project I need to read the yubikey OTP via a NFC reader (identive <a href="http://www.identive-group.com/de/products-and-solutions/identification-products/desktop-readers-terminals/rfid-desktop-readers/adrb-nfc-reader-writer" class="postlink">ADRB</a>). But I am a little confused about what kind of nfc device the yubikey neo is.<br /><br />The <a href="https://www.yubico.com/products/yubikey-hardware/yubikey-neo/" class="postlink">Website</a> says: &quot;Mobile authentication through NFC contactless technology (NDEF type 4)&quot;.<br />The <a href="http://www.yubico.com/wp-content/uploads/2013/04/YubiKey-Manual-v3_1.pdf" class="postlink">Yubkey Manual [p.39]</a> says: &quot;The NEO emulates a 'Type 4' tag and NFC interrogators that supports this type can get a 'tapand-go' experience.&quot;<br />The <a href="http://forum.yubico.com/viewtopic.php?f=4&amp;t=765" class="postlink">Forum</a> says: &quot;The Yubikey NEO emulates a NDEF type 2 tag, i.e. a NFC interogator which scans it think it is a 'smart poster'.&quot;<br /><br />My ideas: <br />NFC Tag Type is either 2 or 4, which means &quot;Mifare Ultralight&quot; or &quot;NXP DESFire&quot;<br />NDEF Type is either 2 or 4, don't know what that means (I know what NDEF is)...<br /><br />So far I am stuck after the first message exchange:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">$ nfc-poll <br /><br />nfc-poll uses libnfc libnfc-1.7.0-rc7-39-g18fe330<br />NFC reader: arygon:/dev/ttyUSB0 00V6.6 opened<br />NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)<br />ISO/IEC 14443A (106 kbps) target:<br />    ATQA (SENS_RES): 00  44  <br />       UID (NFCID1): 04  3c  4e  de  a5  2f  80  <br />      SAK (SEL_RES): 28  <br />                ATS: 78  f7  b1  02  59  75  62  69  6b  65  79  4e  45  4f  72  33  <br /></div><br />(I have altered my UID.)<br /><br />Some hints/push in the right direction would be very useful.<br /><br />Thanks in advance,<br />Jan<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=2493">Jansen</a> — Tue Jul 09, 2013 5:17 pm</p><hr />
]]></content>
</entry>
</feed>