Re: Is Le not logged

Jakub Jelen <[email protected]> Thu, 09 Aug 2018 10:15:48 +0200
Newsgroups gmane.comp.encryption.opensc.devel
Message-ID <[email protected]>
On Wed, 2018-08-08 at 18:08 +0530, Amit wrote:
> Dear Devels,
> 
> I see this after connecting Atos card 5.3
> # /usr/local/bin/opensc-tool -a -vvv
> 0x7fd485e77880 17:20:53.811 [opensc-tool]
> apdu.c:378:sc_single_transmit:
> CLA:0, INS:CA, P1:1, P2:8D, data(0) (nil)
> 0x7fd485e77880 17:20:53.811 [opensc-tool]
> reader-pcsc.c:284:pcsc_transmit: reader 'Gemalto PC Twin Reader 00
> 00'
> 0x7fd485e77880 17:20:53.811 [opensc-tool] reader-
> pcsc.c:285:pcsc_transmit:
> Outgoing APDU (5 bytes):
> 00 CA 01 8D 02 .....
> 0x7fd485e77880 17:20:53.811 [opensc-tool]
> reader-pcsc.c:213:pcsc_internal_transmit: called
> 0x7fd485e77880 17:20:53.815 [opensc-tool] reader-
> pcsc.c:294:pcsc_transmit:
> Incoming APDU (4 bytes):
> 01 80 90 00 ....
> 
> What is 02 in CAPDU (00 CA 01 8D 02)? Is this Le?
>   P1=01(1st parameter), P2=8D(2nd parameter)

Yes, the 0x02 byte is Le from the Case 2 Short APDU [1]:

http://cardwerk.com/iso-7816-4-annex-a-smart-card-standard/#AnnexA_2E_1

> Is RAPDU correct?  (01 80 90 00)

Yes, The 0x01 0x80 are the two bytes you got in response to Le=0x02 and
0x90 and 0x00 are Status Words (SW1 and SW1) indicating success.

> a. Asked P2 was 8D, but came=80. Does this mean card does not have
> data
> starting from 01 8D?

The 0xCA instruction is generic ISO GET DATA:


http://cardwerk.com/smart-card-standard-iso7816-4-section-6-basic-interindustry-commands

The provided P1-P2 value 0x01 0x8D falls under Application data
(proprietary coding). The meaning is not defined by the ISO standard,
but by the vendor.

From the card-cardos.c, this instruction is used to

 207         /* probe DATA FIELD LENGTH with GET DATA */

so the response just means the amount of bytes we can send the card or
receive from the card, nothing more nothing less.


> b. Do I need to ask communication specs from manufacturer of card for
> same.

This might help to figure out what needs to be done for card enrolling.

Regards,
-- 
Jakub Jelen
Software Engineer
Security Technologies
Red Hat, Inc.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot