swift - Read NFC (Mifare Classic 1K) with CryptoTokenKit -


i'm trying read/write milfare classic 1k nfc card (supplied factory) using acr122. can detect card, cannot communicate it.

i have been searching web days trying find kind of documentation on (without success).

i know these cards encrypted surely there default password or way reset card?

here's have far:

card.beginsessionwithreply { (result, error) -> void in          print("began card session: \(result) \(card.valid) \(card.currentprotocol)");           let aid : [uint8] = [0xff, 0x86, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x0, 0x00];          var data = nsdata(bytes: aid, length: aid.count)          card.transmitrequest(data, reply: { (data, error) -> void in             print("transmit: data: \(data) error \(error)");          })           data = "hi".datausingencoding(nsutf8stringencoding)!;          card.sendins(0xff, p1: 0x00, p2: 0x00, data: data, le: nil, reply: { (data, uint, error) -> void in             if let e = error {                if (e.code == tkerrorcode.corrupteddata.rawvalue) {                   print("corrupteddata");                } else {                   print("error code: \(error?.code)");                }             }             print("sendins: reply:\(data) int:\(uint) error:\(error)");          })       } 

output:

["acs acr122u"] card valid atr: <3b8f8001 804f0ca0 00000306 03000100 0000006a> began card session: true true tksmartcardprotocol(rawvalue: 2) error code: optional(-2) sendins: reply:nil int:0 error:optional(error domain=cryptotokenkit code=-2 "(null)") transmit: data: optional(<6300>) error nil 

any suggestions great (including os x software capable of reading/writing these cards).

i'm not sure cryptotokenkit i'm sure can use picc commands according acr122 application programming interface read/write mifare cards.

you have go through following steps.

  1. load authentication keys reader. enter image description here

  2. do authentication.

you need provide set of blocks read , provide authentication key those. more info on memory structure of mifare classic 1k please refer datasheet here.

enter image description here

then can issue read , write apdu commands (can found of acr 122 api documentation). cheers!


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -