MIFAREクラシックカードのセクタを認証しようとしています。私はtwinlinx mymaxステッカーを使用しています(ほとんどのBluetoothデバイスでNFCを有効にしています)。接続されたNFCタグにコマンドを送信します。私はすでに接続して、超軽量Cタグを使ってデータを送受信しましたが、これまではMifare Classicにアクセスできませんでした。ここに私の認証コードは次のとおりです。MIFARE CLASSICからの返信なし
private boolean authenticate(int sector, byte[] key, boolean keyA) {
byte[] cmd = new byte[12];
// First byte is the command
if (keyA) {
cmd[0] = 0x60; // phHal_eMifareAuthentA
} else {
cmd[0] = 0x61; // phHal_eMifareAuthentB
}
// Second byte is block address
cmd[1] = (byte) 0x03;
// Next 6 bytes are the key
System.arraycopy(key, 0, cmd, 2, 6);
// Next 4 bytes is the UID
System.arraycopy(Answer, 3, cmd, 8,4);
byte[] test = null;
//this makes a connection to the NFC tag (and this works)
TR.ConnectToExternalCard(AUTH, (byte)0x00);
//checking if the tag is still connected
if (TR.isCardPresent() == true){
//sending command to authenticate
test = TR.SendCommandPropAndWaitResponse(cmd, (byte) 0x00);
}
try {
if (test != null) {
return true;
}
}
私は標準MIFAREクラシックキーを使用している、タグは、工場から新鮮です。タグに送信される完全なコマンドは、(バイト単位)である。
[0x60、0x3の、0xFFで、0xffで、0xffで、0xffで、0xffで、0xffで、0xf3、0xf4、0xa9、0xfb]
任意のアイデア?タグは反応しないようです...他のクラシックタグにアクセスしようとしましたが、成功しませんでした。ありがとう!