Question

I have EZ100PU usb smart card reader and new (clear) SLE4428 smart cards. I would like to write number sequence on them. I'm trying to do it with simple java application. That's my code based on others available on the internet:

public class Connection {

  public static void main(String[] args) throws Exception { 

    TerminalFactory factory = TerminalFactory.getDefault();

    CardTerminal terminal = terminals.get(1); 
    System.out.println("terminal: " + terminal.getName());
    Card card = terminal.connect("*");
    System.out.println("card: " + card);
    CardChannel channel = card.getBasicChannel(); 
    System.out.println("channel: " + channel.getChannelNumber());
    System.out.println("protocol: "+card.getProtocol());

    byte b[]=card.getATR().getBytes();
    for(int i=0;i<b.length;i++)
       System.out.print(b[i]);


//        byte[] bytes = {(byte)0xFF, (byte)0x00, (byte)0xFF, (byte)0x00};
//        ResponseAPDU r = channel.transmit(new CommandAPDU(bytes));

    card.disconnect(false);

  }
}

I have problem, because I always get "Unknown protocol 16" when card is inside reader. Probably because of that I can't write anything on the card, if I try I always get error. Can you help me?

Était-ce utile?

La solution 2

You are trying to use a method of connecting to ISO 7816-3 (T=0, T=1 or T=CL) compatible processor cards to connect to a lowly memory card. You will likely have to use a card specific reader library instead, you cannot just use javax.smartcardio.

Autres conseils

Your SLE 4428 card has default PIN = FFFF. First you need to verify PIN USING below COMMAND :- FF 20 00 00 02 FFFF Then you can write data to SLE 4428 card. If data is "My name is Kashyap" then in hex it is 4D79206E616D65206973204B617368796170. Write Data:- FF D0 00 20 12 4D79206E616D65206973204B617368796170. You can also change default PIN. Suppose I want to chagne PIN to 1234 from FFFF then use below Command:- FF D0 03 FD 03 FF 1234.

To read data below command:- FF B0 00 20 12

Thanks, Kashyap

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top