gradle+jcdk 构建最精简applet
This commit is contained in:
29
src/com/zuc/zuc256/MyApplet.java
Normal file
29
src/com/zuc/zuc256/MyApplet.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user