Skip to content

Commit 149a311

Browse files
committed
encode canonical ndef aid
1 parent cf5b78c commit 149a311

File tree

4 files changed

+116
-4
lines changed

4 files changed

+116
-4
lines changed

docs/applets/1-pgp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Explaining the theory of public-key cryptography is out of scope, please refer t
99
- Repository: https://github.com/ANSSI-FR/SmartPGP (javacard-3.0.4-without-secure-messaging branch)
1010
- Binary name: `SmartPGPApplet-default.cap` and `SmartPGPApplet-large.cap`
1111
- Download: https://github.com/StarGate01/flexsecure-applets/releases
12-
- AID: `d2:76:00:01:24:01:03:04:AF:AF:00:00:00:00:00:00` (has to be adjusted, see below), Package: `d2:76:00:01:24:01`
12+
- AID: `d2:76:00:01:24:01:03:04:00:0A:00:00:00:00:00:00` (has to be adjusted, see below), Package: `d2:76:00:01:24:01`
1313

1414
## Compiling the Applet Yourself
1515

@@ -33,7 +33,7 @@ For more options, see the SmartPGP README file.
3333

3434
## Installing the Applet
3535

36-
To install the applet to your card, you have to first construct a valid AID (refer to section 4.2.1 of the OpenPGP card specification, linked below). Every AID starts with `D2 76 00 01 24 01`, which is the unique identifier of the FSFE, joined with the application identifier `01`. Next comes the OpenPGP version, which is `03 04` (3.4) for this applet. The next two bytes are a manufacturer id, which should be registered with the FSF Europe e.V. , however you can just put whatever you like - I use `C0 FE`. The next four bytes specify the card serial number (e.g. `00 00 00 01`), and the last two bytes are reserved for future use and are always zero.
36+
To install the applet to your card, you have to first construct a valid AID (refer to section 4.2.1 of the OpenPGP card specification, linked below). Every AID starts with `D2 76 00 01 24 01`, which is the unique identifier of the FSFE, joined with the application identifier `01`. Next comes the OpenPGP version, which is `03 04` (3.4) for this applet. The next two bytes are a manufacturer id, which should be registered with the FSF Europe e.V. , however you can just put whatever you like - Vivokey uses `00 0A`. The next four bytes specify the card serial number (e.g. `00 00 00 01`), and the last two bytes are reserved for future use and are always zero.
3737

3838
The complete AID should look like this: `D2 76 00 01 24 01 03 04 C0 FE 00 00 00 01 00 00`.
3939

docs/applets/4-ndef.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NDEF (NFC Data Exchange Format) is a data format used to store structured data.
77
- Repository: https://github.com/OpenJavaCard/openjavacard-ndef
88
- Binary name: `openjavacard-ndef-full.cap` and `openjavacard-ndef-tiny.cap`
99
- Download: https://github.com/StarGate01/flexsecure-applets/releases
10-
- AID: `D2:76:00:00:85:01:01`, Package: `D2:76:00:01:77:10:02:11:01:00:01` (differs between variants)
10+
- AID: `D2:76:00:00:85:01:01`, Package: `D2:76:00:00:85`
1111

1212
## Compiling the Applet Yourself
1313

scripts/compile/openjavacard-ndef.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
mkdir -p /app/src/bin
44
cd /app/src/applets/openjavacard-ndef
5-
ant -DJAVACARD_HOME=/app/sdks/jc222_kit build
5+
cp /app/src/scripts/compile/res/openjavacard-ndef.build.xml .
6+
ant -DJAVACARD_HOME=/app/sdks/jc222_kit -buildfile openjavacard-ndef.build.xml build
67
cd /app/src/applets/openjavacard-ndef/build/javacard
78
cp *full.cap *tiny.cap /app/src/bin/
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="javacard-ndef"
3+
default="build"
4+
basedir=".">
5+
6+
<description>JavaCard implementation of an NDEF Type 4 tag</description>
7+
8+
<property name="ext.ant-javacard" value="ext/ant-javacard"/>
9+
10+
<property name="sdk.globalplatform" value="ext/globalplatform-exports"/>
11+
<property name="sdk.jc222" value="ext/javacard-sdks/jc222_kit"/>
12+
13+
<!-- Cleanup target -->
14+
<target name="clean" description="Delete build output">
15+
<delete dir="build"/>
16+
</target>
17+
18+
<!-- Prepare build tools and directories -->
19+
<target name="prepare" description="Prepare build">
20+
<ant dir="ext/ant-javacard"/>
21+
<taskdef name="javacard"
22+
classpath="${ext.ant-javacard}/ant-javacard.jar"
23+
classname="pro.javacard.ant.JavaCard"/>
24+
25+
<mkdir dir="build/javacard"/>
26+
<mkdir dir="build/classes/advanced"/>
27+
<mkdir dir="build/classes/full"/>
28+
<mkdir dir="build/classes/stub"/>
29+
<mkdir dir="build/classes/tiny"/>
30+
</target>
31+
32+
<!-- Build-all target -->
33+
<target name="build" description="Build everything" depends="prepare">
34+
<antcall target="build-advanced"/>
35+
<antcall target="build-full"/>
36+
<antcall target="build-tiny"/>
37+
<antcall target="build-stub"/>
38+
</target>
39+
40+
<!-- Dummy test target -->
41+
<target name="test" description="Run tests" depends="build"/>
42+
43+
<!-- Target for updating in-repository prebuilt files -->
44+
<target name="prebuilt"
45+
description="Update prebuilt files"
46+
depends="build">
47+
<delete dir="prebuilt"/>
48+
<copy todir="prebuilt">
49+
<fileset dir="build/javacard"/>
50+
</copy>
51+
</target>
52+
53+
<target name="build-advanced">
54+
<javacard jckit="${sdk.jc222}">
55+
<cap output="build/javacard/openjavacard-ndef-advanced.cap"
56+
jar="build/javacard/openjavacard-ndef-advanced.jar"
57+
classes="build/classes/advanced"
58+
sources="applet-advanced/src/main/java"
59+
aid="D276000085"
60+
version="0.0">
61+
<applet aid="D2760000850101"
62+
class="org.openjavacard.ndef.advanced.NdefApplet"/>
63+
<import jar="${sdk.globalplatform}/org.globalplatform-1.1/gpapi-globalplatform.jar"
64+
exps="${sdk.globalplatform}/org.globalplatform-1.1/exports"/>
65+
</cap>
66+
</javacard>
67+
</target>
68+
69+
<target name="build-full">
70+
<javacard jckit="${sdk.jc222}">
71+
<cap output="build/javacard/openjavacard-ndef-full.cap"
72+
jar="build/javacard/openjavacard-ndef-full.jar"
73+
classes="build/classes/full"
74+
sources="applet-full/src/main/java"
75+
aid="D276000085"
76+
version="0.0">
77+
<applet aid="D2760000850101"
78+
class="org.openjavacard.ndef.full.NdefApplet"/>
79+
</cap>
80+
</javacard>
81+
</target>
82+
83+
<target name="build-tiny">
84+
<javacard jckit="${sdk.jc222}">
85+
<cap output="build/javacard/openjavacard-ndef-tiny.cap"
86+
jar="build/javacard/openjavacard-ndef-tiny.jar"
87+
classes="build/classes/tiny"
88+
sources="applet-tiny/src/main/java"
89+
aid="D276000085"
90+
version="0.0">
91+
<applet aid="D2760000850101"
92+
class="org.openjavacard.ndef.tiny.NdefApplet"/>
93+
</cap>
94+
</javacard>
95+
</target>
96+
97+
<target name="build-stub">
98+
<javacard jckit="${sdk.jc222}">
99+
<cap output="build/javacard/openjavacard-ndef-stub.cap"
100+
jar="build/javacard/openjavacard-ndef-stub.jar"
101+
classes="build/classes/stub"
102+
sources="applet-stub/src/main/java"
103+
aid="D276000085"
104+
version="0.0">
105+
<applet aid="D2760000850101"
106+
class="org.openjavacard.ndef.stub.NdefApplet"/>
107+
</cap>
108+
</javacard>
109+
</target>
110+
111+
</project>

0 commit comments

Comments
 (0)