gradle+jcdk 构建最精简applet

This commit is contained in:
zcy
2025-09-03 20:57:53 +08:00
parent 80b02f6139
commit 5122f8eade
8 changed files with 467 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package com.zuc.zuc256;
import javacard.framework.*;
/**
* 最小 JavaCard Applet 示例
*/
public class MyApplet extends Applet {
// 构造函数:一般初始化状态
protected MyApplet() {
register(); // 必须调用,完成注册
}
// 安装方法CAP 文件安装时调用
public static void install(byte[] bArray, short bOffset, byte bLength) {
new MyApplet();
}
// 处理 APDU 命令
@Override
public void process(APDU apdu) throws ISOException {
if (selectingApplet()) {
return; // 选择时无需处理数据
}
// 默认:所有指令不支持
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}