Initialize a new Java Card project
This commit is contained in:
parent
3069a21450
commit
6b839f84b0
15 changed files with 360 additions and 0 deletions
16
hwb1/.classpath
Normal file
16
hwb1/.classpath
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path=".gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="var" path="Sample_Platform_HOME/lib/api_classic.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:C:\Users\Manuel\Downloads\java_card_2023\java_card\java_card_kit_310_plus_sim\docs\api"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="var" path="Sample_Platform_HOME/lib/api_classic_annotations.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
1
hwb1/.gen/.gitignore
vendored
Normal file
1
hwb1/.gen/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/hwb1/
|
8
hwb1/.gen/hwb1/MyAppletStrings.java
Normal file
8
hwb1/.gen/hwb1/MyAppletStrings.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package hwb1;
|
||||
|
||||
final class MyAppletStrings {
|
||||
|
||||
static final byte[] Package = new byte[] {0x68, 0x77, 0x62, 0x31, };
|
||||
static final byte[] AppletName = new byte[] {0x4d, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x74, };
|
||||
|
||||
}
|
29
hwb1/.javacard_project
Normal file
29
hwb1/.javacard_project
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<root>
|
||||
<entries>
|
||||
<key>src/hwb1</key>
|
||||
<value>
|
||||
<entry>
|
||||
<key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">IsJavaCardPackage</key>
|
||||
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">1</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">AID</key>
|
||||
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">52C4C7C95C1337</value>
|
||||
</entry>
|
||||
</value>
|
||||
</entries>
|
||||
<entries>
|
||||
<key>src/hwb1/MyApplet.java</key>
|
||||
<value>
|
||||
<entry>
|
||||
<key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">AID</key>
|
||||
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">52C4C7C95C0420</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">IsJavaCardApplet</key>
|
||||
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">1</value>
|
||||
</entry>
|
||||
</value>
|
||||
</entries>
|
||||
</root>
|
28
hwb1/.project
Normal file
28
hwb1/.project
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>hwb1</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.oracle.javacard.jcdk.core.projectbuild.JCDKCleanBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.oracle.javacard.jcdk.core.projectbuild.JCDKBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>com.oracle.javacard.jcdk.core.projectbuild.JCDKNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
66
hwb1/apdu_scripts/cap-hwb1.script
Normal file
66
hwb1/apdu_scripts/cap-hwb1.script
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
// Cap File Installation APDU Script
|
||||
//
|
||||
// Package: hwb1.hwb1
|
||||
// Package AID: //aid/52C4C7C95C/1337
|
||||
//
|
||||
|
||||
powerup;
|
||||
|
||||
// Select the installer applet
|
||||
0x00 0xA4 0x04 0x00 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
|
||||
0x80 0xB0 0x00 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Header.cap
|
||||
0x80 0xB2 0x01 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x01 0x00 0x15 0x01 0x00 0x12 0xDE 0xCA 0xFF 0xED 0x03 0x02 0x04 0x00 0x01 0x07 0x52 0xC4 0xC7 0xC9 0x5C 0x13 0x37 0x00 0x7F;
|
||||
0x80 0xBC 0x01 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Directory.cap
|
||||
0x80 0xB2 0x02 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x25 0x00 0x12 0x00 0x25 0x00 0x0B 0x00 0x15 0x00 0x16 0x00 0x23 0x00 0x1F 0x00 0x1C 0x00 0x09 0x00 0x00 0x00 0x68 0x02 0x29 0x00 0x00 0x00 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x02 0x00 0x08 0x04 0x00 0x02 0x00 0x0C 0x02 0x01 0x00 0x7F;
|
||||
0x80 0xBC 0x02 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Import.cap
|
||||
0x80 0xB2 0x04 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x08 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F;
|
||||
0x80 0xBC 0x04 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Applet.cap
|
||||
0x80 0xB2 0x03 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x03 0x00 0x0E 0x03 0x00 0x0B 0x01 0x07 0x52 0xC4 0xC7 0xC9 0x5C 0x04 0x20 0x00 0x01 0x7F;
|
||||
0x80 0xBC 0x03 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Class.cap
|
||||
0x80 0xB2 0x06 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x23 0x00 0x00 0x00 0x80 0x03 0x00 0xFF 0x00 0x07 0x01 0x00 0x00 0x00 0x15 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00 0x81 0x00 0x00 0xFF 0x00 0x7F;
|
||||
0x80 0xB4 0x06 0x00 0x06 0x01 0x00 0x00 0x00 0x00 0x01 0x7F;
|
||||
0x80 0xBC 0x06 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/Method.cap
|
||||
0x80 0xB2 0x07 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0x1F 0x00 0x01 0x30 0x8F 0x00 0x01 0x8C 0x00 0x00 0x7A 0x01 0x10 0x18 0x8C 0x00 0x02 0x18 0x8B 0x00 0x03 0x7A 0x00 0x20 0x7A 0x01 0x10 0x18 0x8C 0x00 0x7F;
|
||||
0x80 0xB4 0x07 0x00 0x02 0x04 0x7A 0x7F;
|
||||
0x80 0xBC 0x07 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/StaticField.cap
|
||||
0x80 0xB2 0x08 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x08 0x00 0x1F 0x08 0x00 0x1C 0x00 0x04 0x00 0x02 0x00 0x02 0x03 0x00 0x04 0x68 0x77 0x62 0x31 0x03 0x00 0x08 0x4D 0x79 0x41 0x70 0x70 0x6C 0x65 0x74 0x00 0x00 0x00 0x00 0x7F;
|
||||
0x80 0xBC 0x08 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/ConstantPool.cap
|
||||
0x80 0xB2 0x05 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x05 0x00 0x19 0x05 0x00 0x16 0x00 0x05 0x06 0x00 0x00 0x0A 0x01 0x00 0x02 0x00 0x06 0x80 0x03 0x00 0x03 0x80 0x03 0x01 0x06 0x81 0x00 0x00 0x7F;
|
||||
0x80 0xBC 0x05 0x00 0x00 0x7F;
|
||||
|
||||
// hwb1/javacard/RefLocation.cap
|
||||
0x80 0xB2 0x09 0x00 0x00 0x7F;
|
||||
0x80 0xB4 0x09 0x00 0x0C 0x09 0x00 0x09 0x00 0x00 0x00 0x05 0x04 0x03 0x07 0x04 0x0A 0x7F;
|
||||
0x80 0xBC 0x09 0x00 0x00 0x7F;
|
||||
|
||||
0x80 0xBA 0x00 0x00 0x00 0x7F;
|
||||
|
||||
|
||||
//powerdown;
|
15
hwb1/apdu_scripts/create-hwb1.hwb1.MyApplet.script
Normal file
15
hwb1/apdu_scripts/create-hwb1.hwb1.MyApplet.script
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
// Applet Instantiation APDU Script
|
||||
//
|
||||
// Package: hwb1.hwb1
|
||||
// Package AID: //aid/52C4C7C95C/1337
|
||||
// Applet: hwb1.MyApplet
|
||||
// Applet AID: //aid/52C4C7C95C/0420
|
||||
//
|
||||
|
||||
// Select the installer applet
|
||||
0x00 0xA4 0x04 0x00 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
|
||||
|
||||
// Create hwb1.MyApplet applet
|
||||
0x80 0xB8 0x00 0x00 0x09 0x07 0x52 0xC4 0xC7 0xC9 0x5C 0x04 0x20 0x00 0x7F;
|
12
hwb1/apdu_scripts/digest-hwb1.txt
Normal file
12
hwb1/apdu_scripts/digest-hwb1.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
Digest for hwb1/javacard/ConstantPool.cap [SHA-256: 6c5bf615cd3746d52c815e8264b910a41a94217161862a7520087799fd03098b]
|
||||
Digest for hwb1/javacard/Debug.cap [SHA-256: 0247d72e4a6b685f23bc380c218522f6e8906d38158579ad5c57177ae67f18cc]
|
||||
Digest for hwb1/javacard/Directory.cap [SHA-256: a38a6a20b2537681a3697a2d003fbc480d4b529618a7dfae8eeeff8fd952514e]
|
||||
Digest for hwb1/javacard/RefLocation.cap [SHA-256: b2b3f5e23eee662b8c406212d5cb291959a8eeddb92e58b9a45941c0b91388be]
|
||||
Digest for hwb1/javacard/Applet.cap [SHA-256: 0aefcbcd7c0a951f88b522d9a840fb851c15c1f92cf8cd2ac55ec1d188e9687b]
|
||||
Digest for hwb1/javacard/Descriptor.cap [SHA-256: ae5b4ee1c0c7b98f7916a7a75e0521e7ae1450d1a13897f8f92764503edc8db9]
|
||||
Digest for hwb1/javacard/Class.cap [SHA-256: af7f91359fc2e4feefa1653905001e7589a5cb1d241c960b99d749f3e828f366]
|
||||
Digest for hwb1/javacard/Import.cap [SHA-256: 8cc3642a6d49023dc39aece31584cf15757e6bbcbc1e299514366eae84efce86]
|
||||
Digest for hwb1/javacard/Method.cap [SHA-256: 651231359c6bb65fbcb0e3a49f52cee1a682ed7e97610365b374583638757365]
|
||||
Digest for hwb1/javacard/Header.cap [SHA-256: 30bc8192745192eecda697856d62c5d7734b17897944959c6c8876caf6949e41]
|
||||
Digest for hwb1/javacard/StaticField.cap [SHA-256: 983c0b9dbdc069d517cb18c91ff8d9816b50f1f949ca135f828fcaa4faca3b2e]
|
||||
Verification completed with 0 warnings and 0 errors.
|
12
hwb1/apdu_scripts/select-hwb1.hwb1.MyApplet.script
Normal file
12
hwb1/apdu_scripts/select-hwb1.hwb1.MyApplet.script
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
// Applet Selection APDU Script
|
||||
//
|
||||
// Package: hwb1.hwb1
|
||||
// Package AID: //aid/52C4C7C95C/1337
|
||||
// Applet: hwb1.MyApplet
|
||||
// Applet AID: //aid/52C4C7C95C/0420
|
||||
//
|
||||
|
||||
// Select hwb1.MyApplet applet
|
||||
0x00 0xA4 0x04 0x00 0x07 0x52 0xC4 0xC7 0xC9 0x5C 0x04 0x20 0x7F;
|
9
hwb1/configurations/hwb1.conf
Normal file
9
hwb1/configurations/hwb1.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
-i
|
||||
-classdir ..\bin
|
||||
-applet 0x52:0xC4:0xC7:0xC9:0x5C:0x04:0x20 hwb1.MyApplet
|
||||
-out CAP JCA EXP
|
||||
-d ..\deliverables\hwb1
|
||||
-debug
|
||||
-target 3.1.0
|
||||
hwb1
|
||||
0x52:0xC4:0xC7:0xC9:0x5C:0x13:0x37 1.0
|
5
hwb1/configurations/hwb1.scriptgen
Normal file
5
hwb1/configurations/hwb1.scriptgen
Normal file
|
@ -0,0 +1,5 @@
|
|||
#Thu Oct 12 17:03:08 CEST 2023
|
||||
SCRIPTGEN_NO_POWER_UP=false
|
||||
SCRIPTGEN_NO_POWER_DOWN=true
|
||||
SCRIPTGEN_NO_BANNER=false
|
||||
SCRIPTGEN_NO_BEGIN_END=false
|
BIN
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.cap
Normal file
BIN
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.cap
Normal file
Binary file not shown.
BIN
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.exp
Normal file
BIN
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.exp
Normal file
Binary file not shown.
102
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.jca
Normal file
102
hwb1/deliverables/hwb1/hwb1/javacard/hwb1.jca
Normal file
|
@ -0,0 +1,102 @@
|
|||
// converted by version [v3.1.0]
|
||||
// on Thu Oct 12 17:03:33 CEST 2023
|
||||
|
||||
.package hwb1 {
|
||||
.aid 0x52:0xC4:0xC7:0xC9:0x5C:0x13:0x37;
|
||||
.version 1.0;
|
||||
|
||||
.imports {
|
||||
0xA0:0x0:0x0:0x0:0x62:0x1:0x1 1.8; //javacard/framework
|
||||
0xA0:0x0:0x0:0x0:0x62:0x0:0x1 1.0; //java/lang
|
||||
}
|
||||
|
||||
.applet {
|
||||
0x52:0xC4:0xC7:0xC9:0x5C:0x4:0x20 MyApplet;
|
||||
}
|
||||
|
||||
.constantPool {
|
||||
// 0
|
||||
staticMethodRef MyApplet/<init>()V;
|
||||
// 1
|
||||
.classRef MyApplet;
|
||||
// 2
|
||||
staticMethodRef 0.3.0()V; // javacard/framework/Applet.<init>()V
|
||||
// 3
|
||||
virtualMethodRef 0.3.1()V; // register()V
|
||||
// 4
|
||||
staticMethodRef 1.0.0()V; // java/lang/Object.<init>()V
|
||||
}
|
||||
|
||||
.class public MyApplet 0 extends 0.3 { // extends javacard/framework/Applet
|
||||
|
||||
.publicMethodTable 7 8 {
|
||||
equals(Ljava/lang/Object;)Z 0;
|
||||
register()V 1;
|
||||
register([BSB)V 2;
|
||||
selectingApplet()Z 3;
|
||||
deselect()V 4;
|
||||
getShareableInterfaceObject(Ljavacard/framework/AID;B)Ljavacard/framework/Shareable; 5;
|
||||
select()Z 6;
|
||||
process(Ljavacard/framework/APDU;)V 7;
|
||||
}
|
||||
|
||||
.packageMethodTable 0 {
|
||||
}
|
||||
|
||||
.method public static install([BSB)V 0 {
|
||||
.stack 1;
|
||||
.locals 0;
|
||||
|
||||
L0: new 1; // hwb1/MyApplet
|
||||
invokespecial 0; // hwb1/MyApplet.<init>()V
|
||||
return;
|
||||
}
|
||||
|
||||
.method protected <init>()V 1 {
|
||||
.stack 1;
|
||||
.locals 0;
|
||||
|
||||
L0: aload_0;
|
||||
invokespecial 2; // javacard/framework/Applet.<init>()V
|
||||
aload_0;
|
||||
invokevirtual 3; // register()V
|
||||
return;
|
||||
}
|
||||
|
||||
.method public process(Ljavacard/framework/APDU;)V 7 {
|
||||
.stack 0;
|
||||
.locals 0;
|
||||
|
||||
.descriptor Ljavacard/framework/APDU; 0.10;
|
||||
|
||||
L0: return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.class final MyAppletStrings extends 1.0 { // extends java/lang/Object
|
||||
|
||||
.fields {
|
||||
static final byte[] Package = {104,119,98,49}; // [B
|
||||
static final byte[] AppletName = {77,121,65,112,112,108,101,116}; // [B
|
||||
}
|
||||
|
||||
.publicMethodTable 1 1 {
|
||||
equals(Ljava/lang/Object;)Z 0;
|
||||
}
|
||||
|
||||
.packageMethodTable 0 {
|
||||
}
|
||||
|
||||
.method <init>()V {
|
||||
.stack 1;
|
||||
.locals 0;
|
||||
|
||||
L0: aload_0;
|
||||
invokespecial 4; // java/lang/Object.<init>()V
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
57
hwb1/src/hwb1/MyApplet.java
Normal file
57
hwb1/src/hwb1/MyApplet.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package hwb1;
|
||||
|
||||
import javacard.framework.*;
|
||||
import javacardx.annotations.*;
|
||||
import static hwb1.MyAppletStrings.*;
|
||||
|
||||
/**
|
||||
* Applet class
|
||||
*
|
||||
* @author <user>
|
||||
*/
|
||||
@StringPool(value = {
|
||||
@StringDef(name = "Package", value = "hwb1"),
|
||||
@StringDef(name = "AppletName", value = "MyApplet")},
|
||||
// Insert your strings here
|
||||
name = "MyAppletStrings")
|
||||
public class MyApplet extends Applet {
|
||||
|
||||
/**
|
||||
* 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 MyApplet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only this class's install method should create the applet object.
|
||||
*/
|
||||
protected MyApplet() {
|
||||
register();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an incoming APDU.
|
||||
*
|
||||
* @see APDU
|
||||
* @param apdu
|
||||
* the incoming APDU
|
||||
*/
|
||||
@Override
|
||||
public void process(APDU apdu) {
|
||||
//Insert your code here
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue