Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

What is APDU to read ATR ?

JavaCard Applet Development Related Questions and Answers.
leonard
Posts: 25
Joined: Wed Nov 18, 2015 12:13 am
Points :176
Contact:

What is APDU to read ATR ?

Post by leonard » Wed Jul 19, 2017 4:33 am

I am newbie in smart card development.
I have a sample of eID and I want to read ATR to check the card support extended APDU or not.
I am using jmrtd api in Android platform, but it is not implement ATR reading function.
I tried command

Code: Select all

"00B0810000" 
but i get

Code: Select all

 "6A 82"
.
Could you give me a suggestion for this?

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: What is APDU to read ATR ?

Post by UNKNwYSHSA » Wed Jul 19, 2017 5:43 am

You can get ATR after card connected.

If you write code, see following:
Using Windows API see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379559(v=vs.85).aspx
Using pyScard see https://pyscard.sourceforge.io/user-gui ... -reset-atr
Using language JAVA and use package javax.smartcardio.Card see http://docs.oracle.com/javase/7/docs/jr ... rdio/spec/
Or other platform/language please tell me. I'll tell you how to got ATR value.
sense and simplicity

User avatar
mabel
Posts: 237
Joined: Mon May 18, 2015 3:09 am
Points :1705
Contact:

Re: What is APDU to read ATR ?

Post by mabel » Wed Jul 19, 2017 5:51 am

Just use pyApdutool to connect your card. ATR value will be directly displayed.

You do not have the required permissions to view the files attached to this post. Please login first.

leonard
Posts: 25
Joined: Wed Nov 18, 2015 12:13 am
Points :176
Contact:

Re: What is APDU to read ATR ?

Post by leonard » Wed Jul 19, 2017 6:31 am

mabel wrote:Just use pyApdutool to connect your card. ATR value will be directly displayed.



Thank you for your quick response !
I writing an application in Android and using jmrtd api which.
I wondering is it possible to read ATR by sending a APDU command directly to card instead of using api such as smartcardio...?.
And if it is possible then what is the APDU command I should use?
Because I can not find documents relate to ATR reading command.

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: What is APDU to read ATR ?

Post by UNKNwYSHSA » Wed Jul 19, 2017 10:44 pm

The PassportService is constructed with a CardService instance.
When you using PassportService, you have to create a CardService instance.
The CardService instance have a method called getATR(), you can use it to get ATR value.

PassportService


CardService
You do not have the required permissions to view the files attached to this post. Please login first.
sense and simplicity

leonard
Posts: 25
Joined: Wed Nov 18, 2015 12:13 am
Points :176
Contact:

Re: What is APDU to read ATR ?

Post by leonard » Thu Jul 20, 2017 3:08 am

Thanks for your response.
I already checked the jmrtd api,it provides communication interface base on APDU command (7816-4) between reader and card and support a lot of function and security mechanism, but currently getATR() function is not implemented.
That why I ask the possibility of reading ATR by sending APDU command.
Also Android does not support javax.smartcardio, is there another way to get ATR data in Android ?

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: What is APDU to read ATR ?

Post by UNKNwYSHSA » Thu Jul 20, 2017 10:09 pm

How do you connect the reader to your Android Device? Using OTG?

And how do you send APDUs (You send "00B0810000" and "6982" received in this topic)?
Can you show me your code?
sense and simplicity

leonard
Posts: 25
Joined: Wed Nov 18, 2015 12:13 am
Points :176
Contact:

Re: What is APDU to read ATR ?

Post by leonard » Mon Jul 24, 2017 10:16 pm

I use android device as a reader and use NFC to tranmit data.
Below is my source code:

Code: Select all

CommandAPDU capdu = new CommandAPDU(ISO7816.CLA_ISO7816, ISO7816.INS_READ_BINARY, (byte)0x81, (byte)0x00, (byte)0x00);
    LOGGER.info(this.getClass().getSimpleName() + IopTest.IOP_READ_ATR +"\n" + Hex.bytesToHexString(capdu.getBytes()));
    try {
      ResponseAPDU rapdu = transmit(capdu);
      atr = rapdu.getData();
      LOGGER.info(this.getClass().getSimpleName() + IopTest.IOP_SW + Hex.bytesToHexString(rapdu.getBytes()));
    } catch (CardServiceException e) {
      e.printStackTrace();
    }

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: What is APDU to read ATR ?

Post by UNKNwYSHSA » Tue Jul 25, 2017 1:31 am

NFC is only for contactless card, contactless card do not have ATR.
sense and simplicity

leonard
Posts: 25
Joined: Wed Nov 18, 2015 12:13 am
Points :176
Contact:

Re: What is APDU to read ATR ?

Post by leonard » Tue Jul 25, 2017 3:21 am

Thank you for your answer.
I found that :
Contactless cards do NOT provide a real ATR. Instead, a pseudo-ATR generated by the PC/SC driver that connect your smartcard reader to applications is return (the value which I get when use reader to read the card), for example:

The pseudo-ATR (not generated or "returned" by the card) is used to pass (otherwise inaccesible) information about the contactless protocol to the application layer. As Android does not use PC/SC for access to smartcards through NFC there is also no ATR involved here.

But I still have questions:
1. If contactless cards dose not return ATR and pseudo-ATR is used to pass information about contactless protocol then what information I can get?
2. As I read in ISO 7816, if cards support extended length it should be store in ATR, but if in case contactless card ATR is not not real or returned by card then how can i get such kind of information.

I also read about definitions of ATS (answer-to-select) for type A (which comes close to an ATR as in that it also contains historical bytes) and an answer-to-ATTRIB for type B.
But I still do not have clear understanding about these definitions.
Could you give some documents that specify these matters!

Thank you very much for your support.
You do not have the required permissions to view the files attached to this post. Please login first.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 77 guests

JavaCard OS : Disclaimer