如何从Java中读取EMV SmartCard中的PAN [英] How do I read the PAN from an EMV SmartCard from Java

查看:161
本文介绍了如何从Java中读取EMV SmartCard中的PAN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用智能卡读卡器读取Maestro / Mastercard的帐号。我正在使用Java 1.6及其javax.smartcardio包。我需要发送APDU命令,它会询问存储在卡芯片上的EMV应用程序的PAN号。问题是,我找不到常规字节数组来构造APDU命令,它将在任何地方返回所需数据...

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 ask EMV application stored on card's chip for PAN number. Problem is, I cannot find regular byte array to construct APDU command which will return needed data anywhere...

推荐答案

你不应该'需要进一步包装APDU。 API层应该处理这个问题。

You shouldn't need to wrap the APDU further. The API layer should take care of that.

看起来0x6D00响应只是意味着应用程序不支持INS。

It looks like the 0x6D00 response just means that the application did not support the INS.

现在就进行故障排除,但是你选择MasterCard应用程序就开始了吧?

Just troubleshooting now, but you did start out by selecting the MasterCard application, right?

即类似这样的事情:

void selectApplication(CardChannel channel) throws CardException {
  byte[] masterCardRid = new byte[]{0xA0, 0x00, 0x00, 0x00, 0x04};
  CommandAPDU command = new CommandAPDU(0x00, 0xA4, 0x04, 0x00, masterCardRid);
  ResponseAPDU response = channel.transmit(command);
  return response.getData();
}

这篇关于如何从Java中读取EMV SmartCard中的PAN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆