Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Support => Topic started by: s3c on October 10, 2009, 05:37:22 pm

Title: Anyone have more smart card info?
Post by: s3c on October 10, 2009, 05:37:22 pm
I hooked up the Bus Pirate to a smart card I had laying around but had no luck interpreting what I got out of it, the built in ATR macro also seemed to interpret it incorrectly, it seems like the bit order for my card is reversed but the output makes sense when decoding with the same standard as the SLE4442. For example, the first 2 byte in the ATR are 0b10100001, 0b00101011 this should translate to 2 wire serial protocol, Read to end, 2048 data units with 8 bits per unit. However the bus pirate translates these in reverse order and don't seem to get much info from it:

"ISO 7813-3 reply (LSB first): 0x85 0xD4 0xFF 0x25
Protocol: serial
Read type: variable length
Data units: 0
Data unit length (bits): 16"

(Shouldn't the 7813-3 be 7816-3?)

My ATR is 14 bytes long which the macro also doesn't try to decode. I searched the net in vain for any info on synchronous cards but didn't find much, I wouldn't have minded getting my hands on the synchronous smart card standards but these are pretty expensive (ISO 7816-10 for example). Has anyone got any info on these cards?
Title: Re: Anyone have more smart card info?
Post by: ian on October 10, 2009, 07:06:45 pm
Sorry, I only know about the SLE4442. What model is your card? What are the 14 ATR bytes? I couldn't find any blank cards on the net, they usually have manufacturer's datasheets.

I did force the ATR macro to read LSB first in the last update because I thought it was standard and an extra pain to set it manually. I'll make it configurable again in the next release.
Title: Re: Anyone have more smart card info?
Post by: s3c on October 10, 2009, 08:39:47 pm
I have no idea what type of card it is, everything I know I got from the ATR and the SLE4443 data sheet. I found very little on 2048 byte synchronous cards on the web, it might be an Atmel card but I'm still looking into this.

The ATR as the bus pirate reports it is:

0x85 0xD4 0xFF 0x25 0x43 0x20 0x6C 0x53 0x00 0x00 0xFC 0xC0 0x00 0x7F

While the reverse bit order (which I suspect is the correct bit order) gives:

0xA1 0x2B 0xFF 0xA4 0xC2 0x04 0x36 0xCA 0x00 0x00 0x3F 0x03 0x00 0xFE
Title: Re: Anyone have more smart card info?
Post by: ian on October 13, 2009, 10:43:44 am
I made a new release of firmware that removes the forced bit order configuration on the smartcard ATR. I also fixed the 7816 typo, but I didn't remember until I had already compiled the 12 different versions, so it'll be in the next release.

Have you looked at my hack a day article too? It's possible to do the ATR command manually in the raw2wire mode with @^rrrr (as I recall). You'll need to configure bitorder (menu l) and configure the @aA command to use CS or AUX, depending on your setup.
Title: Re: Anyone have more smart card info?
Post by: s3c on October 13, 2009, 05:12:40 pm
Jip, I recall, that's how I got the above ATR, thanks for the fix. Are you accepting external additions to the bus pirate code in the official releases?
Title: Re: Anyone have more smart card info?
Post by: ian on October 13, 2009, 05:20:18 pm
Always. If it integrates into the code it needs to be public domain/CC0. If you have a separate code file then it can be under whatever license and I'll like to it in the project.
Title: Re: Anyone have more smart card info?
Post by: s3c on October 14, 2009, 10:45:58 am
How would you prefer this being done, just mail you any additions? What about copying the source tree of the SVN for use by external developers? I had a look at the Issues page and there's a couple of things I'd be interested in doing.
Title: Re: Anyone have more smart card info?
Post by: ian on October 14, 2009, 10:52:44 am
I can help you check out the source from SVN, that's probably best. You can get it as a contributor, or anonymously and submit patches in the forum or by email.

We use TortoiseSVN, but any SVN client will work:
http://tortoisesvn.net/ (http://tortoisesvn.net/)

Enter this address to get the development branch anon:
http://the-bus-pirate.googlecode.com/svn/trunk/ (http://the-bus-pirate.googlecode.com/svn/trunk/)

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00992059200session_write_close ( )...(null):0
20.01022190776ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01022191552Database_MySQL->query( ).../DatabaseHandler.php:119
40.05382330272Database_MySQL->error( ).../Db-mysql.class.php:273