How to fix uid in NFC - android

I want to fix uid for nexus s and when use the phone to tag at NFC shield. The shield will show id. But when it tag at the nfc shield, id is not same. Can I fix my uid ?

What you likely see is the NFCID: the NFC peer-to-peer ID. This ID is randomly generated anew by the NFC hardware on every NFC connection and cannot be fixed.

The current SDK does not allow you to use card emulation, so you can't use the phone as tag.

Because the ID changes for the peer-to-peer on every connection, you'll have to define an NDEF record with a text value in it. Make that value your fixed ID. On the other side, on the shield, you'll need to read out that record to find your fixed value/ID.
https://github.com/adafruit/Adafruit_NFCShield_I2C/tree/master/examples has some examples on how to manipulate NDEF records but only on MiFare classics. If you're using Ultralights or other kinds of tags, this will be different.

Related

How NFC smart label work. Authenticity checks using the right NFC label and for the right product?

There are some solutions in the market where NFC with RFID are used for Authenticity checks using the right NFC label and for the right product.
That is fine where any attempt made to open the label results in breakage of the RFID circuitry, rendering the tag non-readable. A non-readable tag makes the authenticity check unsuccessful.
The problem is that I am unsure of how to detect whether a RFID sealed circuit has been broken using an Android app. In the event that we re-detect an NFC tag after breaking the seal, what kind of data do we get?
In order to accomplisha Counterfeit Protection, physical-digital seals and tamper-proof NFC with RFID tag
Thanks in advance
So the answer you want will be very specific to the make and model of the Tag, so impossible to answer in detail.
But as an example if you look at the datasheet for a NXP 424 DNA Tag which has Anti Tamper features there is a Custom Command F7h to check the Status of the Tamper circuit if the Tag is still operating.
It also has a custom command to check a originality check that allows verification of the genuineness of the Tag.

NFC tag changed its available technologies (IsoDep, NfcA and Ndef to only IsoDep and NfcA)

I'm working on an Android application to interface between a mobile phone and a specific chip that supports NFC, which is called the NF4 chip and is manufactured by EM Microelectronic. Here is a link to the datasheet of this chip: http://www.emmicroelectronic.com/sites/default/files/public/products/datasheets/nf4-fs.pdf
In page 3 of the datasheet, the memory system of the chip is summarized. Part of what I need to do is to create a file in the memory and write to it. I was working on this and testing it using a phone and the NFC tag.
To achieve what I need, the app sends the following APDUs to the chip:
select an EF in the memory system (Select File APDU)
write to this file (Update Binary APDU)
The chip comes with other NFC tags/cards that are basically the same as this chip, only without the serial interface.
One time I was testing my app with one of the extra tags (cards). The tag stopped functioning as it used to. An application made by EM Microelectronic (who make the tag) used to be able to read and write to the tag, but after this incident the EM app stopped being able to do this.
When I looked into the matter further, I found that the technologies of the tag went from being (IsoDep, NfcA and Ndef) in the beginning to only (IsoDep and NfcA) after that one testing session with my app. Therefore, it is basically not an NFC-Forum supported tag anymore.
I'm not sure what happened and need to solve this problem and return the tag to its previous state. I also need to understand what my app did to the tag to cause it to become like this so that I can stop it from happening when I test again.
One theory that I thought of is that maybe when my app selected an EF that isn't a child of the DF that stores the NFC data in the tag, this is what caused the problem. That is, the NFC Dedicated File is still in memory but is not selected as the current file... I'm not sure if this could actually cause the problem that I described.
Does this make sense, or could it be something else?

How can I read the NFC ID of another Android device?

I want to exchange (or only read) the NFC tag ID from one Android device to another but I don't know if I should use peer-to-peer mode or emulate an NFC tag with HCE.
If I use HCE, is the emulated tag ID unique?
What is the better option or is there a simpler one?
Neither P2P nor HCE will provide you a unique ID, least not on any phone I'm aware of. With P2P it's required that the ID exchanged in ATR is random. With HCE the emulated tag ID is usually set to 08h plus a random number. There may be API call to set but I'm not aware of such. But it makes a lot of sense that a phone can not be uniquely identified by just anyone reading.
How can I read the NFC ID of another Android device?
I assume you are talking about the anti-collision identifier/UID here. On the reading Android device, you can use the reader-mode API to access devices in HCE mode:
nfcAdapter.enableReaderMode(this, new NfcAdapter.ReaderCallback() {
public void onTagDiscovered (Tag tag) {
byte[] uid = tag.getId();
// TODO: do something with the UID ...
}
}, NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, null);
Is the emulated tag ID unique?
See Stephen's answer. Typically, neither P2P mode nor HCE should provide a unique and stable ID. However, there are some exceptions to this and the point of time when a non-stable ID changes may vary (also see this answer). It could be that:
The device has a secure element and uses the static UID of that secure element.
The device generates a new random UID whenever it is turned on, but continues to use the same UID until it is powered off.
The device generates a new random UID on every activation by an external reader device. I.e. whenever an external HF field is applied to the NFC antenna of the Android device.
Also note that some NFC devices will use randomly generated UIDs that do not start with the random-prefix 0x08.
Can I force a device to use a fixed/stable UID?
Android does not provide an API to influence the UID/anti-collision identifier, so the short answer is no. However, if rooting or creating a custom ROM is an option, there are some possibilities to change the UID and other protocol parameters:
Editing Functionality of Host Card Emulation in Android
Host-based Card Emulation with Fixed Card ID
Should you use the UID to identify (or even authenticate) a device?
No, you should definitely not do this. While you sometimes do not have much choice when you try to integrate a HCE device into some legacy system, you should definitely think about a different design.
First of all, as Stephen already wrote, if an NFC device exposes a fixed/stable identifier, this could possibly introduce a privacy issue as anyone could read and track the ID.
Second, while many systems still use these IDs to authenticate(!) cards, UIDs are not necessarily unique (particularly there are less 4-byte UIDs than cards out there) and UIDs can easily be cloned. See this answer for further details.

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 powered.
And this is exactly what I am trying to do, read passively the NFC tag. The problem is that my Android phone doesn't recognise the tag when it's not connected to the microcontroller. I have just a noise when I scan the tag and no information appear. I tried with another smartphone and I had the same behaviour with a small message: "unknown tag type".
My question is:
How can I start an Android App when an "unknown tag type" is detected. I tried the three Android intent handlers: TAG_DISCOVERED, TECH_DISCOVERED and NDEF_DSICOVERED, but none of these solutions has worked.
N.B: according to the datasheet, The AS3953A supports ISO 14443A up to Level-4
N.B2: when I use the constructor demokit I can read the EEPROM values when the NFC is supplied via the SPI interface.
I contacted the manufacturer "ams". They said that this tag (AS3953 HW) is not NFC Forum standards compliant (contrary to what is mentioned in the datasheet). So to read passively the tag I have to code their proprietary commands (a list is provided in the datasheet) into my app.

Where are stored the data of tags when the NfcAdapter discovers tag?

I have further questions:
-Where are stored the data of tags when the NfcAdapter discovers tag?
-Is it possible to get NFC chip Id of the phone (Nexus S) by software?
-Is it possible to consider website action as "Tag Discover"? I mean is it possible to do some action on a website which will do react my phone as if it has discovered tags?
First, the data is stored on the tag. When you talk to the tag, usually an array with the response is returned by the method you used to talk. (such as tag.tranceive(byte[]))
Second, no. It is randomly generated.
Third, I don't know. I would search for other "intents" that the phone can generate. But there may be.

Categories

Resources