我已经编写了一个applet,并将其安装在智能卡中。但是我不知道如何读取和写入数据到智能卡?
private void readName(APDU apdu) throws ISOException
{
byte[] apduBuffer = apdu.getBuffer();
for (byte i=0; i<userName.length; i++)
{
apduBuffer[5+i] = userName[(byte)i] ;
}
apdu.setOutgoing();
apdu.setOutgoingLength((short)userName.length);
apdu.sendBytes((short)5, (short)userName.length);
}从智能卡读取数据的代码是否正确?
请告诉我如何使用javacard将数据写入智能卡。
发布于 2012-02-15 12:49:50
我找到了solution.actually,我正在使用eclipse作为编辑器,Java卡插件安装在it.when中,我在智能卡上运行程序,它在以前的applet上安装最新的applet,每个time.To都看到结果,我们可以使用pyapdu工具,它是非常好的。谢谢你的回复..
发布于 2011-11-25 23:10:12
您的卡要么是接触卡,要么是非接触卡。既然您说您已经安装了applet,那么我假设您有卡的密钥。
如果是这样,为了与您的卡通信,您需要执行以下操作:
在响应中,您将看到从Applet发送的字节数:
apdu.setOutgoingLength((short)userName.length);
apdu.sendBytes((short)5, (short)userName.length);如果你需要更多的东西,你需要提供更多关于你正在尝试完成的细节。
https://stackoverflow.com/questions/8264850
复制相似问题