我正在试验 JavaCard 的小程序——它是非常简单的 SCWS serverlet(基本上来自 Gemalto Dev Suite 的模板)。我希望它在卡上存储一些数据 - 怎么做?我只找到了一些关于线性和循环文件的理论材料。
//编辑
我设法找到了这样的东西:
private byte createfile()
{
try{
AdminFileView uiccAdminFileView = AdminFileViewBuilder.getTheUICCAdminFileView(JCSystem.CLEAR_ON_RESET);
if(uiccAdminFileView == null){
return 'a';
}
uiccAdminFileView.select((short)0x7F60);
EditHandler editHandler = (EditHandler) HandlerBuilder.buildTLVHandler(HandlerBuilder.EDIT_HANDLER,
(short) 50);
editHandler.clear();
editHandler.appendArray(CreateEF, (short) 0,(short) CreateEF.length);
uiccAdminFileView.createFile(editHandler);
data[0] = (byte) 0x12;
data[1] = (byte) 0x34;
data[2] = (byte) 0x56;
uiccAdminFileView.select((short)0xEE00);
uiccAdminFileView.updateBinary((short) 0, data, (short)0, (short)3);
} catch(UICCException e){
return (byte)e.getReason();
}
return 'b';
}
但此时它每次都返回“a”——据我所知,它与小程序的访问权限有关。