Permalink
Browse files

Fixes for NDEF keys

  • Loading branch information...
1 parent c519bc6 commit d30d48a22dd77f5e769b19d6d3885453d2f5d777 K. Townsend committed Oct 23, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 Adafruit_NFCShield_I2C.cpp
@@ -722,6 +722,9 @@ uint8_t Adafruit_NFCShield_I2C::mifareclassic_FormatNDEF (void)
uint8_t sectorbuffer2[16] = {0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1, 0x03, 0xE1};
uint8_t sectorbuffer3[16] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0x78, 0x77, 0x88, 0xC1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ // Note 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 must be used for key A
+ // for the MAD sector in NDEF records (sector 0)
+
// Write block 1 and 2 to the card
if (!(mifareclassic_WriteDataBlock (1, sectorbuffer1)))
return 0;
@@ -766,6 +769,9 @@ uint8_t Adafruit_NFCShield_I2C::mifareclassic_WriteNDEFURI (uint8_t sectorNumber
if ((len < 1) || (len > 38))
return 0;
+ // Note 0xD3 0xF7 0xD3 0xF7 0xD3 0xF7 must be used for key A
+ // in NDEF records
+
// Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message)
uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t sectorbuffer2[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

0 comments on commit d30d48a

Please sign in to comment.