Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mifare Classic ISO 14443-3A with 7 byte UID returning only 4 bytes #35

Open
matrad opened this issue Nov 21, 2019 · 0 comments
Open

Mifare Classic ISO 14443-3A with 7 byte UID returning only 4 bytes #35

matrad opened this issue Nov 21, 2019 · 0 comments

Comments

@matrad
Copy link

matrad commented Nov 21, 2019

When calling

byte[] tagId = ndefOperations.getTagInfo().getId();

I only get a 4-byte UID, but not as expected a 7-byte-UID

For Example I get the UID 04 BC D4 C2 instead of the full UID 04 BC D4 C2 E0 5C 80

I use this method to extract the TAG-ID:

byte[] tagId = ndefOperations.getTagInfo().getId();
String cardUid = "";
for(int i = 0; i < tagId.length; i++ ){
  cardUid += String.format("%02X ", tagId [i]);
}

I get the correct UID using the APU-Command:

              System.out.println("Job ID " + jobId + " GET UID THE OLD Common way....");
              CardTerminal terminal2 = terminals.get(0);
              javax.smartcardio.Card card2 = terminal2.connect("*");
              CardChannel channel2 = card2.getBasicChannel();
              byte[] cmdApduGetCardUid = new byte[]{
                      (byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x00};            
              ResponseAPDU respApdu = channel2.transmit(
                                                 new CommandAPDU(cmdApduGetCardUid));
              String cardId = "";
              if(respApdu.getSW1() == 0x90 && respApdu.getSW2() == 0x00){
                  byte[] baCardUid = respApdu.getData();
                  for(int i = 0; i < baCardUid.length; i++ ){
                  	cardId += String.format("%02X ", baCardUid [i]);
                  }
              }
              System.out.println("Card ID is "+cardId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant