1

I can encoded an NFC Sticker with a website that will open when I tap it with a mobile phone. For the application I want to use it for I need to be able to expire that link so the user can't just save the URL and use it again. Basically I need to be able to put a random string in the URL that changes each time it gets scanned, such as www.mywebsite.com/TCHQ23, www.mywebsite.com/LQ8FT, ect.

Is this possible with a regular NFC sticker? If not, what kind of device would I use to make this happen? I know there are Arduino modules that can do this, but is there a simpler method or a ready made product that can act as an NFC but have the URL changed by a computer via a USB cable?

Thanks

user185813
  • 481
  • 1
  • 5
  • 16
  • Do you want the process to be App less i.e. use the in built NFC reading method to launch the OS's default web browser with the URL? – Andrew Jul 26 '20 at 06:13
  • Random String != unique string, do you also want it unpredictable? – Andrew Jul 26 '20 at 06:24
  • Yes I want it to be app less. I just want the tag to generate a URL with a piece that changes each time, didn't know if that was technically possible or not. It doesn't have to be totally unique and I would prefer to have it unpredictable, but can work around whatever is possible. – user185813 Jul 26 '20 at 15:09

2 Answers2

1

NFC tags (some) have a feature called "Mirroring". You can mirror the read counter value to the URL, which gets incremented every time you tap it to reader i.e. Every time read command is called, the counter increases by 1. Tags like NTAG 213, NTAG 215 etc have that feature.

Update:

If your requirement is to get a portion of URL to to return random data and on a cheaper tag or sticker then I would suggest considering NTAG 213 tag, which is cost friendly and also have Mirroring feature supported.

If your URL data is http://www.abc@xyz.com then once the counter Mirroring is enabled (read counter must be enabled first) it will look something like

http://www.abc@xyz.com?000001

The last 6 digit value gets increased by value 1,every time a read command is invoked. (000002, 000003, 000004 and so on)

you can refer this link for more info

Adarsh Rotte
  • 634
  • 3
  • 8
  • How can I find out if a tag has that ability or not? And what App could write that? I didn't see that ability in any of the NFC apps I've tried. – user185813 Jul 26 '20 at 15:10
  • Either the technical specification document of that tag or lil bit googling will provide you the info that if the Mirroring is available or not. You can use Taginfo and Tag writer apps by NXP. – Adarsh Rotte Jul 26 '20 at 17:12
  • I think I misunderstood the UID portion. Does it display a static UID of the tag or does the UID change each time the tag is scanned? – user185813 Jul 27 '20 at 02:07
  • UID is static as it's the unique identifier. It is unique for every tag. It will not change every time the tag is scanned. I've updated the answer with more info. – Adarsh Rotte Jul 27 '20 at 04:07
  • Thanks, I may just use counters. Good to know – user185813 Jul 29 '20 at 04:25
1

So your card/device has to present when read a NDEF record with a link in it (A "Well Known Type 1 with a record type definition of type U, etc), this will cause most phones to open a browser automatically

Some details on the Record type needed at https://www.oreilly.com/library/view/beginning-nfc/9781449324094/ch04.html

Most cards have the ability to store some static data, some have as @Adarsh Rotte says have counters, random number generators, crypto, password protection, mirroring (backup) of data, other functions but non of these will help as these custom functions and are card specific and don't / cannot present the data to match the NFC NDEF specification.

There is one type of card that can do this called JavaCard as these can run fully programmable Java Apps. These can be programmed to respond to NFC read request with the right NDEF measure where the URL can be generated on the fly.

There is a github repo with an example Java App to run on these cards that shows how to respond with and NDEF message at https://github.com/OpenJavaCard/openjavacard-ndef. Watch out for https://github.com/OpenJavaCard/openjavacard-ndef/issues/10 if trying to use this, the default magic AID number is not the right one for NDEF and should be configured at the time you install the App on the Card.
This app emulates the behaviour of an NFC Type 4 spec card.
You would also need to customise it to have the right NDEF payload data with the right generated URL ending.
There are examples of the Card make/model supported by this App listed on the the github pages some are dual interface cards but there are some without the chip contacts and only NFC interface.

Generating the URL ending could be challenging or easy depending on level of security/validation you need.
Starting from a Random String which would be easy to fake because it has no level of validation, to a obfuscated counter, to a public key type encrypted counter.

There are also other solutions to generating the NDEF data with the right URL that don't use a Card and usually require there own power to run.

Some options:-
An Android phone can do what is call Host Card Emulation (HCE) which is very like what the JavaCard is doing, it is pretending to be a NFC Type 4 Card and the response it sends if fully programmable and could be the right type of NDEF message as per the JavaCard.

There are some "Card Reader" Devices that can be attach to a PC/Raspberry Pie via USB can also do HCE like the Android phone. e.g. https://www.acs.com.hk/en/products/342/acr1252u-usb-nfc-reader-iii-nfc-forum-certified-reader/ - this is well documented in the datasheets on how to do.

There are some other "Card Reader" modules that can connect via I2C to Arduino that can do HCE as well. (Technically most Arduino PN532 Chip's which are used in a lot of USB readers as well can do HCE but it is a bit undocumented on how to do it - see section 4 of https://www.nxp.com/docs/en/user-guide/141520.pdf)

There are some other chips that can act as static data NFC devices the also have an I2C interface to write the static data but allow a "pass through" mode to the I2C interface, again these tend to be NFC Type 4 but do some of the HCE type work for you. e.g. the M24SR04-Y https://www.st.com/resource/en/datasheet/m24sr04-g.pdf can do it

So technically possible with a variety of methods but all not that simple to implement BUT not "Sticker" type format of NFC devices tend to be very simple NFC device as the format restricts the complexity of the hardware contained in them.

Andrew
  • 8,198
  • 2
  • 15
  • 35
  • Thanks for all that info, very helpful. The URL doesn't need to have any security in terms of being completely random or hard to guess, it just needs to be different for each scan. It can be a random number, even a counter if that's all that's possible. Looking for the cheapest and easiest to implement. Ideally I would like to do it with a sticker alone, if that's not possible, is there a plug and play solution that I can just plug into a computer and have a program that interfaces with it to change the URL? Or do I have to build my own using a kit? – user185813 Jul 26 '20 at 19:21
  • The JavaCard is the closest to the sticker in terms of cost around $10 per card, it can be stuck to surfaces, the code in the github repo is closest to what you want, the Java to just need to change the payload to be a changing URL is simple to do generate a random number in Java to add to the URL. For something to just plug in to a computer is a lot of USB readers can do Host Card emulation and the computer can change the URL every time it is read, but this is more complex code to write yourself but the computer has to be always on running the program but a cheap Raspberry Pi can do that. – Andrew Jul 26 '20 at 21:47
  • Thanks for the info, this is very helpful. I may try to make it work with tags and counters first and if that doesn't work I will try this solution. – user185813 Jul 29 '20 at 04:26