I am a rookie in Javacard
I want to know how to send a string to the card .
I mean i have this
byte helloword = 0x00;
r = channel.transmit(new CommandAPDU((byte)0x80, HW_INS_SEND_STRING, helloword, (byte)0x00, (byte)10));
There is a way to put a string or an array byte to my var helloword; ??
because on my applet i have this method to recup the helloword
byte buffer = apdu.getBuffer();
short length = (short)buffer[ISO7816.OFFSET_LC];
Util.arrayCopyNonAtomic(buffer, (short)0, helloword, (short)0, (short) length);
Java card does not support string and char types. if you want to send string/chars for example 'Hello World' to the card and store them then you need to convert them into hex format and then send the converted hex string to the card.
The command APDU will be then,
CLA --- Your class byte, can be 80
INS --- Your Ins byte, can be 01
P1 --- Parameter P1 can be 00
P2 --- Parameter P2 can be 00
LC --- Length of Hello World hex string (0B)
Data --- Hellow World Hex String (48656c6c6f20576f726c64)
Le -- 00
Thanks for your help it was verry useful
i am a beginer and i didn t found a lot of document in javacard .
I have two questions ?
there is a way to create file on a javacard ? if yes how ?
the second , my card was coming with a biometrical terminal , how can use that , just a simple code in the way to authentifiate and to compare my fingerprint ?
yes you can create file on your java card,
what is the type of your card?
you can use class byte 80 with instruction E0 to create file
| E0 | ISO 7816-9 6.1 | CREATE FILE |
| 80 E0 02 00 0C Manual | GEMPLUS MPCOS-EMV | CREATE FILE |
| 80 E0 xx xx xx FCI length | 3GPP TS 11.11 | CREATE FILE |
| 80 E0 xx xx xx FCI length | SAGEM SCT U34 | CREATE FILE
this response is misleading
because an APDU is described in a spec does not mean all cards will support it. Above ISO7816-3, about everyting in the ISO7816 specs is optional.
to create files in a javacard you need a file system applet first.
there are no generic javacard APIs to support that, you have to create everything by yourself from command dispatcher to file storage.
if you're working with a SIM card then maybe you can rely on the SIM API. Sorry, I don't know anything in this domain.