Finished template
This commit is contained in:
parent
4afc9ca762
commit
dd68840fff
12
build.xml
12
build.xml
@ -5,9 +5,11 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<property environment="env"/>
|
<property environment="env"/>
|
||||||
<property name="EXPORT" value="build/crystal.cap" />
|
<property name="EXPORT" value="crystal.cap" />
|
||||||
<property name="RID" value="A000000648" />
|
<property name="RID" value="A000000648" />
|
||||||
<property name="AID" value="2F0002" />
|
<property name="AID" value="2F0002" />
|
||||||
|
<property name="JC_CLASSIC_HOME" value="${basedir}/oracle_javacard_sdks/jc221_kit"/>
|
||||||
|
<property name="JC_HOME" value="${basedir}/oracle_javacard_sdks/jc305u4_kit"/>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete dir="build" />
|
<delete dir="build" />
|
||||||
@ -15,7 +17,7 @@
|
|||||||
|
|
||||||
<target name="check.sdk">
|
<target name="check.sdk">
|
||||||
<condition property="jcsdk.exists">
|
<condition property="jcsdk.exists">
|
||||||
<available file="${env.JC_HOME}" type="dir" />
|
<available file="${JC_HOME}" type="dir" />
|
||||||
</condition>
|
</condition>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@ -45,8 +47,8 @@
|
|||||||
<target name="build" depends="clean,check.tool,build.dir,setup" if="tool.exists">
|
<target name="build" depends="clean,check.tool,build.dir,setup" if="tool.exists">
|
||||||
<!-- ant-javacard task from javacard.pro -->
|
<!-- ant-javacard task from javacard.pro -->
|
||||||
<taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpath="tools/ant-javacard.jar" />
|
<taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpath="tools/ant-javacard.jar" />
|
||||||
<javacard jckit="${env.JC_HOME}">
|
<javacard jckit="${JC_HOME}">
|
||||||
<cap aid="${RID}" output="${EXPORT}" sources="src/org/hacdc/crystal" targetsdk="${env.JC_CLASSIC_HOME}">
|
<cap aid="${RID}" output="build/${EXPORT}" sources="src/main/java/org/hacdc/crystal" targetsdk="${JC_CLASSIC_HOME}">
|
||||||
<applet class="org.hacdc.crystal.Crystal" aid="${RID}${AID}" />
|
<applet class="org.hacdc.crystal.Crystal" aid="${RID}${AID}" />
|
||||||
<import jar="tools/bcprov-jdk18on-1.80.jar" />
|
<import jar="tools/bcprov-jdk18on-1.80.jar" />
|
||||||
</cap>
|
</cap>
|
||||||
@ -57,7 +59,7 @@
|
|||||||
<target name="install" depends="build">
|
<target name="install" depends="build">
|
||||||
<java jar="tools/gp.jar" fork="true">
|
<java jar="tools/gp.jar" fork="true">
|
||||||
<arg value="-reinstall" />
|
<arg value="-reinstall" />
|
||||||
<arg value="${EXPORT}" />
|
<arg value="build/${EXPORT}" />
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
35
src/main/java/org/hacdc/crystal/Crystal.java
Normal file
35
src/main/java/org/hacdc/crystal/Crystal.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package org.hacdc.crystal;
|
||||||
|
|
||||||
|
import javacard.framework.APDU;
|
||||||
|
import javacard.framework.Applet;
|
||||||
|
import javacard.framework.ISO7816;
|
||||||
|
import javacard.framework.ISOException;
|
||||||
|
|
||||||
|
public class Crystal extends Applet {
|
||||||
|
public static void install(byte[] buffer, short offset, byte length){
|
||||||
|
// GP-compliant JavaCard applet registration
|
||||||
|
new Crystal().register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(APDU apdu){
|
||||||
|
// Process APDU commands
|
||||||
|
if (selectingApplet()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = apdu.getBuffer();
|
||||||
|
switch (buffer[ISO7816.OFFSET_INS]) {
|
||||||
|
case (byte) 0x01:
|
||||||
|
processCMD1(apdu);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Unknown Instruction
|
||||||
|
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processCMD1(APDU apdu) throws ISOException {
|
||||||
|
// Process command 1
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
package org.hacdc.crystal;
|
|
||||||
|
|
||||||
import javacard.framework.APDU;
|
|
||||||
import javacard.framework.Applet;
|
|
||||||
|
|
||||||
public class Crystal extends Applet {
|
|
||||||
public static void install(byte[] buffer, short offset, byte length){
|
|
||||||
// GP-compliant JavaCard applet registration
|
|
||||||
new Crystal().register();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void process(APDU apdu){
|
|
||||||
// Process APDU commands
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
.level = SEVERE
|
|
Loading…
x
Reference in New Issue
Block a user