Page 1 of 1

How to put a string to my card

Posted: Wed May 10, 2017 11:26 pm
by poinonche
Hi all experts here,

I am new to java card programme.

I want to know if there is any way to put a string to my card and store them.

Code: Select all

byte helloword[];
byte[] buffer = apdu.getBuffer();
apdu.setIncomingAndReceive();
short length = (short)buffer[ISO7816.OFFSET_LC];
Util.arrayCopyNonAtomic(buffer, (short)0, helloword, (short)0, (short) length);



Thanks in advance.

Poin

Re: How to put a string to my card

Posted: Thu May 11, 2017 7:00 am
by tay00000
JavaCard datatypes are byte, byte[], short, boolean, some sort of Key related objects and sometimes certain cards come with int type. There is no such thing as String type. You have to convert String to byte[] before transmitting to card.

Also, since you are new to JavaCard and probably smart card development, please read up on the ISO-7816 standards and JavaCard and GlobalPlatform standards for starters before developing any card applet. You need to have a basic understanding on how a smart card works and how JavaCard, ISO-7816 and GlobalPlatform standards affect how smart cards operate.

If you intend to continue card development without having the required knowledge, you might create card applets that do not fully utilize the security benefits of a smart card and probably introduce a lot of bugs as well.