Home › Forums › Ask the Flomies › Error Domain=FlomioSDK Code=-3
Tagged: APDU, BinaryBlock, Error, Mifare, MifareClassic1K, ReadData
-
AuthorPosts
-
March 3, 2017 at 7:28 am #58898
Hi,
I am trying to read data within Sector 15 of a Mifare 1K chip, I have loaded into volatile memory the Key_A and authorised access to the sector.. however when attempting to read the block I recieve a error response APDU (63 00).
The console shows that this error is error = Error Domain=FlomioSDK Code=-3 “Operation was unsuccessful.” UserInfo={NSLocalizedFailureReason=State of non-volatile memory has changed
Are there any suggestions to try and resolve this?
For reference here are the commands sent to the Chips
Command Apdu sent: FF CA 00 00 00
Command Apdu sent: FF 82 00 00 06 C7 35 72 19 F2 03
Command Apdu sent: FF 86 00 00 05 01 00 3F 60 00
Command Apdu sent: FF B0 00 00 10
1. Get UUID
2. Load Authentication Key (C7 35 72 19 F2 03)
3. Authorise Block (Block 1) (Key Type_A) (Location 00)
4. Read Binary Block (Block 1) (Read 16 Bytes)2017-03-03 12:20:13.851349 NFC Test[522:103472] MyTest Read Binary Block (00 ), for length (10 ). Mutable String = FF B0 00 00 10 2017-03-03 12:20:13.863304 NFC Test[522:103510] Command Apdu sent: FF B0 00 00 10 2017-03-03 12:20:14.025251 NFC Test[522:103545] in didSendPiccResponseApdu 2017-03-03 12:20:14.025489 NFC Test[522:103545] Response Apdu: 63 00 2017-03-03 12:20:14.037504 NFC Test[522:103565] timer running on <NSThread: 0x165cc5b0>{number = 7, name = (null)} thread 2017-03-03 12:20:14.037651 NFC Test[522:103565] sourceTimer Fired 2017-03-03 12:20:14.037683 NFC Test[522:103472] MyTest foundTagWithData - payload = (null), deviceID = 40EEEE5302FD2924, ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A, error = Error Domain=FlomioSDK Code=-3 "Operation was unsuccessful." UserInfo={NSLocalizedFailureReason=State of non-volatile memory has changed, NSLocalizedRecoverySuggestion=No information given, NSLocalizedDescription=Operation was unsuccessful.}
March 3, 2017 at 10:33 am #58901Hey Reese,
A few questions for you. What SDK version are you using? What reader are you using? I will replicate the issue and see what’s the cause.
Kind Regards,
ScottMarch 3, 2017 at 10:48 am #58902Hi Scott,
I am using SDK v2.2
Reader is the ACR35 (kFlojackMsr)Thanks
ReeceMarch 3, 2017 at 10:57 am #58904Thanks for the reply. Will be back to you either today or early next week with my findings.
Kind Regards,
ScottMarch 7, 2017 at 6:51 am #58919Hi Scott,
Thank you for looking into this, still trying various different APDU variants to authrosie and read data (Full console log included)
In paticular I would like to highlight
2017-03-07 10:26:38.855632 NFC Test[232:10104] Command Apdu sent: FF 86 00 00 05 01 00 3C 60 00 2017-03-07 10:26:39.062394 NFC Test[232:10139] in didSendPiccResponseApdu 2017-03-07 10:26:39.063093 NFC Test[232:10139] Response Apdu: 90 00
This shows that the response is successful to authenticating block 00 of Sector 15 (3C) for reading of data.
However upon then trying to read data it still returns the error in question.
2017-03-07 10:27:00.104953 NFC Test[232:10104] Command Apdu sent: FF B0 00 00 10 2017-03-07 10:27:00.268380 NFC Test[232:10104] in didSendPiccResponseApdu 2017-03-07 10:27:00.269072 NFC Test[232:10104] Response Apdu: 63 00
Hopefully this will provide more insight into the error to help resolve this. I am at this point not sure if it is the format of APDU, the card I’m using, the card reader, or the SDK
Again for reference this is what I’m using:
– Flomio FloJackv2 (ACR35)
– ACR3x Reference manual for APDU Format and commands
– Mifare 1K
– Flomio SDK v2.22017-03-07 10:19:33.385773 NFC Test[232:9225] MyTest ViewDidLoad 2017-03-07 10:19:33.385906 NFC Test[232:9225] MyTest Initialised paramaters: runInitialSetupOfReader = 0, readerDeviceIsConnected = 0, keyLoadedIntoMemory = 0, authorisedAccessToSector = 0 2017-03-07 10:19:33.387988 NFC Test[232:9225] MyTest Instance of FmSession Manager started - Reader Manager for 1 2017-03-07 10:19:33.388545 NFC Test[232:9225] MyTest established configuration parameters { "Allow Multiconnect" = 0; "Power Operation" = 0; "Reader State" = 0; "Scan Period" = 2500; "Scan Sound" = 1; "Transmit Power" = 3; } 2017-03-07 10:19:33.388671 NFC Test[232:9225] Init FloJack 2017-03-07 10:19:33.594544 NFC Test[232:9225] MyTest Set configuration & created instance of readers 2017-03-07 10:19:33.637124 NFC Test[232:9225] App Activated 2017-03-07 10:19:33.904389 NFC Test[232:9297] In Init 2017-03-07 10:19:33.905302 NFC Test[232:9297] bundle/var/containers/Bundle/Application/368C36CF-69CC-44A6-8325-5D96A47BA33E/NFC Test.app/ScanSound.caf 2017-03-07 10:19:33.910316 NFC Test[232:9297] Created reader 0x17d479e0 2017-03-07 10:19:33.910521 NFC Test[232:9225] in startScan 2017-03-07 10:19:33.910592 NFC Test[232:9225] sending Reset 2017-03-07 10:19:35.919387 NFC Test[232:9287] Reader 0x17d479e0 reset 2017-03-07 10:19:35.920760 NFC Test[232:9287] Reader 0x17d479e0 check license 2017-03-07 10:19:36.042440 NFC Test[232:9291] in didSendStatus 2017-03-07 10:19:36.042712 NFC Test[232:9291] Stat Response time = nan 2017-03-07 10:19:36.042947 NFC Test[232:9291] Stat Sleep Setting = 30 2017-03-07 10:19:36.044336 NFC Test[232:9291] Battery Level:100 2017-03-07 10:19:36.158178 NFC Test[232:9291] in didSendFirmwareVersion 2017-03-07 10:19:36.245201 NFC Test[232:9291] in didSendDeviceId 2017-03-07 10:19:36.246329 NFC Test[232:9291] Identified device 40EEEE5302FD2924 2017-03-07 10:19:36.246689 NFC Test[232:9291] in isDeviceLicensed 2017-03-07 10:19:37.120510 NFC Test[232:9291] Have Response, registered 2017-03-07 10:19:37.120626 NFC Test[232:9291] Verfied Basic license 2017-03-07 10:19:37.120759 NFC Test[232:9291] in startScan 2017-03-07 10:19:37.120822 NFC Test[232:9291] sending Reset 2017-03-07 10:19:38.599823 NFC Test[232:9225] MyTest ConnectedDevices updated ( "<FmDevice: 0x17d4d7a0>" ) 2017-03-07 10:19:38.601737 NFC Test[232:9225] MyTest Run Initial Reader setup & GUI Updated 2017-03-07 10:19:39.135433 NFC Test[232:9286] Reader 0x17d479e0 reset 2017-03-07 10:19:39.135839 NFC Test[232:9286] Run Scan Loop 2017-03-07 10:19:39.137141 NFC Test[232:9286] Reader 0x17d479e0 reset, start scan loop, scanSound 1 2017-03-07 10:19:39.137413 NFC Test[232:9286] Ran scan setup timer 0x17e6eb20 2017-03-07 10:19:39.137821 NFC Test[232:9286] in control Timer Source 2017-03-07 10:19:39.137963 NFC Test[232:9286] controlTimerSource: initialized 2017-03-07 10:19:39.138079 NFC Test[232:9286] in control Timer Source 2017-03-07 10:19:39.138520 NFC Test[232:9286] controlTimerSource: resumed 2017-03-07 10:19:39.139663 NFC Test[232:9286] timer running on <NSThread: 0x17e6d330>{number = 4, name = (null)} thread 2017-03-07 10:19:39.139793 NFC Test[232:9286] sourceTimer Fired 2017-03-07 10:19:39.140129 NFC Test[232:9286] communication:1 CommCounter: 1 2017-03-07 10:19:39.140204 NFC Test[232:9286] Check status comm & bat 2017-03-07 10:19:39.141292 NFC Test[232:9286] Polling for tags 2017-03-07 10:19:39.263721 NFC Test[232:9288] in didSendStatus 2017-03-07 10:19:39.264045 NFC Test[232:9288] Stat Response time = 0.123967 2017-03-07 10:19:39.264295 NFC Test[232:9288] Stat Sleep Setting = 30 2017-03-07 10:19:39.264470 NFC Test[232:9288] didChangeBatteryLevel 100 2017-03-07 10:19:39.265331 NFC Test[232:9288] MyTest ConnectedDevices updated ( "<FmDevice: 0x17d4d7a0>" ) 2017-03-07 10:19:39.265786 NFC Test[232:9288] Battery Level:100 2017-03-07 10:19:39.321936 NFC Test[232:9288] in didSendStatus 2017-03-07 10:19:39.322171 NFC Test[232:9288] Stat Response time = 0.182150 2017-03-07 10:19:39.322412 NFC Test[232:9288] Stat Sleep Setting = 30 2017-03-07 10:19:39.322533 NFC Test[232:9288] Battery Level:100 2017-03-07 10:19:39.479490 NFC Test[232:9288] in didSendPiccAtr 2017-03-07 10:19:39.479612 NFC Test[232:9288] locked responseCondition 2017-03-07 10:19:39.479982 NFC Test[232:9288] unlocked responseCondition 2017-03-07 10:19:39.492538 NFC Test[232:9287] Command Apdu sent: FF CA 00 00 00 2017-03-07 10:19:39.562660 NFC Test[232:9225] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2017-03-07 10:19:39.564553 NFC Test[232:9225] [MC] Reading from public effective user settings. 2017-03-07 10:19:41.651360 NFC Test[232:9286] timer running on <NSThread: 0x17e6d330>{number = 4, name = (null)} thread 2017-03-07 10:19:41.651589 NFC Test[232:9286] sourceTimer Fired 2017-03-07 10:19:41.651725 NFC Test[232:9286] Card Status: Present 2017-03-07 10:19:41.651984 NFC Test[232:9286] MyTest cardStatus = 1 2017-03-07 10:19:41.652791 NFC Test[232:9286] MyTest device = 40EEEE5302FD2924 2017-03-07 10:19:41.654252 NFC Test[232:9286] Card in range, send an APDU 2017-03-07 10:19:41.654561 NFC Test[232:9286] communication:1 CommCounter: 0 2017-03-07 10:19:41.654633 NFC Test[232:9286] Check status comm & bat 2017-03-07 10:19:41.654928 NFC Test[232:9286] Polling for tags 2017-03-07 10:19:41.774845 NFC Test[232:9344] in didSendStatus 2017-03-07 10:19:41.775731 NFC Test[232:9344] Stat Response time = 0.120708 2017-03-07 10:19:41.775892 NFC Test[232:9344] Stat Sleep Setting = 30 2017-03-07 10:19:41.776450 NFC Test[232:9344] Battery Level:100 2017-03-07 10:19:41.944130 NFC Test[232:9286] in didSendPiccAtr 2017-03-07 10:19:41.944290 NFC Test[232:9286] locked responseCondition 2017-03-07 10:19:41.944793 NFC Test[232:9286] unlocked responseCondition 2017-03-07 10:19:41.977066 NFC Test[232:9288] 0x17da5310 Copy matching assets reply: XPC_TYPE_DICTIONARY <dictionary: 0x17da5310> { count = 1, transaction: 0, voucher = 0x0, contents = "Result" => <int64: 0x17d6ff30>: 29 } 2017-03-07 10:19:41.981370 NFC Test[232:9288] 0x17e98130 Daemon configuration query reply: XPC_TYPE_DICTIONARY <dictionary: 0x17e98130> { count = 2, transaction: 0, voucher = 0x0, contents = "Dictionary" => <dictionary: 0x17e98ba0> { count = 1, transaction: 0, voucher = 0x0, contents = "ServerURL" => <dictionary: 0x17e98c10> { count = 3, transaction: 0, voucher = 0x0, contents = "com.apple.CFURL.magic" => <uuid: 0x17e987d0> C3853DCC-9776-4114-B6C1-FD9F51944A6D "com.apple.CFURL.string" => <string: 0x17e986c0> { length = 30, contents = "https://mesu.apple.com/assets/" } "com.apple.CFURL.base" => <null: 0x34fb48b4>: null-object } } "Result" => <int64: 0x17e983a0>: 0 } 2017-03-07 10:19:41.982036 NFC Test[232:9288] [MobileAssetError:29] Unable to copy asset information from https://mesu.apple.com/assets/ for asset type com.apple.MobileAsset.TextInput.SpellChecker 2017-03-07 10:19:42.448882 NFC Test[232:9286] Semaphore timeout 2017-03-07 10:19:42.460540 NFC Test[232:9286] Command Apdu sent: FF CA 00 00 00 2017-03-07 10:19:42.650838 NFC Test[232:9286] in didSendPiccResponseApdu 2017-03-07 10:19:42.652178 NFC Test[232:9286] Response Apdu: CC 2C 33 01 90 00 2017-03-07 10:19:42.667626 NFC Test[232:9225] MyTest FoundTagWithUUID (v1) = CC 2C 33 01 90 00, deviceID = 40EEEE5302FD2924, ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A, error = (null) 2017-03-07 10:19:43.619255 NFC Test[232:9225] MyTest ConnectedDevices updated ( "<FmDevice: 0x17e756b0>" ) : : 2017-03-07 10:31:59.175144 NFC Test[232:10399] Polling for tags 2017-03-07 10:31:59.300768 NFC Test[232:10763] in didSendStatus 2017-03-07 10:31:59.301133 NFC Test[232:10763] Stat Response time = 0.127414 2017-03-07 10:31:59.301278 NFC Test[232:10763] Stat Sleep Setting = 30 2017-03-07 10:31:59.301399 NFC Test[232:10763] Battery Level:100 2017-03-07 10:31:59.463301 NFC Test[232:10763] in didSendPiccAtr 2017-03-07 10:31:59.463520 NFC Test[232:10763] locked responseCondition 2017-03-07 10:31:59.465190 NFC Test[232:10763] unlocked responseCondition 2017-03-07 10:31:59.477179 NFC Test[232:10337] Command Apdu sent: FF CA 00 00 00 2017-03-07 10:31:59.660662 NFC Test[232:10399] in didSendPiccResponseApdu 2017-03-07 10:31:59.661452 NFC Test[232:10399] Response Apdu: CC 2C 33 01 90 00 2017-03-07 10:31:59.674803 NFC Test[232:9225] MyTest FoundTagWithUUID (v1) = CC 2C 33 01 90 00, deviceID = 40EEEE5302FD2924, ATR = 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A, error = (null) 2017-03-07 10:32:01.681173 NFC Test[232:10763] timer running on <NSThread: 0x17d6ea80>{number = 24, name = (null)} thread 2017-03-07 10:32:01.681291 NFC Test[232:10763] sourceTimer Fired 2017-03-07 10:32:01.681697 NFC Test[232:10763] communication:1 CommCounter: 0 2017-03-07 10:32:01.681780 NFC Test[232:10763] Check status comm & bat 2017-03-07 10:32:01.681912 NFC Test[232:10763] Polling for tags 2017-03-07 10:32:01.788980 NFC Test[232:10782] Command Apdu sent: FF B0 00 04 01 2017-03-07 10:32:01.802345 NFC Test[232:10399] in didSendStatus 2017-03-07 10:32:01.802589 NFC Test[232:10399] Stat Response time = 0.121138 2017-03-07 10:32:01.802822 NFC Test[232:10399] Stat Sleep Setting = 30 2017-03-07 10:32:01.802984 NFC Test[232:10399] Battery Level:100 2017-03-07 10:32:01.977153 NFC Test[232:10399] in didSendPiccAtr 2017-03-07 10:32:01.977642 NFC Test[232:10399] locked responseCondition 2017-03-07 10:32:01.978910 NFC Test[232:10399] unlocked responseCondition 2017-03-07 10:32:02.029198 NFC Test[232:10399] in didSendPiccResponseApdu 2017-03-07 10:32:02.029814 NFC Test[232:10399] Response Apdu: 63 00 2017-03-07 10:32:02.032918 NFC Test[232:10399] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' *** First throw call stack: (0x1bcb6e07 0x1af17077 0x1bbcae09 0x1bbcac73 0x18e621 0x191cbb 0x1af561 0x1af263 0x738d67 0x747053 0x746be9 0x1b512937 0x1b51248c) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
March 8, 2017 at 4:55 am #58935Hi Reece,
I am having problems reproducing this issue (completely my fault). What I can suggest to you is to use the ACR35 device driver at https://github.com/flomio/flomio_ios. We are trying to get synchronous APDUs on the ACR35 at the moment which would solve your specific use case, i.e.
NSString *response = [readerManager sendApdu:@"FF xx xx xx xx" toDevice:@"xx xx xx"]
I will continue to try resolve this issue and update here if there is progress made.
Please let me know if you have any further questions.Kind Regards,
ScottMarch 8, 2017 at 6:12 am #58937Hi Scott,
I have also been using that driver alongside development with the Flomio SDK as a way of verifying the commands. That also does not seem to be successful.
I would like to query that use case of code you put in your last post. The sendAPDU method returns a void but in that code snippet you appear to be appending a response to an NSString.
I have a textfield and a button that upon a button press used the string of text to send an APDU within the UI as shown in the image howeber I don’t append any form of repsonse in this method. Trying to follow the method you have used shows this error:
(http://imgur.com/JARN6YB) It appears the embedded img did not work [Edit]Thank you for taking the time to look into this problem, it is greatly appreciated.
Kind Regards
ReeceMarch 8, 2017 at 8:35 am #58943Sorry, I should have been more clear. The code I mentioned above with the NSString returned is something we are developing for a future release for your use case.
That is surprising that the driver isn’t responding.
Have you tried using the kReadData setting (rather than kReadUuid)?I will use the Flojack MSR driver demo and send your APDUs (with a different authentication key) and see if it works.
I have had success reading data in the past using
Load Authenticate Key: “FF 82 00 00 06 FF FF FF FF FF FF”
Authenticate : “FF 86 00 00 05 01 00 04 60 00”
Request Data Type2 : “FF B0 00 04 10”Kind Regards,
Scott- This reply was modified 7 years, 8 months ago by Scott.
March 8, 2017 at 9:12 am #58947Hi Scott,
That makes sense, I couldnt see any instance of that method other than it returning void. Will that be available in a new release of SDK soon?
Using the FLojakc MSR Driver demo with the APDU structure returns an error at the second APDU for authentication: (Note the Key is changed from all F’s)
Load Authenticate Key: “FF 82 00 00 06 C7 35 72 19 F2 03”
Authenticate : “FF 86 00 00 05 01 00 04 60 00”The authentication key passes and I have been assured this is valid, I have tried changing the Block Number (04) to Sector 15 Block 0 as that’s what I intend on reading as well and they all return (63 00).
I have also tried different variations of the Key Type and key number in attempt to check the key is Type_A / Type_B or in a different memory location.
Would this likely be to do with the wrong Key, the Flojack device, the Mifare 1K card or the APDU’s sent?
Thank you
Kind regards
ReeceMarch 8, 2017 at 9:16 am #58950I have seen the key being the issue before which is very frustrating. I think you can be confident in the APDUs I sent are correct. Unfortunately, I am having a hardware issue on my end which is preventing me from replicating the problem.
I am aiming to release the next SDK within the next month.Kind Regards,
ScottMarch 8, 2017 at 9:34 am #58951Hey Scott,
Synchronous APDU responses would be an amazing addition, as we could parse the response without having to keep track of the number of times the apdu delegate is fired (i.e. I am supposed to have 4 successful write responses, did I receive 4
90 00
responses?).Will the synchronous APDU (
NSString *response = [readerManager sendApdu:@"FF xx xx xx xx" toDevice:@"xx xx xx"]
) be compatible with the Flo BLE Plus in the new SDK release?
Even though synchronous writes may increase write time, I bet its pretty negligible and I am all for it!March 8, 2017 at 1:11 pm #58953Hi Zach,
I have just tested my above APDUs using the ACR35 demo and have been able to read data from an empty Mifare Classic 1k with the authentication key: FF FF FF FF FF FF. This means you may have a wrong authentication key.
We are working to get the synchronous method working as soon as possible for all readers.
Yes the FloBLE Plus will have the new synchronous method. Moving to the FloBLE Plus has worked well for other users who need to have a more reliable read/write APDUs experience as the MSR deals with a lot of threading issues related to the audio jack interface.
Kind Regards,
Scott- This reply was modified 7 years, 8 months ago by Scott.
March 14, 2017 at 7:13 am #58981Hi Scott,
I am still having an issue with this, however I have come across another thread with similar issues and have followed the advice there.
I have just made a new post there outlining my current steps to which I am getting a 6A 81 response.
Here’s the post on the other thread if you would be able to help.
Post on new threadThanks
Reece- This reply was modified 7 years, 8 months ago by Reece. Reason: Fix link & Grammar
March 14, 2017 at 7:46 am #58983Hi Reece,
The 9000 response after sending the Authentication key has been explained to me as ‘you have successfully loaded your key’ rather than ‘this key is correct’.
I would suggest trying a different tag with a known key to see if you can replicate the issue.
Kind Regards,
Scott -
AuthorPosts
You must be logged in to reply to this topic.