Skip to content

Commit ca1f20f

Browse files
committed
Merge branch 'dev'
2 parents 9de5ce7 + 98483b9 commit ca1f20f

File tree

5 files changed

+52
-32
lines changed

5 files changed

+52
-32
lines changed

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"java.project.sourcePaths": [
3+
"src"
4+
],
5+
"java.project.referencedLibraries": [
6+
"lib/**/*.jar",
7+
"ext/javacard-sdks/jc310r20210706_kit/lib/api_classic-3.0.4.jar",
8+
"ext/javacard-sdks/jc310r20210706_kit/lib/api_classic_annotations-3.0.4.jar"
9+
]
10+
}

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,28 @@
33
A (hopfully) highly feature-packed NDEF applet, [available through Fidesmo](https://apps.fidesmo.com/8210647A)
44
A constant work in progress, but I use it personally.
55

6-
### Credits
6+
## Building
77

8-
This project is based on [OpenJavaCard NDEF](https://github.com/OpenJavaCard/openjavacard-ndef), which contains some code from the fine [IsoApplet](https://github.com/philipWendland/IsoApplet).
8+
Install [Apache Ant](https://ant.apache.org/) from the wesite or through your package manager, change any properties at the top of build.xml, then run:
9+
````
10+
ant clean
11+
ant build
12+
````
913

10-
### Legal
14+
The resulting cap file will be at `build/main.cap`.
15+
16+
The main ant targets are:
17+
18+
- `clean`: Delete build files and extensions
19+
- `build`: Build the applet (download ant-javacard if nesssary)
20+
- `deploy`: Deploy the applet to Fidesmo, requires the FIDESMO_AUTH env variable (download fdsm if nesssary)
21+
22+
## Credits
23+
24+
- Based on [OpenJavaCard NDEF](https://github.com/OpenJavaCard/openjavacard-ndef), which contains some code from the fine [IsoApplet by philipWendland](https://github.com/philipWendland/IsoApplet)
25+
- Uses code from [htop_via_ndef by Petris](https://github.com/petrs/hotp_via_ndef)
26+
27+
## Legal
1128

1229
coolNDEFthing - a javacard applet that provides services through NDEF
1330
Copyright (C) 2022 non-bin
@@ -24,10 +41,3 @@ This project is based on [OpenJavaCard NDEF](https://github.com/OpenJavaCard/ope
2441

2542
You should have received a copy of the GNU General Public License
2643
along with this program. If not, see <http://www.gnu.org/licenses/>.
27-
28-
### Standards
29-
30-
The applet is intended to comply with the following standards, where applicable:
31-
* ISO 7816-4 Organization, security and commands for interchange (Release 2013)
32-
* GlobalPlatform Card Specification (Version 2.1)
33-
* NFC Forum Type 4 Tag Operation Specification (Version 2.0)

build.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@
55

66
<description>JavaCard implementation of an NDEF Type 4 tag, plus some extras</description>
77

8-
<property name="ext.ant-javacard" value="ext/ant-javacard"/>
9-
10-
<property name="sdk.globalplatform" value="ext/globalplatform-exports"/>
11-
<property name="sdk.jckit" value="ext/javacard-sdks/jc305u3_kit"/>
12-
<property name="sdk.jctarget" value="ext/javacard-sdks/jc304_kit"/>
13-
148
<property name="aid.NDEF" value="D2760000850101"/>
159
<property name="fidesmo.appID" value="8210647A"/>
1610

17-
<taskdef name="javacard"
18-
classpath="${ext.ant-javacard}/ant-javacard.jar"
19-
classname="pro.javacard.ant.JavaCard"/>
11+
<property name="sdk.jckit" value="ext/javacard-sdks/jc310r20210706_kit"/>
12+
<property name="sdk.jctarget" value="ext/javacard-sdks/jc304_kit"/>
13+
<!-- Remember to update the java project referenced libraries -->
14+
15+
<property name="ext.ant-javacard" value="ext/ant-javacard"/>
2016

2117
<target name="default">
22-
<antcall target="prepare" />
2318
<antcall target="build" />
24-
<antcall target="deploy" />
2519
</target>
2620

27-
<target name="clean" description="Delete build output">
21+
<target name="clean" description="Delete build output and downloaded libs">
2822
<delete dir="build"/>
2923
<delete dir="ext/ant-javacard"/>
3024
<delete dir="ext/fidesmo"/>
25+
26+
<mkdir dir="build"/>
3127
</target>
3228

33-
<target name="prepare" description="Prepare build">
34-
<mkdir dir="build/javacard"/>
29+
<target name="ant-javacard" description="Include ant-javacard">
3530
<mkdir dir="ext/ant-javacard"/>
36-
<mkdir dir="ext/fidesmo"/>
37-
3831
<get src="https://github.com/martinpaljak/ant-javacard/releases/latest/download/ant-javacard.jar" verbose="on" dest="ext/ant-javacard/ant-javacard.jar" skipexisting="true"/>
32+
<taskdef name="javacard"
33+
classpath="${ext.ant-javacard}/ant-javacard.jar"
34+
classname="pro.javacard.ant.JavaCard"/>
35+
</target>
36+
37+
<target name="fdsm" description="Include fdsm">
38+
<mkdir dir="ext/fidesmo"/>
3939
<get src="https://github.com/fidesmo/fdsm/releases/latest/download/fdsm.jar" verbose="on" dest="ext/fidesmo/fdsm.jar" skipexisting="true"/>
4040
</target>
4141

42-
<target name="deploy" description="Deploy to Fidesmo">
42+
<target name="deploy" description="Deploy to Fidesmo" depends="fdsm">
4343
<java jar="ext/fidesmo/fdsm.jar"
4444
fork="true">
4545
<arg line="--verbose"/>
@@ -49,12 +49,12 @@
4949
</java>
5050
</target>
5151

52-
<target name="build">
52+
<target name="build" depends="ant-javacard">
5353
<javacard jckit="${sdk.jckit}">
5454
<cap targetsdk="${sdk.jctarget}"
5555
output="build/main.cap"
5656
jar="build/main.jar"
57-
sources="src/main/java"
57+
sources="src"
5858
aid="${aid.NDEF}"
5959
version="1.0">
6060
<applet aid="${aid.NDEF}01"

src/main/java/au/net/jacka/coolNDEFthing/NdefApplet.java renamed to src/au/net/jacka/coolNDEFthing/NdefApplet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public final class NdefApplet extends Applet {
8080
private static final byte CC_LEN_NDEF_FILE_CONTROL = 6;
8181

8282
/* Constants related to file control data in capabilities */
83-
private static final byte FC_OFF_FILE_ID = 0x00;
84-
private static final byte FC_OFF_SIZE = 0x02;
83+
// private static final byte FC_OFF_FILE_ID = 0x00;
84+
// private static final byte FC_OFF_SIZE = 0x02;
8585
private static final byte FC_OFF_READ_ACCESS = 0x04;
8686
private static final byte FC_OFF_WRITE_ACCESS = 0x05;
8787

@@ -182,7 +182,7 @@ public static void install(byte[] buf, short off, byte len) {
182182
pos += lenAID;
183183
// find control information (ignored)
184184
byte lenCI = buf[pos++];
185-
short offCI = pos;
185+
// short offCI = pos;
186186
pos += lenCI;
187187
// find applet data
188188
byte lenAD = buf[pos++];
File renamed without changes.

0 commit comments

Comments
 (0)