How do I read the PAN from an EMV SmartCard from Java

前端 未结 6 979
失恋的感觉
失恋的感觉 2020-12-13 22:15

I need to read account number from Maestro/Mastercard with smart card reader. I am using Java 1.6 and its javax.smartcardio package. I need to send APDU command which will a

6条回答
  •  温柔的废话
    2020-12-13 23:05

    Did you try looking up in your documentation what 0x6D00 means? It looks like it might mean that the ENVELOPE command is not supported. Have you tried using T=0 protocol instead of T=1?

    I would not expect my example to work on your card. I don't know which APDUs the Maestro/MasterCard-supports, so I couldn't give you a working example.

    Try giving the command an explicit expected length like this:

    byte[] readPan(CardChannel channel) throws CardException {
      CommandAPDU command = new CommandAPDU(0x00, 0xB2, 0x5a, 0x14, 250);
      ResponseAPDU response = channel.transmit(command);
      return response.getData();
    }
    

提交回复
热议问题