can some one tell me how to read data in smart card using java card? I have this code i am using java card 2.2

StackOverflow https://stackoverflow.com/questions/8283950

Вопрос

I am new to java card.

i have this code.....so please tell me how to read data from smart card using java card

        private void readName(APDU apdu) throws ISOException
    {
      byte[] apduBuffer = apdu.getBuffer();
      for (byte i=0; i<userName.length; i++)
      {
        apduBuffer[5+i] = userName[(byte)i] ;
      }
      apdu.setOutgoing();
      apdu.setOutgoingLength((short)userName.length);
      apdu.sendBytes((short)5, (short)userName.length);
    }
Это было полезно?

Решение

The common mechanism to read data from files in smart card is:

  1. select the file (EF), follow the rules, you can't blindly select as in desktop computer filesystem
  2. send read binary/record depending on EF type (read binary for transparent EF, read record for linear fixed/cyclic EF)
  3. send get response to get the EF contents

Другие советы

I think you can find an integrated development environment to write your javacard simulation code card, after burn into real card in the code. Free integrated debugging environment could go to the www.javacos.com.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top