如何使用java card apdu从智能卡写入和读取数据 [英] how to write and read data from smart card using java card apdu

查看:1072
本文介绍了如何使用java card apdu从智能卡写入和读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个applet并将其安装在智能卡中。但我不知道如何读取和写入智能卡数据?

I have written an applet and installed it in smart card. But I don't know how to read and write data to smart card?

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);
}

从智能卡读取数据是否正确?

Is it right code to read data from smart card?

请告诉我如何使用javacard将数据写入智能卡。

please tell me how to write data to smart card using javacard.

推荐答案

我找到了解决方案。实际上我正在使用eclipse作为编辑器java卡插件安装在它。当我在智能卡上运行程序时,它每次都在以前的applet上安装最新的applet。看到结果我们可以使用pyapdu工具它非常好。感谢所有回复..

I found solution.actually I am using eclipse as a editor java card plugin are install in it.when I run program on Smart Card it install latest applet on previous applet every time.To see result we can use pyapdu tool it is very good. thanks for all the response..

这篇关于如何使用java card apdu从智能卡写入和读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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