openjavacard / openjavacard-ndef Goto Github PK
View Code? Open in Web Editor NEWNDEF tag implementation for JavaCard
License: GNU General Public License v3.0
NDEF tag implementation for JavaCard
License: GNU General Public License v3.0
The documentation has an example here of how to install the tiny app variant using param data:
user@host:~$ java -jar gp.jar \
-applet D2760000850101 \
-params 100BD101075402656E54657374 \
-install build/javacard/javacard-ndef-tiny.cap
(Install tiny variant with static text "Test")
What is the leading byte of the param data here? Is the param itself a TLV?
Type | Length | Value | ... | ... | ... | ... | ... | ... |
---|---|---|---|---|---|---|---|---|
TNF: Type Name Format | Type Length | Payload Length | Type | |||||
0x10 | 0x0B | 0xD1 | 0x01 | 0x07 | 0x54 | 0x02 | 0x65 0x6E | 0x54657374 |
11 bytes | 0b11010001 | 1 byte | 7 bytes | T | en | Test |
When I use this python code to generate an NDEF, I only get the payload:
import ndef
record1 = ndef.TextRecord("Test")
encoder = ndef.message_encoder()
encoder.send(None)
encoder.send(record1)
encoder.send(None)
message = [record1]
print(b''.join((ndef.message_encoder(message))).hex())
>>> d101075402656e54657374
It also mentions in the docs for the tiny applet:
You should not prepend the dataset with a length prefix as in the stored form.
So maybe I've missed some other detail. What's the initial byte 0x10
in the tiny applet param? Thanks for any help in advance!
Hi,
A colleague and I have noticed that the AID in the prebuilt cap files doesn't correspond to the correct AID for NDEF and so the applets are behaving as tags correctly at the moment.
This should be done once the design of the main applet has been finalized.
I do not think that this can be done using normal modularization techniques (classes) in JavaCard without increasing the binary size, but that would be one option.
Another option would be building the applet as a tiny subset using copy-n-paste. Thats probably what I'll end up doing.
Hello, Developer.
I'm Shige in Japan user.
Thanks to your good javacard applet, its useful to me.
Please let me ask how to use javacard-ndef applet.
I believe that I can install successfully.
I installed with refering to
java -jar gp.jar
-params 100BD101075402656E54657374
-install javacard-ndef.cap
But, it doesnt work well.
APDU Command with GP tool below:
Success : 9000
A>> T=0 (4+0007) 00A40400 07 D2760000850101
A<< (0000+2) (41ms) 9000
But, next is not success
A>> T=0 (4+0002) 00A4000C 02 E103
A<< (0000+2) (26ms) 6A86
Could you let me know how to use or example to call APDU ?
Best Regards,
Shige
Reading works well. Writing with other apps like https://play.google.com/store/apps/details?id=com.mobiem.nfctool works OK. Has NXP changed it so that only their tags are writable?
The applet should use object deletion when available to shrink the data array.
It should do so both for install-time configuration and when written by command.
I am trying to dynamically generate a token (within an NDEF message) that is returned upon tag-read. Since the token is generated as-needed, I assume I won't need persistent memory. As an initial test I'm just trying to return a static NDEF message that is stored in RAM. This is my edit to lines 510-511 of the 'full' variant applet (in NdefApplet.java).
// send directly
byte[] arr = JCSystem.makeTransientByteArray((short)14, JCSystem.CLEAR_ON_RESET);
arr[0] = (byte)0x00;
arr[1] = (byte)0x0C;
arr[2] = (byte)0xD1;
arr[3] = (byte)0x01;
arr[4] = (byte)0x07;
arr[5] = (byte)0x54;
arr[6] = (byte)0x02;
arr[7] = (byte)0x65;
arr[8] = (byte)0x6E;
arr[9] = (byte)0x54;
arr[10] = (byte)0x65;
arr[11] = (byte)0x73;
arr[12] = (byte)0x74;
arr[13] = (byte)0x81;
apdu.setOutgoingLength((short)14);
apdu.sendBytesLong(arr, (short)0, (short)14);
Interestingly, when using this app, available on the app store, I am able to send custom APDU's to the applet and read the expected responses, but when using the generic NFC reader (of any NFC app - "NFC app", "NXP TagInfo", etc) the tag is not recognized at all. Specifically: I can send a sequence of custom APDU's to "read" from the tag resulting in the response 000CD101075402656E54657374819000
, but when using the regular "NFC Reader" function (of any of the common NFC read/write apps) the tag is not detected.
My Question: In order to be detected as an NDEF tag, must the NDEF message be written to EEPROM?
I can provide A LOT more details with respect to my testing of this, but I am very curious if there is something obvious that I'm missing.
The new 'stub' variant requires linking to parts of this project.
Since my policy is to not restrict usage with licensing I will adjust the license to LGPL once I find the time.
The applet should work with T=0 now but I did not test this.
Error while running ant.sh
➜ openjavacard-ndef git:(master) ✗ ./ant.sh
Buildfile: /home/pixsa/Desktop/Job/Cnick/openjavacard-ndef/build.xml
prepare:
BUILD FAILED
/home/pixsa/Desktop/Job/Cnick/openjavacard-ndef/build.xml:20: The following error occurred while executing this line:
Error reading project file PATH/openjavacard-ndef/ext/ant-javacard/build.xml: PATH/openjavacard-ndef/ext/ant-javacard/build.xml
Total time: 0 seconds
This makes sense, because ext/ant-javacard/build.xml
file is not present.
How should I generate it?
After the installation of the tiny
applet in a JCOP 3 EMV, the card is not recognized as a NFC tag. This happens due to the Maximum NDEF file size field in the File Control TLV being set to the NDEF message size instead of to the NDEF file size.
The fix would be to use (short)(dataSize + 2)
instead of dataSize
when initializing the Capability Container in makeCaps
.
Update: Fails on windows with GoToTags and ACR122u.
I cant seem to get to the PN532 and Arduino to read the tag, when I use ACR122U it works fine, however the Arduino can read a regular mifare card with the same NDEF tag fine.
Loaded javacard-ndef-full-plain.cap onto J3A040
Created text ndef
Write ndef onto mifare and java card.
Reading Mifare and Java card with ACR122U works.
Reading Mifare and Java card with iPhone Xs works.
Reading Mifare with Arduino and PN532 works.
Reading Mifare with GoToTags Windows App with ACR122U works.
Reading Java card with Arduino and PN532 throws error, Unknown TLV 67.
Reading Java card with GoToTags Windows App with ACR122U does not work, Throws NFC tag's type is not supported.
Please help.
I am writing cap files successfully. Both pre-built and the one I made.
I know Tag writer app had issues with this applet, but I have no indication in other apps that my NFC card supports ndef.
I do not know how to generate the correct AID for this. Tried: 5A47B1C6ED8E5D7656B1E070 for cap and 5A47B1C6ED8E5D7656B1E07001 for applet.
Can somebody help me? Maybe the problem is wrong AID that does not support NDEF.
Have issues with both full and tiny example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.