java - javax.smarcardio unknown exception 0x1f -
i'm working on card reader now. want take data card. took uid. want take encrypted data. want enter secure mode , start session. did something. send command apdu start session every time return unknown exception 0x1f here code.
terminalfactory factory = terminalfactory.getdefault(); list<cardterminal> terminals = factory.terminals().list(); terminal = terminals.get(0); card = terminal.connect("t=1"); cardchannel channel = card.getbasicchannel(); byte[] c1 = { (byte) 0x80, (byte) 0x72, (byte) 0x80, (byte) 0x00, (byte) 0x18, (byte) 0x5c, (byte) 0xc5, (byte) 0x0a, (byte) 0xa2, (byte) 0x5b, (byte) 0x38, (byte) 0x7f, (byte) 0x81, (byte) 0x3a, (byte) 0x3d, (byte) 0x1a, (byte) 0x88, (byte) 0x7d, (byte) 0x26, (byte) 0xfc, (byte) 0x2b, (byte) 0xa8, (byte) 0xa7, (byte) 0xdd, (byte) 0xdc, (byte) 0x71, (byte) 0xe0, (byte) 0xf3, (byte) 0xc6 }; responseapdu response = channel.transmit(new commandapdu(0xff, 0x00,0x00,0x00,c1,5,24));
this code returns me 6a81( means function not supported),
if send directly start session command(84 72 00 00) time returns unknown exception.
please me. don't have find error in code. tell me how can start session in smart card. use hid omnÄ°key 5021 cl.
exception in thread "main" javax.smartcardio.cardexception: sun.security.smartcardio.pcscexception: unknown error 0x1f @ sun.security.smartcardio.channelimpl.dotransmit(channelimpl.java:219) @ sun.security.smartcardio.channelimpl.transmit(channelimpl.java:90) @ cardreader.getuid.getuid(getuid.java:48) @ cardreader.getuid.main(getuid.java:86)
apdu you're sending wrong, because use commandapdu
in incorrect way.
new commandapdu(0xff, 0x00,0x00,0x00,c1,5,24)
creates apdu starting ff000000185cc50aa2...
not (probably) want.
try new commandapdu(0x84, 0x72,0x00,0x00,c1,5,24)
instead.
Comments
Post a Comment