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?