/*******************************************************************************
 *
 * MUSCLE X-Windows Smart Card Formatter.  XCard - 1.0
 *	This program provides a GUI interface to some common smartcard
 *	features.  This was written completely by David Corcoran.
 *
 *******************************************************************************/

YOU MUST HAVE THE LATEST VERSION OF MUSCLE DRIVER CODE TO USE THIS.  IF YOU DON'T
OR ARE UNSURE DOWNLOAD IT ANYWAY.  THIS IS COVERED UNDER GPL.  PLEASE READ THE
LICENSE.

LICENSE	    - The GPL license. (Thanks Richard)
README      - You're reading it.
images	    - Images directory. (The pretty little butterfly)
xcard.c     - The Tk/C source code.
installer   - Does the Tk->C conversion. (Must be run after every change)
et	    - The ET Tk->C C->Tk libraries.

Gunzip and UnTar this file under your musclecard-XXX directory.  This should make a
directory called xcard-XXX.  Then change directory to xcard by typing.

cd xcard-XXX

To begin installing the Smart Card formatting Utility for X-Windows you will first
need to build ET which is a Tk/Tcl to Native code interface (It allows you to call
Tk/Tcl functions from within C).  To do this type:

cd et
configure
make

This should make et.  Then you must

cd ..
installer

Installer is a script that converts the Tk/Tcl code into C headers and runs make
automatically.  You will need to run this script for every change that you make to
xcard.c.

If you have any questions please contact me at:

corcordt@cs.purdue.edu

Thanks
Dave

--------------------------------------------------------------------------

Danny Kumamoto, 2-Nov-1998, Schlumberger APC, for Cyberflex Open16K support
Danny Kumamoto, February 23, 2000, Schlumberger APC, for Access support
mailto:Danny.Kumamoto@slb.com    http://www.cyberflex.slb.com/

This source was from http://www.linuxnet.com/

Xcard now supports Cyberflex Open16K and Cyberflex Access 
(class 00 and class F0) and uses the CT-API support put in by
Carlos Prados (see README.CTAPI).

To build SLB Reflex 6x version for Access (with Class byte of 00), you
don't have to change anything.  For other readers and Open16K or
Access with class byte of F0, you must change the Makefile to reflex
your reader or card.  "READER" defines the reader and "CCARD" defines
the card type.  "ACL_ALL" and "ACL_NONE" sets the #define's for making
AUT0 required for cardlet access (ACL_ALL makes non-AUT0 be all FF
while ACL_NONE makes nont-AUT0 be all 00 when the cardlet is created).
By default, ACL_ALL is enabled, so that after you create a cardlet, you
can select it without verifying AUT0.

I've changed it so much that it is hard to maintain the original code
and current changes (Cryptoflex vs. Cyberflex are very different,
since they were developed at two different development centers of
Schlumberger).

I've done my best to put in as much functionality of our Windows
Cyberflex Open16K toolkit as possible, given the time contraints.  For
Access, deletion is done via Java menu while Open16K, it is done via
file view.  Note that for Access, you can only create one instance of
cardlet (while in the Windows toolkit you can create multiple instance).
You can do everything that Windows toolkit support on Linux, but you
have to type in each APDU's yourself (or update the xcard code).

I realize that the documentation is sparce, but reading the code
should give a better feel for how things work.

Features that may not be obvious:

1. The delete file command only deletes an applet and you must be
inside the "applet" container (a directory, really).  This only works
for Open16K.  

2. You can enter AID (applet ID) using ASCII string by using double
quotes, like:

	"Danny's applet 1"

(You must end with double quote and the string length must be between
5 to 16 characters.)

3. Xcard should be enhanced so that it has a good log of all the
ADPU's sent.  I currently print selected APDU's (from APDU manager,
actually) and few error status returned from the card directly to the stdio.
Being able to cut and paste would be nice, too.

4. Cardlet window (uploading Java applet to the card) does everything
for you so that you can bring up APDU manager and start running your
applet -- no need to press several buttons to install and register
your applet, unlike the Windows Open16K toolkit.  Note that on Access,
you can only create one instance of a cardlet (Windows Access SDK
supports multiple instances).

5. There are several unused code which are commented out from old
Xcard. It may never be used but I didn't have the time to remove them
cleanly.

6. File view window is broken for Access.  Please contribute code to
the open source movement.

7. There are several obvious bugs -- it is left as an exercise to the reader
to find them and fix them! :-)

8. If you have any question, always take a peek at the source first.  (I didn't
write the original Xcard, so I was working in the blind in some areas.)

As my email is listed above, I can be reached there.

Good luck all,

Danny
