java - How to get the PSE of the card to read the RID or AIP or card number -


i have smart card in image below. card in card reader sticked @ server. used user authenticated before can download data.

i trying card number or seriel number or rid of smart card. able atr beside other information below.

atr:

 3b 9f 96 c0 0a 31 fe 45 43 54 31 69 0b 01 00 01 00 00 00 00 00 00 00 0d 

in question

smartcardio emv reader, find card type atr number

someone has mentioned aid (application id) = rid(registered application id) || pix (property application extension)

this page explains information has atr.

https://flomio.com/forums/topic/list-of-apdu-codes/

                              answer-to-reset (atr) init| t0| td1| td2| t1| tk|  len |      rid      | std | card |  rfu       | tck hdr |   |    |    |   |   |      |               |     | name |            |     3b | 8f| 80 | 01 | 80| 4f|  0c  | a0 00 00 03 06| 03  | 00 03| 00 00 00 00| 68 

when try pse getting 6a86 incorrect p1/p2. when try ppse getting 6700 --> wrong length.

command               : 00 a4 04 00 0e 31 50 41 59 2e 53 59 53 2e 44 44 46 30 31 response without data : 6a 86 command               : 00 a4 04 00 0e 32 50 41 59 2e 53 59 53 2e 44 44 46 30 31 00 response without data : 67 00 

http://techqa.info/programming/question/36297722/smartcardio-emv-reader--find-my-card-type-with-only-the-atr-number

i have tried option well:

// byte[] psefilename = "1pay.sys.ddf01".getbytes(); //pse byte[] psefilename = "2pay.sys.ddf01".getbytes(); // ppse commandapdu command = new commandapdu(0x00, 0xa4, 0x04, 0x00, psefilename); 

the information getting:

terminals list: [pc/sc terminal generic smart card reader interface 0] atr:  3b 9f 96 c0 0a 31 fe 45 43 54 31 69 0b 01 00 01 00 00 00 00 00 00 00 0d command               : 00 a4 02 0c 02 00 02 response without data : 90 00 command               : 00 b0 00 00 09 response data:   : 00 00 01 98 fa 03 16 14 ad command               : 00 a4 04 0c 06 ff 54 41 43 48 4f response without data : 90 00 command               : 00 a4 02 0c 02 05 01 response without data : 90 00 command               : 00 b0 00 00 01 response data:   : 04 command               : 00 22 c1 b6 0a 83 08 00 00 00 05 09 02 ff a1 response without data : 90 00 command               : 00 88 00 00 10 e9 96 79 ec 74 27 e6 50 00 00 00 05 09 02 ff a1 80 response data:   : 32 a9 bf e6 91 18 8d c8 34 87 d8 c5 6d 78 f3 90 24 db 98 60 37 f0 05 f3 1f 22 24 65 27 90 43 ff 4f ec 4f ae 7c 2e d9 4c 6d a0 bc 14 9a af df fb 81 0b 5a 4f 4d 1d ee df 38 3b 0d dd 63 7d 22 69 77 27 5b f3 0d ce 51 a3 5c fc 7f 4a fc 8c f1 da d9 ce c7 9b a1 23 e0 e6 1d b0 73 e8 3b 4b 8a 60 38 e8 0d ad 30 80 12 ef d3 76 72 75 95 2f af 09 10 e0 37 78 25 84 2e 19 0e 2e 17 9e 9d de 34 b7 

how can card number (5b) on card , rid , aid? why can pse of card?

enter image description here

code

import java.util.arraylist; import java.util.list;  import javax.smartcardio.atr; import javax.smartcardio.card; import javax.smartcardio.cardchannel; import javax.smartcardio.cardexception; import javax.smartcardio.cardterminal; import javax.smartcardio.commandapdu; import javax.smartcardio.responseapdu; import javax.smartcardio.terminalfactory; import javax.xml.bind.datatypeconverter;   public class cardidtest {      public static void main(string[] args) {          try {             terminalfactory factory = terminalfactory.getdefault();             list<cardterminal> terminals;             terminals = factory.terminals().list();             cardterminal terminal = terminals.get(0);             card card = terminal.connect("t=1");             system.out.println("terminals list: " + terminals);             atr atr = card.getatr();             byte[] atrarray = atr.getbytes();             string atrhex = cardidtest.printdata(atrarray);             system.out.println("atr: " + atrhex);             cardchannel channel = card.getbasicchannel();              string command1 = "00 a4 02 0c 02 00 02"; // select file             string command2 = "00 b0 00 00 09"; // length 19 works @ end instead of 09. // read binary             string command3 = "00 a4 04 0c 06 ff 54 41 43 48 4f";             string command4 = "00 a4 02 0c 02 05 01"; //             string command5 = "00 b0 00 00 01";             string command6 = "00 22 c1 b6 0a 83 08 00 00 00 05 09 02 ff a1";             string command7 = "00 88 00 00 10 e9 96 79 ec 74 27 e6 50 00 00 00 05 09 02 ff a1 80";              string psestring = "00 a4 04 00 0e 31 50 41 59 2e 53 59 53 2e 44 44 46 30 31";             string ppsestring = "00 a4 04 00 0e 32 50 41 59 2e 53 59 53 2e 44 44 46 30 31 00";              list<string> list = new arraylist<string>();             // list.add(command1);             // list.add(command2);             // list.add(command3);             // list.add(command4);             // list.add(command5);             // list.add(command6);             // list.add(command7);             list.add(psestring);             list.add(ppsestring);              (string item : list) {                 string commandwithoutspace = item.replace(" ", "");                 byte[] apdu = datatypeconverter.parsehexbinary(commandwithoutspace);                 commandapdu command = new commandapdu(apdu);                 responseapdu responseapdu = channel.transmit(command);                 byte[] reponsedata = responseapdu.getdata();                 string response = responseapdu.tostring();                 if (reponsedata.length > 0) {                     string datahex = cardidtest.printdata(reponsedata);                     system.out.println("command               : " + item);                     system.out.println("response data:   :" + datahex);                  } else {                     byte[] bytes = responseapdu.getbytes();                     string responsehex = cardidtest.printdata(bytes);                     system.out.println("command               : " + item);                     system.out.println("response without data :" + responsehex);                 }              }             card.disconnect(true); // reset          } catch (cardexception e) {              e.printstacktrace();         }      }       public static string printdata(byte[] bytearray) {         stringbuilder sb = new stringbuilder();          (byte b : bytearray) {             sb.append(string.format(" %02x", b));         }         return sb.tostring();      }  } 

edit

i have card driver card , can read card number following apdu

    string masterfile = "00 a4 04 0c 06 ff544143484f";     string elementaryfile = "00 a4 02 0c 02 0520";     string readbinary = "00 b0 00 01 10"; // b0 read binary; 01 offset 1; 10 decimal equal 16 bytes read. 

i have sticked card in card reader after installing cardpeek software --> click analayzer --> click tachograph , read card data 'ff544143484f','0520' ids. when stick company card card reader --> cardpeek programm --> analayer --> (here cound not click right specification since tried every single 1 in list , read atr getting 6700 error)


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -