can some one tell me how to write data in smart card using java card?
i have this code
i am using java card 2.2
private void writeName(APDU apdu) throws ISOException
{
apdu.setIncomingAndReceive();
byte[] apduBuffer = apdu.getBuffer();
byte j = (byte)apduBuffer[4];
userName = new byte[j];
for (byte i=0; i<j; i++)
{
userName[(byte)i] = (byte)apduBuffer[5+i];
}
}
If you are using JCOP plugin for developing the Applet, you can see .CAP files in the bin/ directory for each package. Now you will need to install each package in order of dependency. Suppose your application consists of packages A, B and C with your applet in C package. And B imports A and C imports B.
The order in which you will need to install the packages are A,B,C. Using JCOP, this can be accomplished by:
Once you have done this for the three packages, you will need to install the applet. This can be accomplished by:
Once you do this you will see the applet in SELECTABLE state. Your JCOP shell console would look like :
And all those packages that are “modules” (libraries) are shown like this:
All those applets ini SELECTABLE state can now be selected and interacted with. If you want to send data to Applet with A00000008710015553, you will need to first select it. The interaction would be as shown below:
Now, you can send data to the above Applet by using send command:
These are all standard GP commands. I assumed that you are using a GP compliant card; you have mentioned nothing about it though.
I personally feel you will need to read through a bit on how JC Runtime Environment and JC VM works and it’s relation with the API and a bit of GP spec before you delve into further.