[Pcsclite-cvs-commit] HandlerTest/JavaCard COPYING,NONE,1.1 Cmd.txt,NONE,1.1 Compile.sh,NONE,1.1 Convert.sh,NONE,1.1 README,NONE,1.1 Verify.sh,NONE,1.1 config.sh,NONE,1.1 rad.gxp,NONE,1.1

rousseau@quantz.debian.org rousseau@quantz.debian.org
Thu, 04 Sep 2003 15:15:37 +0200


Update of /cvsroot/pcsclite/HandlerTest/JavaCard
In directory quantz:/tmp/cvs-serv3623

Added Files:
	COPYING Cmd.txt Compile.sh Convert.sh README Verify.sh 
	config.sh rad.gxp 
Log Message:
JavaCard applet needed for testing. Thanks to Jean-Luc Giraud


--- NEW FILE: COPYING ---
Copyright (c) 2003 Jean-Luc Giraud <jlgiraud@mac.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
   must display the following acknowledgement:
     This product includes software developed by: 
      Jean-Luc Giraud <jlgiraud@mac.com>
4. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission.

Changes to this license can be made only by the copyright author with 
explicit written consent.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--- NEW FILE: Cmd.txt ---
ReaderTest.java applet commands
===============================


Select Applet
~~~~~~~~~~~~~
-> 00 A4 04 00 06 A0 00 00 00 18 FF 00
<- 90 00

Case 1
~~~~~~
-> 80 21 00 00 00
<- 90 00

Case 2
~~~~~~
-> 80 22 00 00 xy 00 01 02 <- xy bytes -> (xy-1)
<- 90 00
ex: 80 22 00 00 0A 00 01 02 03 04 05 06 07 08 09
<- 90 00
1 <= xy <= 255

Case 3
~~~~~~
-> 80 23 ab cd xy
<- 00 01 02 <- ab cd bytes -> (xy-1) 90 00
	ab cd = 01 00 <=> xy = 00 (256 bytes)
ex: 80 23 00 0A 0A
<- 00 01 02 03 04 05 06 07 08 09 90 00
1 <= ab cd <= 256
Si ab cd = 01 00 alors xy = 0

Case 4
~~~~~~
-> 80 24 ab cd xy 00 <- xy bytes -> (xy-1)
<- 00 01 <- ab cd bytes -> cd 90 00

Get response (case 4)
~~~~~~~~~~~~~~~~~~~~~
-> 00 C0 00 00 xy
<- xy bytes

Time Request
~~~~~~~~~~~~
-> 80 25 00 xy
<- 90 00

Wait a amount of time proportionnal to xy. The card Java VM will send
automatic time requests.


--- NEW FILE: Compile.sh ---
#!/bin/sh

#    Compile.sh, script to compile a javacard applet
#    Copyright (C) 2002-2003  Ludovic Rousseau <ludovic.rousseau@free.fr>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

source config.sh

# System dependent data
JAVA_HOME=${JAVA_HOME:-/usr/lib/j2sdk1.3}
export JAVA_HOME

JC21=${JC21:-/usr/local/tools/jdk/java_card_kit-2_1_2}

JAVAC=$JAVA_HOME/bin/javac

# exit if error
set -e

if [ ! -d "$OUTPUT_DIR" ]
then
	mkdir "$OUTPUT_DIR"
fi

# print executed commands
set -x

$JAVAC -verbose -classpath $JC21/lib/api21.jar -g -d "$OUTPUT_DIR" $APPLET_SRC


--- NEW FILE: Convert.sh ---
#!/bin/sh

#    Convert.sh, script to convert a .class (Java) into .cap (JavaCard)
#    Copyright (C) 2002  Ludovic Rousseau <ludovic.rousseau@free.fr>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

source config.sh

# System dependent data
JAVA_HOME=${JAVA_HOME:-/usr/lib/j2sdk1.3}
export JAVA_HOME

JC21=${JC21:-/usr/local/tools/jdk/java_card_kit-2_1_2}
JC21BIN=$JC21/bin

CONVERTER=$JC21BIN/converter
CAPGEN=$JC21BIN/capgen

# applet name with '.' converted in '/'
# com.sun.javacard.samples.CardEdge -> com/sun/javacard/samples/CardEdge
APPLET_SLASH=$(echo $APPLET | sed -e 's/\./\//g' )

# last element of applet name
# com.sun.javacard.samples.CardEdge -> CardEdge
APPLET_NAME=$(basename $APPLET_SLASH)

# exit on the first error
set -e

# print executed commands
set -x

$CONVERTER -verbose -classdir out -exportpath $JC21/api21_export_files \
  -applet $APPLET_AID $APPLET_NAME -out CAP EXP JCA \
  $APPLET $PACKAGE_AID $VERSION

$CAPGEN \
  -o $OUTPUT_DIR/$APPLET_SLASH/javacard/$APPLET_NAME.jar \
  $OUTPUT_DIR/$APPLET_SLASH/javacard/$APPLET_NAME.jca


--- NEW FILE: README ---
JavaCard IHDHandler test applet
===============================

This applet is used to test smart cards drivers by sending/receiving ISO
7816 commands.


Authors:
========
- Jean-Luc Giraud
- Ludovic Rousseau


Supported platforms:
====================
- Any JavaCard 2.2


Licence:
========
The code included in this driver is licensed under a BSD-like license
(see COPYING at the root of the package).

History:
========
- 0.1.0 - 4 Sept 2003 Initial public release


--- NEW FILE: Verify.sh ---
#!/bin/sh

#    Verify.sh, script to verify a .jar (JavaCard) file
#    Copyright (C) 2002  Ludovic Rousseau <ludovic.rousseau@free.fr>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

source config.sh

# System dependent data
JAVA_HOME=${JAVA_HOME:-/usr/lib/j2sdk1.3}
export JAVA_HOME

JC21=${JC21:-/usr/local/tools/jdk/java_card_kit-2_1_2}
JC21BIN=$JC21/bin

VERIFYCAP=$JC21BIN/verifycap

# applet name with '.' converted in '/'
# com.sun.javacard.samples.CardEdge -> com/sun/javacard/samples/CardEdge
APPLET_SLASH=$(echo $APPLET | sed -e 's/\./\//g' )

# last element of applet name
# com.sun.javacard.samples.CardEdge -> CardEdge
APPLET_NAME=$(basename $APPLET_SLASH)

# print executed commands
set -x

$VERIFYCAP -verbose $JC21/api21_export_files/java/lang/javacard/lang.exp \
  $JC21/api21_export_files/javacard/framework/javacard/framework.exp \
  $JC21/api21_export_files/javacardx/crypto/javacard/crypto.exp \
  $JC21/api21_export_files/javacard/security/javacard/security.exp \
  \
  $OUTPUT_DIR/$APPLET_SLASH/javacard/$APPLET_NAME.exp \
  $OUTPUT_DIR/$APPLET_SLASH/javacard/$APPLET_NAME.jar


--- NEW FILE: config.sh ---
# Applet dependent data
APPLET_SRC=$(pwd)/src/org/debian/alioth/pcsclite/readertest/*.java
PACKAGE_AID="0xA0:00:00:00:0x18:0xFF"
APPLET_AID=$PACKAGE_AID:01
VERSION=1.0
APPLET=org.debian.alioth.pcsclite.readertest

OUTPUT_DIR=./out


--- NEW FILE: rad.gxp ---
<?xml version="1.0" encoding="UTF-8"?>
<GemXpressoProject>
    <PackageVersion MajorVersion="1" MinorVersion="0"/>
    <PackageInfo aid="A0 00 00 00 18 FF">
        <AppletInfo aid="A0 00 00 00 18 FF 01" name="readertest.class"/>
    </PackageInfo>
    <SourceAttributes/>
    <PackageName>org.debian.alioth.pcsclite.readertest</PackageName>
    <ClassFilePath>.\out</ClassFilePath>
    <SupportedCard disabled="false" name="GXP211v2_IS" supportedInteger="false">
        <OutputFilePath>.\oncard\GXP211v2_IS</OutputFilePath>
    </SupportedCard>
</GemXpressoProject>