title: Protect NDEF Message on Mifare Classic Tag Android
body: <p>In my android application, I am reading data from a mifare classic tag using <a href="http://mifareclassicdetectiononandroid.blogspot.com/2011/04/reading-mifare-classic-1k-from-android.html" rel="nofollow">the code on this website</a>. Since it requires authentication, I can change the Key B of some sectors, and protect my data from being read by others. </p>
  
  <p>However, instead of my own formatted data, I'd like to store ndef messages. The code I use for reading ndef is as following</p>
  
  <pre><code>Tag myTag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
  Ndef ndefTag = Ndef.get(myTag);
  NdefMessage ndefMesg = ndefTag.getCachedNdefMessage();
  NdefRecord[] ndefRecords = ndefMesg.getRecords();
  byte[] mesg = ndefRecords[0].getPayload();
  String info = new String(mesg, Charset.forName("UTF-8"));
  </code></pre>
  
  <p>It doesn't require any authentication, so my problem is how can I protect an ndef message from being read by others?</p>
  
  <p><strong>Edit:</strong> When I say protect I don't mean making the tag readonly. I mean only I, or whoever has the key, can write ndef message to the tag</p>