我是NFC Android的新手,我已经坚持了几天试图通过身份验证获得NTAG212 Mifare Ultralight的第7页,我已经有了PWD和PACK来完成基于NTAG212文档的PWD_AUTH.
我这样做…
//assume password as array of bytes
//assume pack as array of bytes
try{
nfc.connect();
byte[] cmd1 = nfc.transceive(new byte[]{ (byte) 0x30, (byte) 0x00 }); //read the page 0 to make the NFC active
nfc.transceive(new byte[]{
(byte) 0x1B, //command for PWD_AUTH
pass[0],
pass[1],
pass[2],
pass[3]
});
byte[] cmd4 = nfc.transceive(new byte[]{ (byte) 0x30, (byte) 0x04 }); //read the page 4
}catch(TagLostException e){
e.printStackTrace();
}catch(IOException e){
e.printStachTrace();
}finally{
try{
nfc.close();
}catch(Exception e){
//display failed to close
}
}