How To Use The Secure NFC Sample

// Expert user has replied.
A Alan Dimaano 3 years 7 months ago
43 2 0

How can I use the Secure NFC sample found here --> Secure NFC - Zebra Technologies Online Documentation
 
What should I input in the 'Enter Data' and 'Enter Value' text boxes?
 
I downloaded the project and set it up in Android Studio. Doing some debugging to find out what happens in the code and the data involved.
 
I'm currently creating a proof of concept and I need to understand all the algorithms and commands involved.
 
Hope you can help me. Thanks.

Please Register or Login to post a reply

2 Replies

K Kanagal Raj Ramaswamy

The Secure NFC sample demonstrates how to use the Secure NFC APIs and the keys used in the sample are hard-coded  for a specific SAM and Tag.
Before using the Secure NFC Sample you have to obtain the SAM and TAG keys from company/person who personalized your SAM and TAG, then modify sample to use those SAM and TAG keys required for the authentication.

SAM Authentication:
Modify the below method in MainActivity.Java in the sample to use right SAM key and its Authentication Keys.
mifareSam.authenticateSam(authKey, samKey, null);

MifareDesfire TAG Authentication:
Modify the below method in MifareDesfireTagOperation.java in the sample to use right SAM key and TAG Keys.
mifareDesfire.authenticate(AuthenticateType.NATIVE,  MifareTagConstants.CARD_KEY_FOR_READ_WRITE, lSamKeyForReadWrite, null);

MifarePlusSL3 TAG Authentication:

Modify the below method in MifarePlusSl3TagOperation.java in the sample to use right SAM key and TAG Keys.
mifarePlusSl3.firstAuthentication( MifareTagConstants.KEY_A_DATA_BLOCK, lSamKeyForDataBlock, null, null);

Once this is done, then you can use your sample to read data from and write data to TAG.

Y Yanis Dalabiras

Hey Alan, I've not run the sample myself, but after looking at the source it seems pretty clear.   To read the tag, just press the Read button, and scan the tag ( data should appear in the topmost edittext.  For write operation, place in an integer value in the lower edittext, press the Write button, and scan the tag.  Inc and dec operations should work like write, accept you don't need to change the value in the lower edittext, the callback for those buttons will automatically pull the current value out, and inc or dec the value before writing to the tag.

CONTACT
Can’t find what you’re looking for?