Beispiel #1
0
 public static void MifareTest()
 {
     using (var context = new NfcContext())
         using (var device = context.OpenDevice()) // Try to open the NFC reader
         {
             MifareClassic mfc = new MifareClassic(device);
             mfc.InitialDevice();
             mfc.SelectCard();
             mfc.Authentication(0, KeyType.KeyA, 0xFFFFFFFFFFFFu);
             var block0 = mfc.ReadBlock(0);
             Program.PrintHex(block0, 16);
             mfc.Authentication(1, KeyType.KeyA, 0xFFFFFFFFFFFFu);
             mfc.WriteBlock(4, new byte[16] {
                 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
             });
             var block4 = mfc.ReadBlock(4);
             Program.PrintHex(block4, 16);
             Console.ReadLine();
         }
 }