nfc,smartcard,mifare,apdu,smartcard-reader , APDU MIFARE Classic 4K read value at specific sector/block

APDU MIFARE Classic 4K read value at specific sector/block


Tag: nfc,smartcard,mifare,apdu,smartcard-reader

I'm trying to read some data from my MiFare Classic 4K smartcard. I already know the exact sector/block location of the data (because of a dump via Android), but I don't know how to show it in SpringCard Prox'N'Roll.

I know how to access my card and I did a lot of research, but I'm not able to find out how to get data because I don't really understand the values needed in a APDU command message.

It might be something like this?

INS: B0/B2/CA ?
P1-P2: ???
LC Field: ??
Data field: ??

I want to read sector 32, block 140.


The most easiest way to read a block from a MIFARE Classic card using this specific reader (SpringCard Prox'N'Roll PC/SC) is the reader-specific READ MIFARE CLASSIC (with specified key) command:

FF F3 00 <BLOCK> 06 <KEY> 00

This command will try to authenticate using <KEY> as key A first (and if that fails as key B). After successful authentication it will read the block <BLOCK>.

So for your scenario, you would use

FF F3 00 8C 06 uu vv ww xx yy zz 00

where uu vv ww xx yy zz is the authentication key.


Secure Box in JCOP card

JCOP V2.4.2 Revision 3 Security Target: Page 11-12 A Secure Box concept is implemented within JCOP 2.4.2 R3. The Secure Box is a construct which allows to run non certified third party native code and ensures that this code cannot harm, influence or manipulate the JCOP 2.4.2 R3 operating system...

How can I reconnect to IsoDep tag?

I'm trying to send some apdu commands from android phone to the nfc tag and get answers. The type of used technology is IsoDep. Everything works fine, but sometimes, when the time between sending commands is too large, the tag switches to the disabled state and after that every reconnection...

Intent filter for NFC Smart Poster

I would like to create an application that catch all NFC Smart Poster record. How can I catch Smart Poster records? I tried this way: <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="application/*" /> <data android:mimeType="audio/*" /> <data android:mimeType="example/*" /> <data android:mimeType="image/*" /> <data android:mimeType="message/*" /> <data android:mimeType="model/*"...

node-hid not showing all USB devices

I'm using node-hid with this call: HID.devices() and I should get a list of all connected USB devices as listed here in the guide. As result I'm getting this devices list: [ { vendorId: 1452, productId: 33346, path: 'USB_05ac_8242_6500000', serialNumber: '', manufacturer: 'Apple Computer, Inc.', product: 'Apple IR', release: 22,...

NDEF vs APDU NFC Android

Can you tell me please what is the difference between NDEF (NFC Data Exchange Format) and APDU (Application Protocol Data Unit). I have developed an Android application that reads NDEF messages, and I want to know if it can work for APDU data too....

Sending signature data in response APDU - Java Card

I would like to sign some data (the MESSAGE byte array) on my Java Card and then return the signature in a response APDU. My code works fine (or at least I think it does and it returns 9000) without the line apdu.sendBytes(BAS, sSignLen), but when I uncomment it I...

How do I progammatically play the Android NFC notification sound?

I have an app (NFC Sniffer) which allows users to read NFC tags. When a user attempts to read a tag, 1 of 3 things happens: Nothing, the tag was not brought close enough Detected NFC, but fails to read card, in which case a notification tone is played. Reads...

Performance measures : Java vs JavaCard [closed]

I implemented two algorithms in Java. To compare their effectiveness, I call each function 1000 times and compare the execution time (using System.currentTimeMillis()). It needs 2500 ms to execute the first one and 1300 ms for the second one. With these results, I thought have a significative difference (in term...

ADPU Service in iOS

I'm looking for an NFC solution for iOS similar to HostApduService for Android. Can someone tell me how can I exchange APDU commands in iOS. Thank you....

Weird Android device behaviour in reading NFC tech-list

I am trying to read an NFC tag from 2 devices (Nexus 5 and Samsung S5). I am reading the tag through the foreground dispatch and using ACTION_TECH_DISCOVERED intent. On the Samsung S5, the tech-list lists NfcA, MifareClassic, and Ndef, but on the Nexus 5, it lists only NfcA. I...

NFC read tag to launch Google Maps with coordinates

I am trying to write an NFC tag with coordinates (latitude and longitude), in the following manner: This is inside onCreate(): btnWriteMap.setOnClickListener(new OnClickListener() { public void onClick(View v) { String latitude = lat.getText().toString(); String longitude = lon.getText().toString(); urlAddress = "geo:"+latitude+","+longitude; TextView messageText = (TextView)findViewById(; messageText.setText("Touch NFC Tag to share GEO...

How to mock a Android NFC Tag object for unit testing

I'm currently working on an Android project which needs NFC integration. Now I want to write some (j)unit tests to see if the application can receive NFC intents (specifically ACTION_TECH_DISCOVERED) and put the given tag (in NfcAdapter.EXTRA_TAG) on a bus system. However to my surprise I cannot create a Tag...

How to get RFID tag from ACS122U NFC

I am working on ACS122U NFC which reads tag's RFID. From ACS I got the development kit which will only connect to the reader and gives the state when a tag is placed on the NFC reader. But I need to get the ID (UID, serial number) of a...

Determine Facility Code and Card Number from ATR in C#

I have the following card reader HID Omnikey 5325. I have a contact-less card named HIS Proximity. The number written on this card is 133593 42101044091-3. By reading the card, I get the following ATR hex: 3B050002F10673 Using the folowing applications I have managed to see the following information. I...

How do I permanently lock specific data pages in a MIFARE Ultralight C tag?

I have successfully written some data on data pages 30 to 38. After that I want to lock those pages in order to prevent further writing. The write lock should be permanent, so even if someone knows the authentication key, they should not be able to write to those pages....

How to launch an app without launcher icon by scanning an NFC tag?

I want to launch my application by scanning an NFC tag containing an Android Application Record. However, this app shouldn't have a launcher icon, so I can't use CATEGORY_LAUNCHER. My problem is that if I comment out the CATEGORY_LAUNCHER line in the manifest, the app is not launched anymore (a...

Can't Read data (payload) from non-NDEF tag

I'm using Phonegap-nfc plugin I'm trying to read data (payload) from my non-NDEF NFC card. the only ACTION that is triggered is ACTION_TAG_DISCOVERED and i only can read the tag_info. the tag's techs are NfcB and IsoDep nfc_tech_filter.xml <tech-list> <tech></tech> <tech></tech> </tech-list> NfcReader/AndroidManifest.xml <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <action...

Smartcard PKCS11 AES Key Gen Failure

I am attempting to create an AES 256 key on an ACOS5-64 smartcard and OMNIKEY 3121 card reader, using PKCS11 in python (using the PyKCS11 library). So far, all the "standard" operations seem to work with regards to asymmetric crypto. I have run plenty of code samples and pkcs11-tool commands,...

Cardholder name not included when reading EMV card

I've successfully been able to retrieve the card number and expiry date from a contactless debit/credit card. However, the cardholder name is not being returned in the READ RECORD command response. Am I missing a something? - Select Application # IN_DATA_EXCHANGE >> D4 40 01 00 A4 04 00 07...

UID of a NFC/SWP-accessed SIM card

SIM card is used as a secure element in my project. It is accessed through NFC-SWP contactless interface from a terminal device. I need to identify the SIM card somehow with a unique and permanent identifier and I need to be able to read the identifier through NFC. ICCID seems...

Is it possible to program a “Java Card” - enabled smart card in any other language than Java?

I have a Java Card enabled smart card and a card reader that was given by my Lab-instructor. I am supposed to do a project using Java Card 2.1.1 API. I don't like the Java Card API. Is it possible to program my given smart card using any other language...

Tag returns null when trying to write NDEF message to NFC tag - Tag is not detected

I am trying to write an NDEF message to a tag. Below is the code that I have. I run the code using the debugger in my IDE, but after executing the line Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); tag is null (I assume this means that no tag was found) and...

Send APDU commands to USIM/SIM card in android

I was already worked with smart cards and I am familiar with APDU commands (that are defined in ISO/IEC 7816 and Global Platform specifications). Now I want to know if is there any way to send an APDU command to my USIM/SIM card that is inserted to my mobile phone?...

ISO7816 - Odd INS codes?

I found these mysterious lines in ISO 7816, ( 5.4.2 Instruction byte The instruction byte INS of a command shall be coded to allow transmission with any of the protocols defined in part 3 of ISO/IEC 7816. Table 10 shows the INS codes that are consequently invalid. Table 10 -...

Two OwnerPIN object in Java Card

I am working on a Java Card application where our requirement is to keep some static data and balance in the card. For security I was thinking to make 2 object of OwnerPIN. One object is for terminal authentication (i.e. the terminal needs to send 8 bytes of data to...

onNewIntent() being called in onResume() multiple times

My problem is that in onNewIntent() function I start a new intent to open contacts app and allow the user the complete the process of creating a new contact, but when I try to exit the contacts app and go back to my app it seems that onNewIntent() is called...

Can I get access to NFC without manifest permission in android?

I need to create app with optional NFC functionality. Can I get access to NFC without manifest permission (Android)? Or should I create two apps: an NFC version and one without it.

how changing master key or other keys can provide security ?how used session key to keep the further communication between DESFire and reader?

I am working on the ticket electronik that tickets are DESFire cards. I want communications be safe . i now trying change PICC key . Before changing DESFire master key Authenticate with master key is necessary. In desfire sheet about Authenticate at page 31 was described: "This procedure not only...

How to use method onNewIntent(Intent intent) inside a Fragment?

I'm trying to use NFC Hardware from my device. But, the problem is that when I register the Activity to receive the Intent: PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); I receive the result in an Activity instead of a Fragment. Is there a way to handle this...

I'm getting a tag lost exception when I try writing to an NFC tag

I hope someone can tell me what I'm missing here. Maybe it's my approach to connecting. My Tag, is in fact a Mifare Ultralight so I'm not getting things wrong there. I debugged, connecting to the tag was successful - everything seemed fine. But the log keeps on saying: android.nfc.TagLostException:...

How can I extract an X509 certificate from a smart card using Java?

I use the OmniKey 3121 reader and can use the javax.smartcardio API to send APDU commands to the card reader. I'm not sure if there is a standard way to access the certificate stored on the card. Pointers to example code to read the certificate data would greatly help. Also,...

Start an Android App when an “unknown tag type” is scanned

I am working on an Android NFC reader project in which I use the AS3953 NFC chip. according to the datasheet: This NFC chip could be used Where log data is stored periodically by the microcontroller and can then be read by the PCD even when the microcontroller is not...

NFC reader writer

NFC reader - Yesterday i got NFC reader programmer with label U F R Classic reader and have a problem. I cant find documentation about this reader. Can someone help me?

How to change master key of DESfire cards?What is deciphered key?

I want to change the master key of a DESfire card. I read mifare DESFire datasheet already, but as I am new in this field, I couldn't understand it. It is explained how to Change the Key at page 37 of above document. Can anybody give me an example or...

How to remove a `tag listener` in Phonegap NFC plugin

I am using chariotsolution's nfc plugin for phonegap ( and it's all working perfect until the time came that I needed to remove a listener. I can't do it and it seems like it's not working. My question is, is this a common bug? Has anyone ever tried to remove...

Android NFC passing single parameter when starting application

I would like to start an application using an NFC tag. I got that part working using an android application record (AAR) as described in Start Android application from NFC-tag with extra data or by using NDEF_DISCOVERED / TECH_DISCOVERED intent filters. But how do I pass data from the NFC...

NFC SWP applet selection returns 6999

I have a simple JavaCard applet installed on my SIM card. I try to communicate with my applet using Omnikey 5121 CL reader and NFC-enabled Sony Xperia L through NFC/SWP (single wire protocol). The problem is I cannot select the applet - as a status word I get 6999. The...

Is a network shield required to do POSTGET requests with arduino?

By means of being thorough i was wondering if someone could tell me if I need an ethernet/wifi shield to be able to use POSTGET requests using my arduino. I've got an NFC shield and I need to send the data stored on the tag to my web server....

NFC Read Tag SMS Service

I have written a program in which I am trying to write and read NFC tag, which may help user in sending message. I have successfully written to the tag but whenever I am trying to read, the Tags app shows but does not allow me to send the...

Change PIN of a Gemalto Smartcard through a script

We have to use the Gemalto IDPrime .Net card Smartcard. We get these USB Dongles and have to change the PIN. Gemalto says via windows: From the Start menu, choose Run and type PINTool. Insert a IDPrime .Net card in the reader as prompted, and click OK. The change PIN...

Starting a specific activity through NFC tag

Is it possible to launch a specific activity in an app using NFC tag? I want to start an activity called MainMap which is not the main activity. I've tried using a tag writer for writing mime record and still failing. Here's the manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="" package=""...

I got 0x9E parameter error while Credit value file on DESFire card

I now work with value files on DESFire cards. I created a value file in my DESFire card with the following command: byte[] cmdCreateValueFile = new byte[]{ //cmd (byte)0xCC, //file no (byte)0x01, //com.sett. (byte)0x00 , //access rights (byte)0x44 , (byte)0x44, //lower limit (byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 , //upper limit (byte)0x00...

When app receives NFC data it opens “New Tag collected”

I am creating an app where two devices communicate over NFC and then one transmits to the server. I am trying to develop this for both pre- and post-lollipop. The problem is that I create my NDEF message in one app and then receive it in another app. However when...

number value to byte[6] array card reader

What's the best way to convert a number to a byte[6] in C#? I'm using MagTek Card reader and trying to display desired amount on device screen, it should be 6-byte array. The amount needs to be used and authorized, EMV Tag 9F02, format n12. Function: int requestSmartCard(int cardType, int...

Smart Card Reader T0 T1 communication on APDU level

I am struggle to understand what protocol I have to use to communicate with the card T0 or T1? So, correct me if I am wrong, but the reader actually decides by itself what protocol to use to communicate with the card if the card supports both. So my logic...

C on smartcards [closed]

I have the task to write some crypto stuff in C and make it lightweight. The idea behind making it lightweight is, that it could run on a smartcard which doesn't offer much computational power and memory. It won't come to actually running it on a smartcard and it won't...