Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 55 additions & 51 deletions Applet/AndroidSEProvider/build.xml
Original file line number Diff line number Diff line change
@@ -1,77 +1,81 @@
<project name="AndroidSEProvider" default = "default">
<import file="../build.xml" as="common" />
<project name="AndroidSEProvider" default="default">
<import file="../build.xml" as="common"/>
<!-- Properties - other properties are included from build_common.xml -->
<target name = "androidse.init" >
<property environment="env"/>
<property name="common.src.dir" value="${applet.common.src}"/>
<property name="androidse.src.dir" value="${AndroidSE.dir}/src"/>
<property name="androidse.home" value="${env.JC_HOME_SIMULATOR}"/>
<property name="build.sysclasspath" value="ignore" />
<!-- Taskdefs -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath> <pathelement location="${androidse.home}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef name="convert"
classname="com.sun.javacard.ant.tasks.ConverterTask"
classpath="${androidse.home}/lib/jctasks.jar" />
<taskdef name="verifycap"
classname="com.sun.javacard.ant.tasks.VerifyCapTask"
classpath="${androidse.home}/lib/jctasks.jar" />
<path id="androidse.jars"
<target name="androidse.init">
<property environment="env"/>
<property name="common.src.dir" value="${applet.common.src}"/>
<property name="androidse.src.dir" value="${AndroidSE.dir}/src"/>
<property name="androidse.home" value="${env.JC_HOME_SIMULATOR}"/>
<property name="build.sysclasspath" value="ignore"/>
<!-- Taskdefs -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${androidse.home}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef name="convert"
classname="com.sun.javacard.ant.tasks.ConverterTask"
classpath="${androidse.home}/lib/jctasks.jar"/>
<taskdef name="verifycap"
classname="com.sun.javacard.ant.tasks.VerifyCapTask"
classpath="${androidse.home}/lib/jctasks.jar"/>
<path id="androidse.jars"
description="Sets the classpath to Java Card API">
<pathelement path="${AndroidSE.dir}/lib/gpapi-upgrade.jar"/>
<pathelement path="${androidse.home}/lib/api_classic.jar"/>
<pathelement path="${androidse.home}/lib/api_classic_annotations.jar"/>
</path>
<path id="androidse.tools.jars"
description="Sets the classpath to Java Card API and tools">
<pathelement path="${AndroidSE.dir}/lib/gpapi-upgrade.jar"/>
<pathelement path="${androidse.home}/lib/api_classic.jar" />
<pathelement path="${androidse.home}/lib/tools.jar" />
<pathelement path="${androidse.home}/lib/api_classic_annotations.jar" />
</path>
<mkdir dir="${applet.build.dir}/classes"/>
</target>
<target name="androidse.compile" depends="androidse.init">
<pathelement path="${AndroidSE.dir}/lib/gpapi-upgrade.jar"/>
<pathelement path="${androidse.home}/lib/api_classic.jar"/>
<pathelement path="${androidse.home}/lib/api_classic_annotations.jar"/>
</path>
<path id="androidse.tools.jars"
description="Sets the classpath to Java Card API and tools">
<pathelement path="${AndroidSE.dir}/lib/gpapi-upgrade.jar"/>
<pathelement path="${androidse.home}/lib/api_classic.jar"/>
<pathelement path="${androidse.home}/lib/tools.jar"/>
<pathelement path="${androidse.home}/lib/api_classic_annotations.jar"/>
</path>
<mkdir dir="${applet.build.dir}/classes"/>
</target>

<target name="androidse.compile" depends="androidse.init">
<pathconvert property="classpath" refid="androidse.jars"/>
<javac
destdir="${applet.build.dir}/classes"
source="7"
target="7"
debug="yes"
includeantruntime="no"
bootclasspath="${classpath}">
<javac
destdir="${applet.build.dir}/classes"
source="7"
target="7"
debug="yes"
includeantruntime="no"
bootclasspath="${classpath}">
<src path="${common.src.dir}"/>
<src path="${androidse.src.dir}"/>
</javac>
</target>

<target name="androidse.convert" depends="androidse.compile">
<convert dir="${applet.build.dir}/classes" Configfile="${AndroidSE.dir}/AndroidSE_3_0_5.opt">
<convert dir="${applet.build.dir}/classes"
Configfile="${AndroidSE.dir}/AndroidSE_3_0_5.opt">
<classpath refid="androidse.tools.jars"/>
</convert>

<copy todir="${applet.build.dir}" flatten="true">
<fileset dir="${applet.build.dir}/classes">
<include name="**/*.cap"/>
<include name="**/*.jca"/>
<include name="**/*.exp"/>
</fileset>
<regexpmapper from="(.*)\.(.*)"
to="AndroidSE.\2"
casesensitive="yes"/>
to="AndroidSE.\2"
casesensitive="yes"/>
</copy>
</target>

<target name="androidse.verify" depends="androidse.convert">
<verifycap capfile="${applet.build.dir}/AndroidSE.cap" outfile="${applet.build.dir}/digest.txt">
<exportfiles dir="${AndroidSE.dir}/api_export_files_3.0.5" includes="**/*.exp"/>
<verifycap capfile="${applet.build.dir}/AndroidSE.cap"
outfile="${applet.build.dir}/digest.txt">
<exportfiles dir="${AndroidSE.dir}/api_export_files_3.0.5"
includes="**/*.exp"/>
<classpath refid="androidse.tools.jars"/>
</verifycap>
</target>
<target name="default" depends="androidse.verify" />

<target name="default" depends="androidse.verify"/>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javacard.security.AESKey;

public class KMAESKey implements KMMasterKey {

private AESKey aesKey;

public KMAESKey(AESKey key) {
Expand All @@ -35,7 +36,7 @@ public void setKey(byte[] keyData, short kOff) {
public AESKey getKey() {
return aesKey;
}

public short getKeySizeBits() {
return aesKey.getSize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@

public class KMAndroidSEApplet extends KMKeymasterApplet implements OnUpgradeListener {

KMAndroidSEApplet(){
super(new KMAndroidSEProvider());
}
/**
* Installs this applet.
*
* @param bArray the array containing installation parameters
* @param bOffset the starting offset in bArray
* @param bLength the length in bytes of the parameter data in bArray
*/
public static void install(byte[] bArray, short bOffset, byte bLength) {
new KMAndroidSEApplet().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
KMAndroidSEApplet() {
super(new KMAndroidSEProvider());
}

/**
* Installs this applet.
*
* @param bArray the array containing installation parameters
* @param bOffset the starting offset in bArray
* @param bLength the length in bytes of the parameter data in bArray
*/
public static void install(byte[] bArray, short bOffset, byte bLength) {
new KMAndroidSEApplet().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}

@Override
public void onCleanup() {
Expand Down Expand Up @@ -66,7 +67,7 @@ public Element onSave() {

// Create element.
Element element = UpgradeManager.createElement(Element.TYPE_SIMPLE,
primitiveCount, objectCount);
primitiveCount, objectCount);
element.write(provisionStatus);
element.write(keymasterState);
repository.onSave(element);
Expand Down
Loading