diff --git a/README-rsrc/javacardos.png b/.github/resources/javacardos.png similarity index 100% rename from README-rsrc/javacardos.png rename to .github/resources/javacardos.png diff --git a/README-rsrc/logo.png b/.github/resources/logo.png similarity index 100% rename from README-rsrc/logo.png rename to .github/resources/logo.png diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml deleted file mode 100644 index 18a6dd8b..00000000 --- a/.github/workflows/ant.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Ant - run: ant -buildfile JCMathLibExamples/build.xml compile run - - diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..7185df26 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,27 @@ +name: Unit tests + +on: + push: + branches: [ master, ints ] + pull_request: + branches: [ master, ints ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository with submodules + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + - name: Run tests + run: ./gradlew test + - name: Run JavaCard build + run: ./gradlew buildJavaCard diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 00000000..b4a97769 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,20 @@ +name: Package JCMathLib + +on: + push: + branches: ['master', 'ints'] + +jobs: + package: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Package JCMathLib + run: python package.py + - name: Archive artifact + uses: actions/upload-artifact@v3 + with: + name: JCMathLib + path: jcmathlib.java diff --git a/.gitignore b/.gitignore index d7287527..bea6f1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,9 +20,9 @@ *.csv -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/JCMathLibTests/build/ -/JCMathLibTests/dist/ -/JCMathLibExamples/build/ -/JCMathLibExamples/dist/ \ No newline at end of file +# IDE files +.idea/ + +# Build files +.gradle/ +applet/build/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..9f1dc449 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs-sdks"] + path = libs-sdks + url = https://github.com/martinpaljak/oracle_javacard_sdks.git diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..4cadb53c --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,25 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Mavroudis" + given-names: "Vasilios" +- family-names: "Svenda" + given-names: "Petr" +- family-names: "Dufka" + given-names: "Antonin" +title: "JCMathLib" +version: 2.0 +url: "https://github.com/OpenCryptoProject/JCMathLib" +preferred-citation: + type: conference-paper + authors: + - family-names: "Mavroudis" + given-names: "Vasilios" + - family-names: "Svenda" + given-names: "Petr" + title: "JCMathLib: Wrapper Cryptographic Library for Transparent and Certifiable JavaCard Applets" + conference: "2020 IEEE European Symposium on Security and Privacy Workshops (EuroS&PW)" + start: 89 + end: 96 + doi: "10.1109/EuroSPW51379.2020.00022" + publisher: "IEEE" diff --git a/JCMathLib/!uploader/.gitignore b/JCMathLib/!uploader/.gitignore deleted file mode 100644 index 86d0cb27..00000000 --- a/JCMathLib/!uploader/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/JCMathLib/ext/ant-javacard.jar b/JCMathLib/ext/ant-javacard.jar deleted file mode 100644 index 2e07553e..00000000 Binary files a/JCMathLib/ext/ant-javacard.jar and /dev/null differ diff --git a/JCMathLib/ext/gp.exe b/JCMathLib/ext/gp.exe deleted file mode 100644 index 08086b6d..00000000 Binary files a/JCMathLib/ext/gp.exe and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/io/javacard/io.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/io/javacard/io.exp deleted file mode 100644 index 931133af..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/io/javacard/io.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/lang/javacard/lang.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/lang/javacard/lang.exp deleted file mode 100644 index f3498186..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/lang/javacard/lang.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/rmi/javacard/rmi.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/rmi/javacard/rmi.exp deleted file mode 100644 index 209cdf37..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/java/rmi/javacard/rmi.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/javacard/framework.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/javacard/framework.exp deleted file mode 100644 index 7deb6673..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/javacard/framework.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/service/javacard/service.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/service/javacard/service.exp deleted file mode 100644 index 8fbef2f6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/framework/service/javacard/service.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/security/javacard/security.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/security/javacard/security.exp deleted file mode 100644 index ece3b83c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacard/security/javacard/security.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacardx/crypto/javacard/crypto.exp b/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacardx/crypto/javacard/crypto.exp deleted file mode 100644 index 3df48b10..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/api_export_files/javacardx/crypto/javacard/crypto.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/apdutool b/JCMathLib/ext/java_card_kit-2_2_1/bin/apdutool deleted file mode 100644 index 5a1391bd..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/apdutool +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.apdutool.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/capdump b/JCMathLib/ext/java_card_kit-2_2_1/bin/capdump deleted file mode 100644 index dadebd17..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/capdump +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.capdump.CapDump "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/capgen b/JCMathLib/ext/java_card_kit-2_2_1/bin/capgen deleted file mode 100644 index d0abad1b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/capgen +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcasm.cap.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/converter b/JCMathLib/ext/java_card_kit-2_2_1/bin/converter deleted file mode 100644 index 70e9db76..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/converter +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Converter "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/cref b/JCMathLib/ext/java_card_kit-2_2_1/bin/cref deleted file mode 100644 index 32441152..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_1/bin/cref and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/exp2text b/JCMathLib/ext/java_card_kit-2_2_1/bin/exp2text deleted file mode 100644 index d88da737..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/exp2text +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Exp2Text "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/jcwde b/JCMathLib/ext/java_card_kit-2_2_1/bin/jcwde deleted file mode 100644 index c51669b7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/jcwde +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcwde.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/scriptgen b/JCMathLib/ext/java_card_kit-2_2_1/bin/scriptgen deleted file mode 100644 index 2df519bb..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/scriptgen +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.scriptgen.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifycap b/JCMathLib/ext/java_card_kit-2_2_1/bin/verifycap deleted file mode 100644 index 28256d94..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifycap +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.Verifier "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyexp b/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyexp deleted file mode 100644 index dc4c4fd9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyexp +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyExp "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyrev b/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyrev deleted file mode 100644 index 55b81581..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_1/bin/verifyrev +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright � 2003 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyRev "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/io/javacard/io.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/io/javacard/io.exp deleted file mode 100644 index 931133af..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/io/javacard/io.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/lang/javacard/lang.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/lang/javacard/lang.exp deleted file mode 100644 index f3498186..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/lang/javacard/lang.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/rmi/javacard/rmi.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/rmi/javacard/rmi.exp deleted file mode 100644 index 209cdf37..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/java/rmi/javacard/rmi.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/javacard/framework.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/javacard/framework.exp deleted file mode 100644 index 9e9351bf..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/javacard/framework.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/service/javacard/service.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/service/javacard/service.exp deleted file mode 100644 index 8fbef2f6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/framework/service/javacard/service.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/security/javacard/security.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/security/javacard/security.exp deleted file mode 100644 index d3279d48..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacard/security/javacard/security.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/apdu/javacard/apdu.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/apdu/javacard/apdu.exp deleted file mode 100644 index c9183d4f..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/apdu/javacard/apdu.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/biometry/javacard/biometry.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/biometry/javacard/biometry.exp deleted file mode 100644 index fb46fa30..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/biometry/javacard/biometry.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/crypto/javacard/crypto.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/crypto/javacard/crypto.exp deleted file mode 100644 index a9968bb6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/crypto/javacard/crypto.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/external/javacard/external.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/external/javacard/external.exp deleted file mode 100644 index 4af91e53..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/external/javacard/external.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/math/javacard/math.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/math/javacard/math.exp deleted file mode 100644 index 89a1ac6c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/math/javacard/math.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp deleted file mode 100644 index 58495fb0..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp deleted file mode 100644 index 881a9612..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/javacard/util.exp b/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/javacard/util.exp deleted file mode 100644 index 3ce0d16b..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/api_export_files/javacardx/framework/util/javacard/util.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/apdutool.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/apdutool.bat deleted file mode 100644 index 530b2a86..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/apdutool.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.apdutool.Main %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capdump.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capdump.bat deleted file mode 100644 index 542d1bc6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capdump.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.capdump.CapDump %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capgen.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capgen.bat deleted file mode 100644 index 7b725a5b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/capgen.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.jcasm.cap.Main %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/converter.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/converter.bat deleted file mode 100644 index 2e0682aa..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/converter.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.converter.Converter %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/cref.exe b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/cref.exe deleted file mode 100644 index cc3c2818..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/cref.exe and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/exp2text.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/exp2text.bat deleted file mode 100644 index 753f86dc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/exp2text.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.converter.Exp2Text %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jcwde.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jcwde.bat deleted file mode 100644 index 58f450e7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jcwde.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.jcwde.Main %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jpcsclite.dll b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jpcsclite.dll deleted file mode 100644 index bcb58b90..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/jpcsclite.dll and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/scriptgen.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/scriptgen.bat deleted file mode 100644 index 8bb1018d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/scriptgen.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.scriptgen.Main %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifycap.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifycap.bat deleted file mode 100644 index 94d22a3e..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifycap.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.offcardverifier.Verifier %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyexp.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyexp.bat deleted file mode 100644 index a9cd47ee..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyexp.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.offcardverifier.VerifyExp %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyrev.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyrev.bat deleted file mode 100644 index 7cb746fd..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/bin/verifyrev.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -if "%OS%" == "Windows_NT" setlocal - -if not "%JAVA_HOME%" == "" goto check_tool - echo Please set the JAVA_HOME environment variable. - goto end - -:check_tool -if not "%JC_HOME%" == "" goto doit - echo Please set the JC_HOME environment variable. - goto end - -:doit -set _CLASSES=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\apdutool.jar;%JC_HOME%\lib\jcwde.jar;%JC_HOME%\lib\converter.jar;%JC_HOME%\lib\scriptgen.jar;%JC_HOME%\lib\offcardverifier.jar;%JC_HOME%\lib\api.jar;%JC_HOME%\lib\installer.jar;%JC_HOME%\lib\capdump.jar;%JC_HOME%\samples\classes;%CLASSPATH%; - -%JAVA_HOME%\bin\java -classpath %_CLASSES% com.sun.javacard.offcardverifier.VerifyRev %* -goto end - -:end -if "%OS%" == "Windows_NT" endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apduio.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apduio.jar deleted file mode 100644 index ab57e262..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apduio.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apdutool.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apdutool.jar deleted file mode 100644 index c4ad9f29..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/apdutool.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api.jar deleted file mode 100644 index 98e07b2c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api_16.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api_16.jar deleted file mode 100644 index 6213631a..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/api_16.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/capdump.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/capdump.jar deleted file mode 100644 index 00f38c5c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/capdump.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/converter.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/converter.jar deleted file mode 100644 index 3728ebe4..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/converter.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/installer.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/installer.jar deleted file mode 100644 index 43004d52..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/installer.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/javacardframework.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/javacardframework.jar deleted file mode 100644 index 35762c41..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/javacardframework.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcclientsamples.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcclientsamples.jar deleted file mode 100644 index c1698910..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcclientsamples.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcrmiclientframework.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcrmiclientframework.jar deleted file mode 100644 index c0fdaad1..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcrmiclientframework.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde.jar deleted file mode 100644 index 1f6d0177..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde_16.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde_16.jar deleted file mode 100644 index 76de86b6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/jcwde_16.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/offcardverifier.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/offcardverifier.jar deleted file mode 100644 index e6b00a9d..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/offcardverifier.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/scriptgen.jar b/JCMathLib/ext/java_card_kit-2_2_2-win/lib/scriptgen.jar deleted file mode 100644 index e1b50c56..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/lib/scriptgen.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.properties b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.properties deleted file mode 100644 index aa5870fa..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.properties +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.xml b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.xml deleted file mode 100644 index 7a1087a7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - -]> - - - - This buildfile is used to build samples and demos. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&usage; - -&buildProperties; - -&samples; - -&demos; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_demos.xml b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_demos.xml deleted file mode 100644 index 661651e2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_demos.xml +++ /dev/null @@ -1,786 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.bat deleted file mode 100644 index 2f72016b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -REM - -REM Workfile:@(#)build_samples.bat 1.50 -REM Version:1.50 -REM Modified:01/03/06 19:01:01 - - setlocal - - if "%JAVA_HOME%" == "" goto warning1 - -:: Help - - if "%1" == "help" goto help - if "%1" == "-help" goto help - - if "%1" == "clean" goto cleanit - if "%1" == "-clean" goto cleanit - - ant build_samples - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - - -:help - ant samples_usage - goto quit - -:cleanit - ant clean - goto quit - - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.xml b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.xml deleted file mode 100644 index 1e207f48..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/build_samples.xml +++ /dev/null @@ -1,471 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/AccountAccessor.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/AccountAccessor.java deleted file mode 100644 index 9ffa4d0a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/AccountAccessor.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.ChannelsDemo; - -import javacard.framework.*; -import javacardx.apdu.*; - -/** - * This applet keeps track of the account information for a - * fictional wireless device connecting to a network service. - * The device has a home area, but it is also capable of operating - * in remote areas at a higher rate. Using the device debuts the - * amount of available credits. The terminal can also add credits - * to the account via a specific command. - */ - -public class AccountAccessor extends Applet - implements MultiSelectable, ExtendedLength { - - // code of CLA byte in the command APDU header - final static byte AA_CLA = (byte)0x80; - - // codes of INS byte in the command APDU header - final static byte GET_BALANCE = (byte) 0x10; - final static byte CREDIT = (byte) 0x20; - - final static short MAX_BALANCE = (short) 0x7FFF; - final static short SW_MAX_BALANCE_EXCEEDED = (short) 0x6A54; - final static short SW_INVALID_TRANSACTION_AMOUNT = (short) 0x6A55; - - // Account status constants - final static byte AREA_HOME = (byte) 0; - final static byte AREA_REMOTE = (byte) 1; - - //ConnectionManager AID - final static byte[] CONNECTION_MGR_AID_BYTES = - { (byte)0xA0, 0, 0, 0, (byte)0x62, 0x03, 0x01, 0x0C, 0x0B, 0x2 }; - - //error return status - final static short SW_NO_CONNECTION = (short)0x6905; - - // Connection data - private short[] chargeRate; - private short balance; - private short homeArea; - - static AccountAccessor theAccount = null; - - private AccountAccessor (byte[] bArray, short bOffset, byte bLength) { - chargeRate = new short[2]; - theAccount = this; - - // Set up initial account information - balance = 0; - homeArea = (short)((short)(bArray[bOffset++] << (short)8) | - (short)(bArray[bOffset++] & 0x00FF)); - - chargeRate[AREA_HOME] = (short)((short)(bArray[bOffset++] << - (short)8) | (short)(bArray[bOffset++] & (short)0x00FF)); - - chargeRate[AREA_REMOTE] = (short)((short)(bArray[bOffset++] << - (short)8) | (short)(bArray[bOffset++] & (short)0x00FF)); - - register(); - } - - public static void install(byte[] bArray, short bOffset, byte bLength){ - new AccountAccessor(bArray, bOffset, bLength); - } - - public boolean select() { - return true; - } - - public void deselect() { - // Nothing to do - } - - public boolean select(boolean appInstAlreadySelected) { - return true; - } - - public void deselect(boolean appInstStillSelected) { - // Nothing to do - } - - - public void process(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - - if (apdu.isISOInterindustryCLA()) { - if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) { - return; - } else { - ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED); - } - } - - switch (buffer[ISO7816.OFFSET_INS]) { - case GET_BALANCE: - getBalance(apdu); - return; - case CREDIT: - credit(apdu); - return; - default: - ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - boolean debit(short areaCode, boolean contactless) { - short amtToDebit; - if (areaCode == homeArea) { - amtToDebit = chargeRate[AREA_HOME]; - } else { - amtToDebit = chargeRate[AREA_REMOTE]; - } - //charge more if contactless - if(contactless) - amtToDebit += 20; - - if (balance >= amtToDebit) { - JCSystem.beginTransaction(); - balance = (short)(balance - amtToDebit); - JCSystem.commitTransaction(); - return true; - } else { - return false; - } - } - - public static AccountAccessor getAccount() { - return theAccount; - } - - private void credit(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - byte numBytes = buffer[ISO7816.OFFSET_LC]; - byte byteRead = (byte)(apdu.setIncomingAndReceive()); - - if ( ( numBytes != 2 ) || (byteRead != 2) ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - short creditAmount = (short) - ((short)(buffer[ISO7816.OFFSET_CDATA] << (short)8) | - (short)(buffer[ISO7816.OFFSET_CDATA + 1])); - - if ( ( creditAmount > MAX_BALANCE) - || ( creditAmount < (short)0 ) ) { - ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT); - } - - if ( (short)( balance + creditAmount) > MAX_BALANCE ) { - ISOException.throwIt(SW_MAX_BALANCE_EXCEEDED); - } - - JCSystem.beginTransaction(); - balance = (short)(balance + creditAmount); - JCSystem.commitTransaction(); - - } - - private void getBalance(APDU apdu) { - - AID connection_aid = JCSystem.lookupAID( CONNECTION_MGR_AID_BYTES, - (short)0, (byte)CONNECTION_MGR_AID_BYTES.length); - if (!(JCSystem.isAppletActive(connection_aid))) - ISOException.throwIt(SW_NO_CONNECTION); - - byte[] buffer = apdu.getBuffer(); - short le = apdu.setOutgoing(); - - if ( le < 2 ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - apdu.setOutgoingLength((byte)2); - - buffer[0] = (byte)(balance >> (short)8); - buffer[1] = (byte)(balance & (short)0x00FF); - - apdu.sendBytes((short)0, (short)2); - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ChannelsDemo.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ChannelsDemo.opt deleted file mode 100644 index 4c3f6f56..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ChannelsDemo.opt +++ /dev/null @@ -1,6 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xb:0x1 com.sun.javacard.samples.ChannelsDemo.AccountAccessor --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xb:0x2 com.sun.javacard.samples.ChannelsDemo.ConnectionManager -com.sun.javacard.samples.ChannelsDemo -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xb 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ConnectionManager.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ConnectionManager.java deleted file mode 100644 index 9de83afe..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ChannelsDemo/ConnectionManager.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.ChannelsDemo; - -import javacard.framework.*; -import javacardx.apdu.*; - -/** - * This applet keeps track of the network connection for a - * fictional wireless device. Every time unit the device is - * being actively used on the network will result in decreasing - * credits available to the user. If the user changes areas, - * different charge rates applies. If the user runs out of - * credits, then the connection is terminated. - */ - -public class ConnectionManager extends Applet - implements MultiSelectable, ExtendedLength { - - // code of CLA byte in the command APDU header - final static byte CM_CLA = (byte)0x80; - - // codes of INS byte in the command APDU header - final static byte TIMETICK = (byte) 0x10; - final static byte SETCONNECTION = (byte) 0x20; - final static byte RESETCONNECTION = (byte) 0x30; - final static byte VALIDATEKEY = (byte) 0x40; - - // Connection status constants - final static short INACTIVE_AREA = (short) 0xFFFF; - final static byte CONNECTION_INUSE = (byte) 0x01; - final static byte CONNECTION_FREE = (byte) 0x00; - - final static short SW_CONNECTION_BUSY = (short)0x6A50; - final static short SW_NEGATIVE_BALANCE = (short)0x6A51; - final static short SW_NO_NETWORK = (short)0x6A52; - final static short SW_NO_ACCOUNT = (short)0x6A53; - final static short SW_INVALID_KEY = (short)0x6A54; - - // Connection data - private short[] activeAreaCode; - private byte[] connectionStatus; - - private ConnectionManager (byte[] bArray, short bOffset, byte bLength) { - // The connection manager keeps track of the area where the - // device is operating. Since the area changes as the user moves, - // we keep track of the area by setting a variable in Transient - // Clear-On-Deselect memory. - activeAreaCode = - JCSystem.makeTransientShortArray((short)1, - JCSystem.CLEAR_ON_DESELECT); - activeAreaCode[0] = INACTIVE_AREA; - connectionStatus = - JCSystem.makeTransientByteArray((short)1, - JCSystem.CLEAR_ON_DESELECT); - register(); - } - - public static void install(byte[] bArray, short bOffset, byte bLength){ - new ConnectionManager(bArray, bOffset, bLength); - } - - public boolean select() { - initState(); - return true; - } - - public void deselect() { - clearState(); - } - - public boolean select(boolean appInstAlreadySelected) { - // The connection manager can only be selected on one - // logical channel. Reject selection if terminal tries - // to select connection in more than one channel. - if (appInstAlreadySelected) { - // No more than 1 channel selection allowed - return false; - } else { - initState(); - return true; - } - } - - public void deselect(boolean appInstStillSelected) { - clearState(); - } - - public void process(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - - if (apdu.isISOInterindustryCLA()) { - if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) { - return; - } else { - ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED); - } - } - - switch (buffer[ISO7816.OFFSET_INS]) { - case VALIDATEKEY: - validateKey(apdu); - return; - case TIMETICK: - timeTick(apdu); - return; - case SETCONNECTION: - setConnection(); - return; - case RESETCONNECTION: - resetConnection(); - return; - default: - ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED); - } - - } - - // Check that the key sent is valid - private void validateKey(APDU apdu){ - //fake key test - byte[] buffer = apdu.getBuffer(); - //process extended length apdu - short testKey = (short)((short)(buffer[ISO7816.OFFSET_EXT_CDATA] << (short)8) | - (short)(buffer[ISO7816.OFFSET_EXT_CDATA + 3] & 0x00FF)); - if(testKey != (short) 3) - ISOException.throwIt(SW_INVALID_KEY); - return; - //System.out.println("here here"); - } - - // Connection management methods - private void timeTick(APDU apdu) { - // Updates the area code according to the passed parameter. - byte[] buffer = apdu.getBuffer(); - byte numBytes = (byte)(buffer[ISO7816.OFFSET_LC]); - byte byteRead = (byte)(apdu.setIncomingAndReceive()); - - if ( ( numBytes != 2 ) || (byteRead != 2) ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - // get area code - short newAreaCode = (short) - ((short)(buffer[ISO7816.OFFSET_CDATA] << (short)8) | - (short)(buffer[ISO7816.OFFSET_CDATA + 1] & 0x00FF)); - - if (newAreaCode != INACTIVE_AREA) { - activeAreaCode[0] = newAreaCode; - } else { - resetConnection(); - ISOException.throwIt(SW_NO_NETWORK); - } - - short connectionType = apdu.getProtocol(); - byte b = apdu.getCLAChannel(); - boolean contactless = false; - if((connectionType & 0xf0) == 0x80//APDU.PROTOCOL_MEDIA_CONTACTLESS_TYPE_A - || (connectionType & 0xf0) == 0x90){//APDU.PROTOCOL_MEDIA_CONTACTLESS_TYPE_B ){ - contactless = true; - } - - // If a connection is active, the user account is debited. - // If user runs out of credits, the connection is terminated. - if (connectionStatus[0] == CONNECTION_INUSE) { - - if (AccountAccessor.getAccount() == null) { - ISOException.throwIt(SW_NO_ACCOUNT); - } - - if (AccountAccessor.getAccount().debit(activeAreaCode[0], contactless) == false) { - resetConnection(); - ISOException.throwIt(SW_NEGATIVE_BALANCE); - } - } - } - - private void setConnection() { - - if (AccountAccessor.getAccount() == null) { - ISOException.throwIt(SW_NO_ACCOUNT); - } - - if (connectionStatus[0] == CONNECTION_INUSE) { - ISOException.throwIt(SW_CONNECTION_BUSY); - } - - if (activeAreaCode[0] == INACTIVE_AREA) { - ISOException.throwIt(SW_NO_NETWORK); - } - - // The first time unit is charged at connection setup - if (AccountAccessor.getAccount().debit(activeAreaCode[0], false)) { - connectionStatus[0] = CONNECTION_INUSE; - } else { - ISOException.throwIt(SW_NEGATIVE_BALANCE); - } - } - - private void resetConnection() { - // Terminate the connection - connectionStatus[0] = CONNECTION_FREE; - } - - private void initState() { - connectionStatus[0] = CONNECTION_FREE; - activeAreaCode[0] = INACTIVE_AREA; - } - - private void clearState() { - activeAreaCode[0] = INACTIVE_AREA; - connectionStatus[0] = CONNECTION_FREE; - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.java deleted file mode 100644 index 8d25a672..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)HelloWorld.java 1.7 -// Version:1.7 -// Date:01/03/06 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/HelloWorld/HelloWorld.java -// Modified:01/03/06 19:01:06 -// Original author: Mitch Butler -// */ - -package com.sun.javacard.samples.HelloWorld; - -import javacard.framework.*; - -/** - */ - -public class HelloWorld extends Applet -{ - private byte[] echoBytes; - private static final short LENGTH_ECHO_BYTES = 256; - - /** - * Only this class's install method should create the applet object. - */ - protected HelloWorld() - { - echoBytes = new byte[LENGTH_ECHO_BYTES]; - register(); - } - - /** - * Installs this applet. - * @param bArray the array containing installation parameters - * @param bOffset the starting offset in bArray - * @param bLength the length in bytes of the parameter data in bArray - */ - public static void install(byte[] bArray, short bOffset, byte bLength) - { - new HelloWorld(); - } - - /** - * Processes an incoming APDU. - * @see APDU - * @param apdu the incoming APDU - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public void process(APDU apdu) - { - byte buffer[] = apdu.getBuffer(); - - short bytesRead = apdu.setIncomingAndReceive(); - short echoOffset = (short)0; - - while ( bytesRead > 0 ) { - Util.arrayCopyNonAtomic(buffer, ISO7816.OFFSET_CDATA, echoBytes, echoOffset, bytesRead); - echoOffset += bytesRead; - bytesRead = apdu.receiveBytes(ISO7816.OFFSET_CDATA); - } - - apdu.setOutgoing(); - apdu.setOutgoingLength( (short) (echoOffset + 5) ); - - // echo header - apdu.sendBytes( (short)0, (short) 5); - // echo data - apdu.sendBytesLong( echoBytes, (short) 0, echoOffset ); - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.opt deleted file mode 100644 index d29f9316..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 com.sun.javacard.samples.HelloWorld.HelloWorld -com.sun.javacard.samples.HelloWorld -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.java deleted file mode 100644 index e019b07a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)JavaLoyalty.java 1.13 06/01/03 - */ - -package com.sun.javacard.samples.JavaLoyalty; - -import javacard.framework.*; -import com.sun.javacard.samples.SampleLibrary.JavaLoyaltyInterface; - -/** - * Minimalistic loyalty applet. - * JavaPurse uses grantPoints method implementing JavaLoyaltyInterface - * to grant loyalty points. JavaLoyalty can process only two command APDUs: - * READ_BALANCE and RESET_BALANCE. - * @author Vadim Temkin - */ -public class JavaLoyalty extends Applet implements JavaLoyaltyInterface { - - /* - * - * Constants - * - */ - final static byte READ_BALANCE = (byte) 0x20; //INS byte for Read Balance - final static byte RESET_BALANCE = (byte) 0x22; //INS byte for Reset Balance - final static byte CREDIT = (byte) 0x01; //byte for Credit in grantPoints buffer - final static byte DEBIT = (byte) 0x02; //byte for Debit in grantPoints buffer - final static short TRANSACTION_TYPE_OFFSET = 2; - final static short TRANSACTION_AMOUNT_OFFSET = 3; - final static short SCALE = (short) 100; //1 Loyalty Point per $1 (100c) debit - final static short BALANCE_MAX = (short)30000; //One won't get free flight from SFO to LAX - //for this amount now, but we don't want to - //introduce byte-array arithmetics for this - //sample applet - short balance; - - /** - * Installs Java Loyalty applet. - * @param bArray install parameter array. - * @param bOffset where install data begins. - * @param bLength install parameter data length. - */ - public static void install( byte[] bArray, - short bOffset, byte bLength ) { - new JavaLoyalty(bArray, bOffset, bLength); - } - - /** - * Performs memory allocations, initializations, and applet registration - * - * @param bArray received by install. - * @param bOffset received by install. - * @param bLength received by install. - */ - protected JavaLoyalty(byte[] bArray, - short bOffset, byte bLength) { - balance = (short)0; - /* - * if AID length is not zero register Java Loyalty - * applet with specified AID - * - * NOTE: all the memory allocations should be performed before register() - */ - - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - register(); - } else { - register(bArray, (short)(bOffset+1), aidLen); - } - } - - /** - * Implements getShareableInterfaceObject method of Applet class. - *

JavaLoyalty could check here if the clientAID is that of JavaPurse - * Checking of the parameter to be agreed upon value provides additional - * security, or, if the Shareable Interface Object weren't JavaLoyalty itself - * it could return different Shareable Interface Objects for different values - * of clientAID and/or parameter. - *

SeeJava Card Runtime Environment (JCRE) Specification - * for details. - * - * @param clientAID AID of the client - * @param parameter additional parameter - * @return JavaLoyalty object - */ - public Shareable getShareableInterfaceObject(AID clientAID, - byte parameter) { - if (parameter == (byte)0) - return this; - else - return null; - } - - /** - * Implements main interaction with a client. The data is transfered - * through APDU buffer which is a global array accessible from any - * context. The format of data in the buffer is subset of Transaction - * Log record format: 2 bytes of 0, 1 byte of transaction type, 2 bytes - * amount of transaction, 4 bytes of CAD ID, 3 bytes of date, and 2 bytes - * of time. This sample implementation ignores everything but transaction - * type and amount. - * @param buffer APDU buffer - */ - public void grantPoints (byte[] buffer) { - short amount = Util.getShort(buffer, TRANSACTION_AMOUNT_OFFSET); - amount = (short) (amount / SCALE); - switch (buffer[TRANSACTION_TYPE_OFFSET]) { - case DEBIT: - balance = (short)(balance + amount); break; - case CREDIT: - balance = (short) (balance - amount); break; - } - if (balance < 0) balance = 0; - if (balance > BALANCE_MAX) balance = BALANCE_MAX; - /* - * For this simple sample applet we don't keep track of transaction locations and - * timestamps - */ - } - - /** - * Dispatches APDU commands. - * @param apdu APDU - */ - public void process(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - // We don't do any additional C-APDU header checking, just rely on - // CLA and INS bytes for dispatching. - - if (apdu.isISOInterindustryCLA()) { - if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) { - return; - } else { - ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED); - } - } - - switch (buffer[ISO7816.OFFSET_INS]) { - case READ_BALANCE: - processReadBalance(apdu); break; - case RESET_BALANCE: - processResetBalance(); break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - /** - * Sends 2 bytes of balance value in R-APDU. - * @param apdu APDU - */ - void processReadBalance(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - Util.setShort(buffer, (short)0, balance); - apdu.setOutgoingAndSend((short)0, (short)2); - } - - /** - * Resets Balance. - */ - void processResetBalance() { - balance = (short)0; - } -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.opt deleted file mode 100644 index 47fcab2a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5:1 com.sun.javacard.samples.JavaLoyalty.JavaLoyalty -com.sun.javacard.samples.JavaLoyalty -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/CyclicFile.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/CyclicFile.java deleted file mode 100644 index 7e2f4da1..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/CyclicFile.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)CyclicFile.java 1.9 -// Version:1.9 -// Date:01/03/06 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/CyclicFile.java -// Modified:01/03/06 19:01:06 -// Original author: Zhiqun Chen -// */ - -package com.sun.javacard.samples.JavaPurse; - -import javacard.framework.*; - -/** - * Class CyclicFile implements ISO 7816 CyclicFile. - * This class always allocates one more record than the maximum - * number of allowed records in CyclicFile. Method getNewLogRecord - * returns a new record without affecting contents of CyclicFile. - * Method updateNewLogRecord updates the internal record pointers, - * so the new record becomes the current record(record number one) - * and the oldest record becomes the next new record. - * - * @author Zhiqun Chen (zhiqun.chen@sun.com) - */ - -class CyclicFile -{ - - // number of allocated records in CyclicFile. This - // value is one plus the maximum number of records. - private byte num_record; - - // pointer to the current record (record number). - private byte current_record = -1; - - // pointer to next new record. - private byte next_record; - - // records in CyclicFile - private Record[] records; - - /** - * Constructor - * @param max_record maximum number of record in CyclicFile - * @param record_length record length - */ - CyclicFile(byte max_record, byte record_length) { - - // allocate one more record than the maximum number - // of allowed records in CyclicFile - num_record = ++max_record; - - records = new Record[num_record]; - - for ( byte i = 0; i < num_record; i++) { - records[i] = new Record(record_length); - } - } - - /** - * Get a record with the specified record number - * @param recordNum record number - * @return the specified record - */ - byte[] getRecord(byte recordNum){ - - // check if the record number is in the range of 1..maximum record number - if ( ( recordNum < 1 ) || ( recordNum > (byte)(num_record - 1 ) ) ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - - if ((recordNum = (byte) (current_record - recordNum + 1)) < 0 ) - recordNum += num_record; - - return records[recordNum].record; - } - - /** - * Find the record. - * @param firstByte if non-0, the record's first byte must match this value; if 0, any value of the record's first byte matches. - * @return the record number, or 0 if the record is not found - */ - - byte findRecord(byte firstByte) { - - byte eRecNum = num_record--; //max record - byte currentRecNumber = 1; - byte thisRec[]; - - while (true) { - - thisRec = getRecord(currentRecNumber); - - if ( firstByte == 0) { - return currentRecNumber; - } - - if ( thisRec[0] == firstByte) { - return currentRecNumber; - } - - if ( currentRecNumber == eRecNum ) - return 0; - currentRecNumber++; - } - } - - /** - * Get a new record - * @return the new record - */ - byte[] getNewLogRecord() { - - byte[] record = records[next_record].record; - return record; - - } - - /** - * Update internal record pointers, so the new record - * becomes the current record and the oldest - * record in CyclicFile becomes the next new record - * @see getNewLogRecord - */ - void updateNewLogRecord() { - - // update current record pointer and next record pointer - if (++current_record == num_record) - current_record = 0; - - if (++next_record == num_record) - next_record = 0; - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.java deleted file mode 100644 index adf8485c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.java +++ /dev/null @@ -1,883 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)JavaPurse.java 1.17 06/01/04 - */ - -package com.sun.javacard.samples.JavaPurse; - -import javacard.framework.*; -import com.sun.javacard.samples.SampleLibrary.JavaLoyaltyInterface; - -/** - * This class is intended to demonstrate how an electronic cash application - * might be developed using Java Card - *

See Java Card(TM) Development Kit User's Guide - * for details. - * - * @author Vadim Temkin - */ -public class JavaPurse extends Applet { - /* - * - * Constants - * - */ - final static byte VERIFY = (byte)0x20; //INS value for ISO 7816-4 VERIFY command - final static byte READ = (byte)0xB2; //INS value for ISO 7816-4 READ RECORD command - final static byte INITIALIZE_TRANSACTION = (byte)0x20; //INS byte for Initialize Transaction - final static byte COMPLETE_TRANSACTION = (byte)0x22; //INS byte for Complete Transaction - final static byte INITIALIZE_UPDATE = (byte)0x24; //INS byte for Initialize Parameter Update - final static byte COMPLETE_UPDATE = (byte)0x26; //INS byte for Complete Parameter Update - final static byte CREDIT = (byte)0x01; //P1 byte for Credit in Initialize Transaction - final static byte DEBIT = (byte)0x02; //P1 byte for Debit in Initialize Transaction - final static byte MASTER_PIN = (byte)0x81; //P2 byte for Master PIN in Verify - final static byte USER_PIN = (byte)0x82; //P2 byte for User PIN in Verify - - final static short SW_CREDIT_TOO_HIGH = (short)0x9101;//SW bytes for Credit Too High condition - final static short SW_NOT_ENOUGH_FUNDS = (short)0x9102;//SW bytes for Not Enough Funds condition - final static short SW_AMOUNT_TOO_HIGH = (short)0x9103;//SW bytes for Amount Too High condition - final static short SW_COMMAND_OUT_OF_SEQUENCE = (short)0x9104;//SW bytes for Command out of Sequence - final static short SW_WRONG_SIGNATURE = (short)0x9105;//SW bytes for Wrong Signature condition - final static short SW_PIN_FAILED = (short)0x69C0;//SW bytes for PIN Failed condition - //The last nibble is replaced with the - //number of remaining tries - - final static byte LC_IT = 10; //Lc byte for Initialize Transaction - final static byte LC_CT = 13; //Lc byte for Complete Transaction - final static byte LC_CU_MIN = 18; //Lc byte for Complete Update - final static byte CAD_ID_OFFSET = 7; //Offset for CAD ID in Process Initialize Transaction - final static short DATE_LENGTH = 3; //Length of ExpDate array - final static short DATETIME_LENGTH = 5;//Length of DateTime array - final static short ID_LENGTH = 4; //Length for CAD ID and Purse ID arrays - final static short SHORT_LENGTH= 2; //Length of a short value for offset computations - final static short START = 0; //For offset computations - final static short SIGNATURE_LENGTH - = 8; //Length of signatures - final static short MAX_LOYALTY = 4; //Max number of loyalty applets - - // transientShorts array indices - final static byte TN_IX = 0; - final static byte NEW_BALANCE_IX=(byte)TN_IX+1; - final static byte CURRENT_BALANCE_IX=(byte)NEW_BALANCE_IX+1; - final static byte AMOUNT_IX=(byte)CURRENT_BALANCE_IX+1; - final static byte TRANSACTION_TYPE_IX=(byte)AMOUNT_IX+1; - final static byte SELECTED_FILE_IX=(byte)TRANSACTION_TYPE_IX+1; - final static byte NUM_TRANSIENT_SHORTS=(byte)SELECTED_FILE_IX+1; - - // transientBools array indices - final static byte TRANSACTION_INITIALIZED=0; - final static byte UPDATE_INITIALIZED=(byte)TRANSACTION_INITIALIZED+1; - final static byte NUM_TRANSIENT_BOOLS=(byte)UPDATE_INITIALIZED+1; - - // constants for response to applet SELECT command - private final static byte FCI_TEMPLATE_TAG = (byte)0x6F; - private final static byte FCI_AID_TAG = (byte)0x84; - private static byte[] FCI_PROPERIETARY = { - (byte)0xA5, // tag - (byte)0x01, // length - (byte)0x42 }; // value - - private ParametersFile parametersFile; - private CyclicFile transactionLogFile; - private short TN; - private short PUN; - private boolean isPersonalized; //set to true when Master PIN is updated first time - /* - * File System emulation constants - */ - final static short PARAMETERS_FID = (short) 0x9102; - final static short TRANSACTION_LOG_FID = (short) 0x9103; - final static short BALANCES_FID = (short) 0x9104; - final static byte FID_BYTE = (byte) 0x91; - final static byte TRANSACTION_RECORD_LENGTH = 18; - final static byte TRANSACTION_RECORD_NUMBER = 10; - final static byte BALANCES_RECORD_LENGTH = 6; - final static byte BALANCES_RECORD_NUMBER = 1; - final static byte PARAMETERS_RECORD_NUMBER = 11; - final static byte OFFSET_BAL_CURRENT = 0; - final static byte OFFSET_BAL_MAX = 2; - final static byte OFFSET_AMOUNT_MAX = 4; - final static byte NUMBER_OF_FILES = 3; - - - private OwnerPIN masterPIN; - private OwnerPIN userPIN; - - /* - * Tags for TLV records in Complete Parameter Update C-APDU. - */ - final static byte MASTER_PIN_UPDATE = (byte)0xC1; - final static byte USER_PIN_UPDATE = (byte)0xC2; - final static byte EXP_DATE_UPDATE = (byte)0xC5; - final static byte PURSE_ID_UPDATE = (byte)0xC6; - final static byte MAX_BAL_UPDATE = (byte)0xC7; - final static byte MAX_M_UPDATE = (byte)0xC8; - final static byte VERSION_UPDATE = (byte)0xC9; - final static byte LOYALTY1_UPDATE = (byte)0xCA; - final static byte LOYALTY2_UPDATE = (byte)0xCB; - final static byte LOYALTY3_UPDATE = (byte)0xCC; - final static byte LOYALTY4_UPDATE = (byte)0xCD; - - final static short TLV_OFFSET = 13; //Offset of TLV in Complete Parameter Update - - - /* - * - * Various and sundry byte arrays - * - */ - - private byte[] CAD_ID_array; - private byte[] byteArray8; - private short[] transientShorts; - private boolean[] transientBools; - private byte[] ID_Purse; - private byte[] ExpDate; - private byte[] balancesRecord; - - /* - * The two associated arrays to represent Loyalty Applets. - * If value of loyaltyCAD matches first 2 bytes of CAD ID for transaction - * the grantPoints method of corresponding loyalty Shareable Interface Object - * is called. These arrays are populated by Parameter Update APDU commands. - */ - private short[] loyaltyCAD; - private JavaLoyaltyInterface[] loyaltySIO; - - /** - * Installs Java Purse applet. - * @param bArray install parameter array. - * @param bOffset where install data begins. - * @param bLength install parameter data length. - */ - public static void install( byte[] bArray, short bOffset, byte bLength ) { - new JavaPurse(bArray, bOffset, bLength); - } - - /** - * Performs memory allocations, initialization, and applet registration. - * - * @param bArray received by install. - * @param bOffset received by install. - * @param bLength received by install. - */ - protected JavaPurse(byte[] bArray, short bOffset, byte bLength) { - ID_Purse = new byte[ID_LENGTH]; - ExpDate = new byte[DATE_LENGTH]; - ExpDate[0] = (byte)12; ExpDate[1] = (byte)31; ExpDate[2] = (byte)99; - balancesRecord = new byte[BALANCES_RECORD_LENGTH]; - loyaltyCAD = new short[MAX_LOYALTY]; - loyaltySIO = new JavaLoyaltyInterface[MAX_LOYALTY]; - - TN = 0; - PUN = 0; - isPersonalized = false; - - //Create transient objects. - transientShorts = JCSystem.makeTransientShortArray( NUM_TRANSIENT_SHORTS, - JCSystem.CLEAR_ON_DESELECT); - transientBools = JCSystem.makeTransientBooleanArray( NUM_TRANSIENT_BOOLS, - JCSystem.CLEAR_ON_DESELECT); - - CAD_ID_array = JCSystem.makeTransientByteArray( (short)4, - JCSystem.CLEAR_ON_DESELECT); - byteArray8 = JCSystem.makeTransientByteArray( (short)8, - JCSystem.CLEAR_ON_DESELECT); - - masterPIN = new OwnerPIN ((byte)1, (byte)8); - //There is only one try - it's not supposed to be done by human operator - userPIN = new OwnerPIN ((byte)5, (byte)8); - - parametersFile = new ParametersFile(PARAMETERS_RECORD_NUMBER); - - transactionLogFile = new CyclicFile(TRANSACTION_RECORD_NUMBER, - TRANSACTION_RECORD_LENGTH); - Util.setShort(balancesRecord, OFFSET_BAL_CURRENT, (short)0); - - /* - * if AID length is not zero register Java Loyalty - * applet with specified AID - * - * NOTE: all the memory allocations should be performed before register() - */ - - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - register(); - } else { - register(bArray, (short)(bOffset+1), aidLen); - } - } - - - /** - * Performs the session finalization. - */ - public void deselect() { - userPIN.reset(); - masterPIN.reset(); - } - - - /** - * Dispatches APDU commands. - * @param apdu APDU object - */ - public void process(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - - if (!apdu.isISOInterindustryCLA()) { - switch (buffer[ISO7816.OFFSET_INS]) { - case INITIALIZE_TRANSACTION: - processInitializeTransaction(apdu); break; - case COMPLETE_TRANSACTION: - processCompleteTransaction(apdu); break; - case INITIALIZE_UPDATE: - processInitializeUpdate(apdu); break; - case COMPLETE_UPDATE: - processCompleteUpdate(apdu); break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } else { - if (buffer[ISO7816.OFFSET_INS] == VERIFY) { - processVerifyPIN(apdu); - } else if (buffer[ISO7816.OFFSET_INS] == ISO7816.INS_SELECT) { - if (selectingApplet()) - processSelectPurse(apdu); - else - processSelectFile(apdu); - } else if (buffer[ISO7816.OFFSET_INS] == READ) { - processReadRecord(apdu); - } else - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - /** - * Handles Select Purse APDU. - * @param apdu APDU object - */ - private void processSelectPurse(APDU apdu) { - // - // There might be multiple instances of Java Purse on the card with - // different AID values. This method returns the FCI here identifying its - // particular instance. - // - - // Format of response data - // FCI tag, FCI length, - // AID tag, length, value, - // PROPRIETARY tag, value. - // - - // TEMPLATE - byte[] buffer = apdu.getBuffer(); - buffer[0] = FCI_TEMPLATE_TAG; - // buffer[1] set later - - // AID - buffer[2] = FCI_AID_TAG; - buffer[3] = JCSystem.getAID().getBytes(buffer, (short)4); - short offset=(short)(3+buffer[3]); - - // PROPRIETARY DATA - buffer[offset++] = (byte)FCI_PROPERIETARY.length; - offset = Util.arrayCopyNonAtomic(FCI_PROPERIETARY, (short)0, - buffer, offset, (short)FCI_PROPERIETARY.length); - - // FCI template length - buffer[1] = (byte)(offset-(short)2); - - apdu.setOutgoingAndSend((short)0, offset); - } - - /** - * Handles Initialize Transaction APDU. - *

See Java Card(TM) Development Kit User's Guide for details. - * - * @param apdu APDU object - */ - private void processInitializeTransaction(APDU apdu) { - if (transientBools[TRANSACTION_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - if (!userPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - byte[] buffer = apdu.getBuffer(); - if (buffer[ISO7816.OFFSET_LC] != LC_IT) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - if (buffer[ISO7816.OFFSET_P2] != 0) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - apdu.setIncomingAndReceive(); // get expected data - byte transactionType = buffer[ISO7816.OFFSET_P1]; - transientShorts[TRANSACTION_TYPE_IX] = transactionType; - short amount = Util.getShort(buffer, ISO7816.OFFSET_CDATA); - transientShorts[AMOUNT_IX] = amount; - - short balance = checkTransactionValues(transactionType, amount); - - // Increment TN in Transient Memory & compute signature - short newTN = (short)(TN + 1); - transientShorts[TN_IX] = newTN; - Util.arrayCopyNonAtomic(buffer, CAD_ID_OFFSET, CAD_ID_array, START, ID_LENGTH); - - // The crypto processing could be done here - Util.arrayFillNonAtomic(byteArray8, (short)0, (short) byteArray8.length, (byte)0); - - // Send R-APDU - short offset = Util.arrayCopyNonAtomic(ID_Purse, START, buffer, START, ID_LENGTH); - offset = Util.arrayCopyNonAtomic(ExpDate, START, buffer, offset, DATE_LENGTH); - offset = Util.setShort(buffer, offset, balance); - offset = Util.setShort(buffer, offset, newTN); - offset = Util.arrayCopyNonAtomic(byteArray8, START, buffer, offset, SIGNATURE_LENGTH); - - apdu.setOutgoingAndSend(START, (short)(offset - START)); - transientBools[TRANSACTION_INITIALIZED] = true; - } - - /** - * Handles Complete Transaction APDU. - * @param apdu APDU object - */ - private void processCompleteTransaction(APDU apdu) { - if (!transientBools[TRANSACTION_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - byte[] buffer = apdu.getBuffer(); - if (buffer[ISO7816.OFFSET_LC] != LC_CT) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - - apdu.setIncomingAndReceive(); // get expected data - - //restore transaction data from transient - short newTN = transientShorts[TN_IX]; - short amount = transientShorts[AMOUNT_IX]; - short newBalance = transientShorts[NEW_BALANCE_IX]; - //The signature verification could be here - Util.arrayFillNonAtomic(byteArray8, (short)0, (short) byteArray8.length,(byte)0); - boolean signatureOK = (0 == Util.arrayCompare(buffer, - (short)ISO7816.OFFSET_CDATA, byteArray8, START, SIGNATURE_LENGTH)); - - //prepare transaction record in APDU buffer - short offset = Util.setShort(buffer, START, newTN); - buffer[offset] = (byte)transientShorts[TRANSACTION_TYPE_IX]; - offset++; - offset = Util.setShort(buffer, offset, amount); - //CAD ID was left in this array from Initialize Transaction - offset = Util.arrayCopyNonAtomic(CAD_ID_array, START, buffer, offset, ID_LENGTH); - - //Date and time are copied in APDU buffer to where they should go - //in the transaction record. - short balanceOffset = offset = - Util.arrayCopyNonAtomic(buffer, (short)(ISO7816.OFFSET_CDATA + 8), - buffer, offset, DATETIME_LENGTH); - //Balance and SW will be added to transactionRecord later - if (!signatureOK) { - //Branch for unsuccessful transaction. Balance is not updated, - //otherwise transactionLog is recorded the same way as in successful transaction - offset = Util.setShort(buffer, offset, transientShorts[CURRENT_BALANCE_IX]); // old balance - Util.setShort(buffer, offset, SW_WRONG_SIGNATURE); - //done with preparing transaction record - - byte[] theRecord = transactionLogFile.getNewLogRecord(); - //The following few steps have to be performed atomically! - JCSystem.beginTransaction(); - TN = newTN; - Util.arrayCopy(buffer, START, - theRecord, START, TRANSACTION_RECORD_LENGTH); - transactionLogFile.updateNewLogRecord(); - JCSystem.commitTransaction(); - - //Now we can throw exception - transientBools[TRANSACTION_INITIALIZED] = false; - ISOException.throwIt(SW_WRONG_SIGNATURE); - } else { - //Branch for successful transaction. - offset = Util.setShort(buffer, offset, transientShorts[NEW_BALANCE_IX]); - Util.setShort(buffer, offset, ISO7816.SW_NO_ERROR); - // done with preparing transaction record - - byte[] theRecord = transactionLogFile.getNewLogRecord(); - //The following few steps have to be performed atomically! - JCSystem.beginTransaction(); - TN = transientShorts[TN_IX]; - //Update balance - Util.setShort(balancesRecord, START, newBalance); - Util.arrayCopy(buffer, START, - theRecord, START, TRANSACTION_RECORD_LENGTH); - transactionLogFile.updateNewLogRecord(); - JCSystem.commitTransaction(); - } - - // Do loyalty work - // We have all the information in the buffer, the loyalty applets shouldn't - // know transaction number and the balance of purse - so we zero out these - // fields first - Util.setShort(buffer, START, (short)0); - Util.setShort(buffer, balanceOffset, (short)0); - short loyaltyCADValue = Util.getShort(CAD_ID_array, START); - for (byte loyaltyIndex = 0; loyaltyIndex < MAX_LOYALTY; loyaltyIndex++) { - if (loyaltyCAD[loyaltyIndex] == loyaltyCADValue) { - loyaltySIO[loyaltyIndex].grantPoints (buffer); - break; - } - } - //Put all '0's in signature3 (there could be crypto calculations here) - Util.arrayFillNonAtomic(byteArray8, (short)0, (short) byteArray8.length, (byte)0); - - //send R-APDU - offset = Util.setShort(buffer, START, newBalance); - offset = Util.arrayCopyNonAtomic(byteArray8, START, buffer, offset, SIGNATURE_LENGTH); - apdu.setOutgoingAndSend(START, (short)(offset - START)); - - transientBools[TRANSACTION_INITIALIZED] = false; - } - - - /** - * Handles Initialize Parameter Update APDU. - * - *

NOTE: In this sample implementation we assume that all the - * Parameter Updates are performed in somewhat secured facility and therefor - * the tearing of the card is not an issue. That's why we don't do any - * transactional protection while processing Initialize and Complete - * Parameter Update APDU commands. - * - * @param apdu APDU object - */ - private void processInitializeUpdate(APDU apdu) { - if (transientBools[UPDATE_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - if (!masterPIN.isValidated() && isPersonalized) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - - byte[] buffer = apdu.getBuffer(); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - - // Because this is a case 2 command (outgoing data only), the contents of P3 - // are undefined. In T=0, P3 is Le. In T=1, P3 is Lc. Therefore, we don't - // bother to test the contents of buffer[ISO7816.OFFSET_LC]. - - - PUN++; //Increment parameter Update Number - - // Send R-APDU - short offset = Util.arrayCopyNonAtomic(ID_Purse, START, buffer, START, ID_LENGTH); - offset = Util.arrayCopyNonAtomic(ExpDate, START, buffer, offset, DATE_LENGTH); - offset = Util.setShort(buffer, offset, PUN); - apdu.setOutgoingAndSend(START, (short)(offset - START)); - - transientBools[UPDATE_INITIALIZED] = true; - } - - /** - * Handles Complete Parameter Update APDU. - * @param apdu APDU object - */ - private void processCompleteUpdate(APDU apdu) { - if (!transientBools[UPDATE_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - byte[] buffer = apdu.getBuffer(); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - short count = apdu.setIncomingAndReceive(); // get expected data - byte lc = buffer[ISO7816.OFFSET_LC]; - //Put all '0's in byteArray8 and compare with buffer - //(there could be crypto calculations here) - Util.arrayFillNonAtomic(byteArray8, (short)0, (short) byteArray8.length, (byte)0); - if (0 != Util.arrayCompare(byteArray8, START, buffer, - (short)(ISO7816.OFFSET_CDATA + lc - SIGNATURE_LENGTH), - SIGNATURE_LENGTH)) - ISOException.throwIt(SW_WRONG_SIGNATURE); - - switch (buffer[TLV_OFFSET]) { - case MASTER_PIN_UPDATE: - updatePIN(apdu, masterPIN); setIsPersonalized(); break; - case USER_PIN_UPDATE: - updatePIN(apdu, userPIN); break; - case EXP_DATE_UPDATE: - updateParameterValue(apdu, ExpDate); break; - case PURSE_ID_UPDATE: - updateParameterValue(apdu, ID_Purse); break; - case MAX_BAL_UPDATE: - updateBalanceValue(apdu, OFFSET_BAL_MAX); break; - case MAX_M_UPDATE: - updateBalanceValue(apdu, OFFSET_AMOUNT_MAX); break; - case VERSION_UPDATE: - updateParametersFile(apdu); break; - case LOYALTY1_UPDATE: - updateLoyaltyProgram(apdu, (byte)0); break; - case LOYALTY2_UPDATE: - updateLoyaltyProgram(apdu, (byte)1); break; - case LOYALTY3_UPDATE: - updateLoyaltyProgram(apdu, (byte)2); break; - case LOYALTY4_UPDATE: - updateLoyaltyProgram(apdu, (byte)3); break; - default: - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - - // The crypto processing could be done here - Util.arrayFillNonAtomic(byteArray8, (short)0, (short) byteArray8.length, (byte)0); - Util.arrayCopyNonAtomic(byteArray8, START, buffer, START, SIGNATURE_LENGTH); - apdu.setOutgoingAndSend(START, SIGNATURE_LENGTH); - - transientBools[UPDATE_INITIALIZED] = false; - } - - /** - * Handles Verify Pin APDU. - * @param apdu APDU object - */ - private void processVerifyPIN(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - byte pinLength = buffer[ISO7816.OFFSET_LC]; - byte triesRemaining = (byte)0; - short count = apdu.setIncomingAndReceive(); // get expected data - if (count < pinLength) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - byte pinType = buffer[ISO7816.OFFSET_P2]; - switch (pinType) { - case MASTER_PIN: - if (!masterPIN.check(buffer, ISO7816.OFFSET_CDATA, pinLength)) { - triesRemaining = masterPIN.getTriesRemaining(); - //The last nibble of return code is number of remaining tries - ISOException.throwIt((short)(SW_PIN_FAILED + triesRemaining)); - } - break; - case USER_PIN: - if (!userPIN.check(buffer, ISO7816.OFFSET_CDATA, pinLength)) { - triesRemaining = userPIN.getTriesRemaining(); - //The last nibble of return code is number of remaining tries - ISOException.throwIt((short)(SW_PIN_FAILED + triesRemaining)); - } - break; - default: - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - } - /** - * Verifies numerical limitations on Transaction Amount. - * - *

NOTE: With some values of maxBalance and maxAmount the logic - * in this method might become somewhat unrealistic. It's the result of using - * short arithmetic on values which might be too big to fit in short variables. - * - * @param transactionType type of transaction. - * @param amount transaction amount. - * @return new balance - */ - private short checkTransactionValues(byte transactionType, short amount) { - short newBalance; - short currentBalance = Util.getShort(balancesRecord, OFFSET_BAL_CURRENT); - short maxBalance = Util.getShort(balancesRecord, OFFSET_BAL_MAX); - short maxAmount = Util.getShort(balancesRecord, OFFSET_AMOUNT_MAX); - switch (transactionType) { - case CREDIT : { - newBalance = (short)(currentBalance + amount); - transientShorts[NEW_BALANCE_IX] = newBalance; - if (newBalance > maxBalance || newBalance < 0) //to prevent rollover - ISOException.throwIt(SW_CREDIT_TOO_HIGH); - break; - } - case DEBIT : { - if (amount > maxAmount) ISOException.throwIt(SW_AMOUNT_TOO_HIGH); - newBalance = (short)(currentBalance - amount); - transientShorts[NEW_BALANCE_IX] = newBalance; - if (newBalance < 0)ISOException.throwIt(SW_NOT_ENOUGH_FUNDS); - break; - } - default : - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - transientShorts[CURRENT_BALANCE_IX] = currentBalance; - return currentBalance; - } - - /** - * Updates PIN. - * @param apdu APDU object - * @param PIN OwnerPIN object (masterPIN or userPIN) - */ - - private void updatePIN(APDU apdu, OwnerPIN PIN) { - byte[] buffer = apdu.getBuffer(); - PIN.update(buffer, (short)(TLV_OFFSET + 2), buffer[TLV_OFFSET + 1]); - } - - /** - * Set JavaPurse in personalized state. - * It happens only once - after the first update of masterPIN - */ - - private void setIsPersonalized() { - if (!isPersonalized) isPersonalized = true;//happens only once - } - - /** - * Update value of a Expiration Date or ID_Purse. Also updates corresponding - * records in Parameters File - * @param apdu APDU object - * @param value the byte array to be updated - */ - - private void updateParameterValue(APDU apdu, byte[] value){ - byte[] buffer = apdu.getBuffer(); - Util.arrayCopyNonAtomic(buffer, (short)(TLV_OFFSET + 2), value, - START, buffer[TLV_OFFSET + 1]); - updateParametersFile(apdu); - } - - /** - * Updates values of maximum balance or maximum amount for transaction in the - * balancesRecord. - * @param apdu APDU object - * @param offset the offset in balancesRecord to be updated - */ - - private void updateBalanceValue(APDU apdu, short offset) { - byte[] buffer = apdu.getBuffer(); - Util.arrayCopyNonAtomic(buffer, (short)(TLV_OFFSET + 2), - balancesRecord, offset, SHORT_LENGTH); - } - - /** - * Updates record in Parameters File. - * @param apdu APDU object - */ - - private void updateParametersFile(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - byte recordNumber = parametersFile.findRecord(buffer[TLV_OFFSET]);//match tag - - if (recordNumber == (byte)0) { - /* - * The record is not found. We have to create a new record. - * NOTE: This is an example that a requirement to perform all memory - * allocations (all "new") in class constructor is not an absolute one. - */ - byte[] newRecord = new byte[buffer[TLV_OFFSET + 1] + 2]; - Util.arrayCopyNonAtomic(buffer, TLV_OFFSET, newRecord, START, - (short)(buffer[TLV_OFFSET + 1] + 2)); - parametersFile.addRecord(newRecord); - } else { - byte[] theRecord = parametersFile.getRecord(recordNumber); - Util.arrayCopyNonAtomic(buffer, TLV_OFFSET, theRecord, START, - (short)(buffer[TLV_OFFSET + 1] + 2)); - } - } - - /** - * Selects file by FID according to ISO7816-4. - * This implementation doesn't support all variations of SELECT command - * in the standard, but provides reasonable subset for selection by FID - * (P1==2). - * @param apdu APDU object - */ - - private void processSelectFile(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - - // get the apdu data - apdu.setIncomingAndReceive(); - - if (buffer[ISO7816.OFFSET_P1] == (byte)2) { - // select file by FID - if ( buffer[ISO7816.OFFSET_LC] != (byte)2) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - short fid = Util.getShort(buffer, ISO7816.OFFSET_CDATA); - switch (fid) { - case PARAMETERS_FID: - case TRANSACTION_LOG_FID: - case BALANCES_FID: - transientShorts[SELECTED_FILE_IX] = fid; - break; - default: - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } - } else - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - - /** - * Reads a record by the record number or reads the first occurrence - * of the record by the record identifier. - * This implementation doesn't support all variations of READ RECORD command - * in the ISO 7816-4 standard, but provides reasonable subset of it. It is - * here to demonstrate that even without "built-in" support for ISO 7816 - * File System an Applet can have the behavior prescribed by the standard. - * - * @param apdu APDU object - */ - - private void processReadRecord(APDU apdu) { - - // used to hold the record read - byte record[] = null; - short fid = 0; - - // get the APDU buffer and fields in the APDU header - byte buffer[] = apdu.getBuffer(); - byte P1 = buffer[ISO7816.OFFSET_P1]; - byte P2 = buffer[ISO7816.OFFSET_P2]; - - // process file selection here according to ISO 7816-4, 6.5.3 - // P2 = xxxxxyyy - // if xxxxx = 0, use the current selected file - // xxxxx(not all equal) = other value, select EF by SFI as - // specified in xxxxx - - if ( (P2 >> 3) == 0 ) { - if (transientShorts[SELECTED_FILE_IX] == (short)0) - ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED); - else - fid = transientShorts[SELECTED_FILE_IX]; - } else { - // Short file identifier - byte sfi = (byte) ( ( P2 >> 3 ) & 0x1F ); - fid = Util.makeShort(FID_BYTE, sfi); - switch (fid) { - case PARAMETERS_FID: - case TRANSACTION_LOG_FID: - case BALANCES_FID: - transientShorts[SELECTED_FILE_IX] = fid; - break; - default: - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } - } - - // check for security status (validated PIN) - switch (fid) { - case TRANSACTION_LOG_FID: - case BALANCES_FID: - if (!userPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - break; - case PARAMETERS_FID: - if (!masterPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - } - - // get the last three bits of P2 - P2 = (byte) (P2 & 0x07); - - // select the record by record number - if ( ( P2 & 0x04 ) != 0 ) { - - if ( P2 == 0x04 ) { - // P1 = 00 indicates in ISO 7816-4 the current record: we don't - // support it in this implementation - if (P1 == 0) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - switch (fid) { - case BALANCES_FID: - // There is only one record in balancesRecord - if (P1 == 1) - record = balancesRecord; - else ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - break; - case TRANSACTION_LOG_FID: - record = transactionLogFile.getRecord(P1); - break; - case PARAMETERS_FID: - record = parametersFile.getRecord(P1); - } - if (record == null) - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } else - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } else { - // select record by record identifier (first byte of the record) - - // read the first occurrence - if ( P2 == 0) { - switch (fid) { - case BALANCES_FID: - // There is only one record in balancesRecords - if (balancesRecord[0] == P1) - record = balancesRecord; - else - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - break; - case TRANSACTION_LOG_FID: - P1 = transactionLogFile.findRecord(P1); - if (P1 == 0 ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - else - record = transactionLogFile.getRecord(P1); - break; - case PARAMETERS_FID: - P1 = parametersFile.findRecord(P1); - if (P1 == 0 ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - else - record = parametersFile.getRecord(P1); - } - } else { - // function not supported, when P2 = 1, 2, 3 - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - } - - // set the data transfer direction to outbound - short Le = apdu.setOutgoing(); - - // if Lr < Le, set Le == Lr - // otherwise send exactly Le bytes back - if (record.length < Le) { - Le = (short)record.length; - } - - apdu.setOutgoingLength(Le); - apdu.sendBytesLong(record, (short)0, Le); - - } - - /** - * Updates loyalty program. - * It takes standard TLV record for Parameter Update, interprets first - * two bytes as loyaltyCAD (to be compared with first two bytes of CAD ID - * in a transaction), the rest of record as AID for loyalty applet. - * In case of successful retrieval of Shareable Interface Object with this AID - * it is stored as an element of array, and method grantPoints of this loyalty - * applet will be called in transaction to grant loyalty points. If SIO is not - * returned, or loyaltyCAD in parameter is 0 the corresponding elements in - * loyaltyCAD and loyaltySIO arrays are cleared. The Parameters File is updated. - * - * @param apdu APDU object - * @param loyaltyIndex index to loyaltyCAD and loyaltySIO arrays - * @see com.sun.javacard.JavaLoyalty.JavaLoyalty - */ - - private void updateLoyaltyProgram(APDU apdu, byte loyaltyIndex) { - byte[] buffer = apdu.getBuffer(); - loyaltyCAD[loyaltyIndex] = Util.getShort(buffer,(short) (TLV_OFFSET+2)); - if (loyaltyCAD[loyaltyIndex] != (short)0) { - AID loyaltyAID = JCSystem.lookupAID(buffer, (short) (TLV_OFFSET+4), - (byte)(buffer[TLV_OFFSET+1]-2)); - if (loyaltyAID != null) { - loyaltySIO[loyaltyIndex] = (JavaLoyaltyInterface) - JCSystem.getAppletShareableInterfaceObject(loyaltyAID, (byte)0); - if (loyaltySIO[loyaltyIndex] == null) - loyaltyCAD[loyaltyIndex] = (short)0; - } else - loyaltyCAD[loyaltyIndex] = (short)0; - } - if (loyaltyCAD[loyaltyIndex] == (short)0) { - // clean-up - buffer[TLV_OFFSET+1] = (byte)2; - Util.arrayFillNonAtomic (buffer,(short) (TLV_OFFSET+2), - (short) (buffer.length - TLV_OFFSET - 2), (byte)0); - } - updateParametersFile(apdu); - } - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.opt deleted file mode 100644 index 09c96aad..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1 com.sun.javacard.samples.JavaPurse.JavaPurse -com.sun.javacard.samples.JavaPurse -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/ParametersFile.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/ParametersFile.java deleted file mode 100644 index 9d9dd8f7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/ParametersFile.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)ParametersFile.java 1.7 -// Version:1.7 -// Date:01/03/06 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/ParametersFile.java -// Modified:01/03/06 19:01:06 -// Original author: Zhiqun -// */ - -package com.sun.javacard.samples.JavaPurse; -import javacard.framework.*; - -/** - * This is the class for all linear variable-length record files, and the base class - * for linear variable-fixed and cyclic record files.

- * - */ - -class ParametersFile { - - // Variables - Record records[]; - byte numRecords; - - /** - * Constructor. - * @param maxNumRecords the maximum number of records in this file - */ - public ParametersFile(byte maxNumRecords) { - records = new Record[maxNumRecords]; - numRecords = 0; - } - - /** - * Get the actual number of records in this file. - * @return numRecords - */ - public byte getNumRecords() { - return numRecords; - } - - /** - * Add (append) a new record to the file. Note that - * the record reference is stored in the file object. A copy of the - * record byte array is not made. - * @param record the record byte array - * @exception ISOException if the file is full. - *

    - *
  • ISOException.reason = ISO7816.SW_FILE_FULL - *
- */ - public void addRecord(byte record[]) throws ISOException{ - if ( records.length == numRecords) - ISOException.throwIt(ISO7816.SW_FILE_FULL); - records[numRecords++] = new Record(record); - } - - /** - * Get the record byte array for the specified record number. This is a - * reference to the actual file data, not a copy of the file data. - * Records are in the order that they were added to the file. - * Record number is in the range from 1 to the number of records in the file - * @param recordNum the index (first record = 1) of the record. - * @return record or null if the record is not found - */ - public byte[] getRecord(byte recordNum) { - - // current record only has meaning in the context of file system - // file system will translate 0 to the currentRecord number in - // its methods - // but you can not pass in 0 to getRecord directly - if ( (recordNum <= 0) || ( recordNum > numRecords) ) - return null; - - return records[recordNum-1].record; - } - - /** - * Find the record. - * @param firstByte if non-0, the record's first byte must match this value; if 0, any value of the record's first byte matches. - * @return the record number, or 0 if the record is not found - */ - - public byte findRecord(byte firstByte) { - - // empty file - if (numRecords == 0) - return 0; - - byte eRecNum = numRecords; // existing record number - byte currentRecNumber = 1; - byte thisRec[]; - - while (true) { - - thisRec = getRecord(currentRecNumber); - - if ( firstByte == 0) { - return currentRecNumber; - } - - if ( thisRec[0] == firstByte) { - return currentRecNumber; - } - - if ( currentRecNumber == eRecNum ) - return 0; - currentRecNumber++; - } - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/Record.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/Record.java deleted file mode 100644 index a441183d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurse/Record.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)Record.java 1.8 -// Version:1.8 -// Date:01/03/06 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/Record.java -// Modified:01/03/06 19:01:06 -// Original author: Zhiqun Chen -// */ - -package com.sun.javacard.samples.JavaPurse; - -/** - * A Record. - *

The main reason for this class is that Java Card doesn't support multidimensional - * arrays, but supports array of objects - */ - -class Record -{ - - byte[] record; - - Record(byte[] data) { - this.record = data; - } - - Record(short size) { - record = new byte[size]; - } - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/CyclicFile.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/CyclicFile.java deleted file mode 100644 index 0d600b86..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/CyclicFile.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)CyclicFile.java 1.6 -// Version:1.6 -// Date:03/26/01 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/CyclicFile.java -// Modified:03/26/01 17:08:43 -// Original author: Zhiqun Chen -// */ - -package com.sun.javacard.samples.JavaPurseCrypto; - -import javacard.framework.*; - -/** - * Class CyclicFile implements ISO 7816 CyclicFile. - * This class always allocates one more record than the maximum - * number of allowed records in CyclicFile. Method getNewLogRecord - * returns a new record without affecting contents of CyclicFile. - * Method updateNewLogRecord updates the internal record pointers, - * so the new record becomes the current record(record number one) - * and the oldest record becomes the next new record. - * - * @author Zhiqun Chen (zhiqun.chen@sun.com) - */ - -class CyclicFile -{ - - // number of allocated records in CyclicFile. This - // value is one plus the maximum number of records. - private byte num_record; - - // pointer to the current record (record number). - private byte current_record = -1; - - // pointer to next new record. - private byte next_record; - - // records in CyclicFile - private Record[] records; - - /** - * Constructor - * @param max_record maximum number of record in CyclicFile - * @param record_length record length - */ - CyclicFile(byte max_record, byte record_length) { - - // allocate one more record than the maximum number - // of allowed records in CyclicFile - num_record = ++max_record; - - records = new Record[num_record]; - - for ( byte i = 0; i < num_record; i++) { - records[i] = new Record(record_length); - } - } - - /** - * Get a record with the specified record number - * @param recordNum record number - * @return the specified record - */ - byte[] getRecord(byte recordNum){ - - // check if the record number is in the range of 1..maximum record number - if ( ( recordNum < 1 ) || ( recordNum > (byte)(num_record - 1 ) ) ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - - if ((recordNum = (byte) (current_record - recordNum + 1)) < 0 ) - recordNum += num_record; - - return records[recordNum].record; - } - - /** - * Find the record. - * @param firstByte if non-0, the record's first byte must match this value; if 0, any value of the record's first byte matches. - * @return the record number, or 0 if the record is not found - */ - - byte findRecord(byte firstByte) { - - byte eRecNum = num_record--; //max record - byte currentRecNumber = 1; - byte thisRec[]; - - while (true) { - - thisRec = getRecord(currentRecNumber); - - if ( firstByte == 0) { - return currentRecNumber; - } - - if ( thisRec[0] == firstByte) { - return currentRecNumber; - } - - if ( currentRecNumber == eRecNum ) - return 0; - currentRecNumber++; - } - } - - /** - * Get a new record - * @return the new record - */ - byte[] getNewLogRecord() { - - byte[] record = records[next_record].record; - return record; - - } - - /** - * Update internal record pointers, so the new record - * becomes the current record and the oldest - * record in CyclicFile becomes the next new record - * @see getNewLogRecord - */ - void updateNewLogRecord() { - - // update current record pointer and next record pointer - if (++current_record == num_record) - current_record = 0; - - if (++next_record == num_record) - next_record = 0; - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.java deleted file mode 100644 index e2241ba4..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.java +++ /dev/null @@ -1,957 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)JavaPurseCrypto.java 1.8 06/01/04 - */ - -package com.sun.javacard.samples.JavaPurseCrypto; - -import javacard.framework.*; -import javacard.security.*; -import javacardx.crypto.*; -import com.sun.javacard.samples.SampleLibrary.JavaLoyaltyInterface; - -/** - * This class is intended to demonstrate how an electronic cash application - * might be developed using Java Card - *

See Java Card(TM) Reference Implementation User's Guide - * for details. - * - * @author Vadim Temkin, Modified to include cryptographic signatures by M. Saltz - */ -public class JavaPurseCrypto extends Applet { - /* - * - * Constants - * - */ - final static byte VERIFY = (byte)0x20; //INS value for ISO 7816-4 VERIFY command - final static byte READ = (byte)0xB2; //INS value for ISO 7816-4 READ RECORD command - final static byte INITIALIZE_TRANSACTION = (byte)0x20; //INS byte for Initialize Transaction - final static byte COMPLETE_TRANSACTION = (byte)0x22; //INS byte for Complete Transaction - final static byte INITIALIZE_UPDATE = (byte)0x24; //INS byte for Initialize Parameter Update - final static byte COMPLETE_UPDATE = (byte)0x26; //INS byte for Complete Parameter Update - final static byte CREDIT = (byte)0x01; //P1 byte for Credit in Initialize Transaction - final static byte DEBIT = (byte)0x02; //P1 byte for Debit in Initialize Transaction - final static byte MASTER_PIN = (byte)0x81; //P2 byte for Master PIN in Verify - final static byte USER_PIN = (byte)0x82; //P2 byte for User PIN in Verify - - final static short MAX_MAC_DATA = (short) 0x001E; //maximimum length of data used in MAC - final static short SW_CREDIT_TOO_HIGH = (short)0x9101;//SW bytes for Credit Too High condition - final static short SW_NOT_ENOUGH_FUNDS = (short)0x9102;//SW bytes for Not Enough Funds condition - final static short SW_AMOUNT_TOO_HIGH = (short)0x9103;//SW bytes for Amount Too High condition - final static short SW_COMMAND_OUT_OF_SEQUENCE = (short)0x9104;//SW bytes for Command out of Sequence - final static short SW_WRONG_SIGNATURE = (short)0x9105;//SW bytes for Wrong Signature condition - final static short SW_PIN_FAILED = (short)0x69C0;//SW bytes for PIN Failed condition - final static short SW_SUCCESS = (short)0x9000;//SW bytes for success, used in MAC. - //The last nibble is replaced with the - //number of remaining tries - - final static byte LC_IT = 10; //Lc byte for Initialize Transaction - final static byte LC_CT = 13; //Lc byte for Complete Transaction - final static byte LC_CU_MIN = 18; //Lc byte for Complete Update - final static byte CAD_ID_OFFSET = 7; //Offset for CAD ID in Process Initialize Transaction - final static short DATE_LENGTH = 3; //Length of ExpDate array - final static short DATETIME_LENGTH = 5;//Length of DateTime array - final static short ID_LENGTH = 4; //Length for CAD ID and Purse ID arrays - final static short SHORT_LENGTH= 2; //Length of a short value for offset computations - final static short START = 0; //For offset computations - final static short SIGNATURE_LENGTH - = 8; //Length of signatures - final static short MAX_LOYALTY = 4; //Max number of loyalty applets - - // transientShorts array indices - final static byte TN_IX = 0; - final static byte NEW_BALANCE_IX=(byte)TN_IX+1; - final static byte CURRENT_BALANCE_IX=(byte)NEW_BALANCE_IX+1; - final static byte AMOUNT_IX=(byte)CURRENT_BALANCE_IX+1; - final static byte TRANSACTION_TYPE_IX=(byte)AMOUNT_IX+1; - final static byte SELECTED_FILE_IX=(byte)TRANSACTION_TYPE_IX+1; - final static byte NUM_TRANSIENT_SHORTS=(byte)SELECTED_FILE_IX+1; - - // transientBools array indices - final static byte TRANSACTION_INITIALIZED=0; - final static byte UPDATE_INITIALIZED=(byte)TRANSACTION_INITIALIZED+1; - final static byte NUM_TRANSIENT_BOOLS=(byte)UPDATE_INITIALIZED+1; - - // constants for response to applet SELECT command - private final static byte FCI_TEMPLATE_TAG = (byte)0x6F; - private final static byte FCI_AID_TAG = (byte)0x84; - private static byte[] FCI_PROPERIETARY = { - (byte)0xA5, // tag - (byte)0x01, // length - (byte)0x42 }; // value - - private ParametersFile parametersFile; - private CyclicFile transactionLogFile; - private short TN; - private short PUN; - private boolean isPersonalized; //set to true when Master PIN is updated first time - /* - * File System emulation constants - */ - final static short PARAMETERS_FID = (short) 0x9102; - final static short TRANSACTION_LOG_FID = (short) 0x9103; - final static short BALANCES_FID = (short) 0x9104; - final static byte FID_BYTE = (byte) 0x91; - final static byte TRANSACTION_RECORD_LENGTH = 18; - final static byte TRANSACTION_RECORD_NUMBER = 10; - final static byte BALANCES_RECORD_LENGTH = 6; - final static byte BALANCES_RECORD_NUMBER = 1; - final static byte PARAMETERS_RECORD_NUMBER = 11; - final static byte OFFSET_BAL_CURRENT = 0; - final static byte OFFSET_BAL_MAX = 2; - final static byte OFFSET_AMOUNT_MAX = 4; - final static byte NUMBER_OF_FILES = 3; - - - private OwnerPIN masterPIN; - private OwnerPIN userPIN; - - /* - * Tags for TLV records in Complete Parameter Update C-APDU. - */ - final static byte MASTER_PIN_UPDATE = (byte)0xC1; - final static byte USER_PIN_UPDATE = (byte)0xC2; - final static byte EXP_DATE_UPDATE = (byte)0xC5; - final static byte PURSE_ID_UPDATE = (byte)0xC6; - final static byte MAX_BAL_UPDATE = (byte)0xC7; - final static byte MAX_M_UPDATE = (byte)0xC8; - final static byte VERSION_UPDATE = (byte)0xC9; - final static byte LOYALTY1_UPDATE = (byte)0xCA; - final static byte LOYALTY2_UPDATE = (byte)0xCB; - final static byte LOYALTY3_UPDATE = (byte)0xCC; - final static byte LOYALTY4_UPDATE = (byte)0xCD; - - final static short TLV_OFFSET = 13; //Offset of TLV in Complete Parameter Update - - /* - * The DES key used for DES MAC calculations. The keyData should be gotten via an update - * method call in a real application. - */ - byte[] keyData = {(byte)0x11, (byte)0x33, (byte)0x22, (byte)0x05, (byte)0x44, - (byte)0x77, (byte)0x06, (byte)0x08}; - - /* - * - * Various and sundry byte arrays - * - */ - - private byte[] CAD_ID_array; - private byte[] byteArray8; // Signature work array - private short[] transientShorts; - private boolean[] transientBools; - private byte[] ID_Purse; - private byte[] ExpDate; - private byte[] balancesRecord; - private byte[] MAC_buffer; - - /* - * The two associated arrays to represent Loyalty Applets. - * If value of loyaltyCAD matches first 2 bytes of CAD ID for transaction - * the grantPoints method of corresponding loyalty Shareable Interface Object - * is called. These arrays are populated by Parameter Update APDU commands. - */ - private short[] loyaltyCAD; - private JavaLoyaltyInterface[] loyaltySIO; - - /* - * signature/key objects - */ - private DESKey deskey; - private Signature sig; - - - /** - * Installs Java Purse applet. - * @param bArray install parameter array. - * @param bOffset where install data begins. - * @param bLength install parameter data length. - */ - public static void install( byte[] bArray, short bOffset, byte bLength ) { - new JavaPurseCrypto(bArray, bOffset, bLength); - } - - /** - * Performs memory allocations, initialization, and applet registration. - * - * @param bArray received by install. - * @param bOffset received by install. - * @param bLength received by install. - */ - protected JavaPurseCrypto(byte[] bArray, short bOffset, byte bLength) { - ID_Purse = new byte[ID_LENGTH]; - ExpDate = new byte[DATE_LENGTH]; - ExpDate[0] = (byte)12; ExpDate[1] = (byte)31; ExpDate[2] = (byte)99; - balancesRecord = new byte[BALANCES_RECORD_LENGTH]; - loyaltyCAD = new short[MAX_LOYALTY]; - loyaltySIO = new JavaLoyaltyInterface[MAX_LOYALTY]; - - TN = 0; - PUN = 0; - isPersonalized = false; - - //Create transient objects. - transientShorts = JCSystem.makeTransientShortArray( NUM_TRANSIENT_SHORTS, - JCSystem.CLEAR_ON_DESELECT); - transientBools = JCSystem.makeTransientBooleanArray( NUM_TRANSIENT_BOOLS, - JCSystem.CLEAR_ON_DESELECT); - - CAD_ID_array = JCSystem.makeTransientByteArray( (short)4, - JCSystem.CLEAR_ON_DESELECT); - - // initialize crypto key/signature objects and work array. - byteArray8 = JCSystem.makeTransientByteArray( (short)8, - JCSystem.CLEAR_ON_DESELECT); - deskey = (DESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_DES_TRANSIENT_DESELECT, - KeyBuilder.LENGTH_DES, false); - MAC_buffer = JCSystem.makeTransientByteArray( MAX_MAC_DATA, - JCSystem.CLEAR_ON_DESELECT); - deskey.setKey(keyData, (short)0); - sig = Signature.getInstance(Signature.ALG_DES_MAC8_ISO9797_M2, false); - - masterPIN = new OwnerPIN ((byte)1, (byte)8); - //There is only one try - it's not supposed to be done by human operator - userPIN = new OwnerPIN ((byte)5, (byte)8); - - parametersFile = new ParametersFile(PARAMETERS_RECORD_NUMBER); - - transactionLogFile = new CyclicFile(TRANSACTION_RECORD_NUMBER, - TRANSACTION_RECORD_LENGTH); - Util.setShort(balancesRecord, OFFSET_BAL_CURRENT, (short)0); - - /* - * if AID length is not zero register Java Loyalty - * applet with specified AID - * - * NOTE: all the memory allocations should be performed before register() - */ - - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - register(); - } else { - register(bArray, (short)(bOffset+1), aidLen); - } - } - - - /** - * Performs the session finalization. - */ - public void deselect() { - userPIN.reset(); - masterPIN.reset(); - } - - - /** - * Dispatches APDU commands. - * @param apdu APDU object - */ - public void process(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - - if (!apdu.isISOInterindustryCLA()) { - switch (buffer[ISO7816.OFFSET_INS]) { - case INITIALIZE_TRANSACTION: - processInitializeTransaction(apdu); break; - case COMPLETE_TRANSACTION: - processCompleteTransaction(apdu); break; - case INITIALIZE_UPDATE: - processInitializeUpdate(apdu); break; - case COMPLETE_UPDATE: - processCompleteUpdate(apdu); break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } else { - if (buffer[ISO7816.OFFSET_INS] == VERIFY){ - processVerifyPIN(apdu); - } else if (buffer[ISO7816.OFFSET_INS] == ISO7816.INS_SELECT) { - if (selectingApplet()) - processSelectPurse(apdu); - else - processSelectFile(apdu); - } else if (buffer[ISO7816.OFFSET_INS] == READ) { - processReadRecord(apdu); - } else - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - /** - * Handles Select Purse APDU. - * @param apdu APDU object - */ - private void processSelectPurse(APDU apdu) { - // - // There might be multiple instances of Java Purse on the card with - // different AID values. This method returns the FCI here identifying its - // particular instance. - // - - // Format of response data - // FCI tag, FCI length, - // AID tag, length, value, - // PROPRIETARY tag, value. - // - - // TEMPLATE - byte[] buffer = apdu.getBuffer(); - buffer[0] = FCI_TEMPLATE_TAG; - // buffer[1] set later - - // AID - buffer[2] = FCI_AID_TAG; - buffer[3] = JCSystem.getAID().getBytes(buffer, (short)4); - short offset=(short)(3+buffer[3]); - - // PROPRIETARY DATA - buffer[offset++] = (byte)FCI_PROPERIETARY.length; - offset = Util.arrayCopyNonAtomic(FCI_PROPERIETARY, (short)0, buffer, - offset, (short)FCI_PROPERIETARY.length); - - // FCI template length - buffer[1] = (byte)(offset-(short)2); - - apdu.setOutgoingAndSend((short)0, offset); - } - - /** - * Handles Initialize Transaction APDU. - *

See Java Card 2.1 Reference Implementation User's Guide for details. - * - * @param apdu APDU object - */ - private void processInitializeTransaction(APDU apdu) { - if (transientBools[TRANSACTION_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - if (!userPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - byte[] buffer = apdu.getBuffer(); - if (buffer[ISO7816.OFFSET_LC] != LC_IT) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - if (buffer[ISO7816.OFFSET_P2] != 0) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - apdu.setIncomingAndReceive(); // get expected data - byte transactionType = buffer[ISO7816.OFFSET_P1]; - transientShorts[TRANSACTION_TYPE_IX] = transactionType; - short amount = Util.getShort(buffer, ISO7816.OFFSET_CDATA); - transientShorts[AMOUNT_IX] = amount; - - short balance = checkTransactionValues(transactionType, amount); - - // Increment TN in Transient Memory & compute signature - short newTN = (short)(TN + 1); - transientShorts[TN_IX] = newTN; - Util.arrayCopyNonAtomic(buffer, CAD_ID_OFFSET, CAD_ID_array, START, ID_LENGTH); - - // Send R-APDU - short offset = Util.arrayCopyNonAtomic(ID_Purse, START, buffer, START, ID_LENGTH); - offset = Util.arrayCopyNonAtomic(ExpDate, START, buffer, offset, DATE_LENGTH); - offset = Util.setShort(buffer, offset, balance); - offset = Util.setShort(buffer, offset, newTN); - // The crypto processing could be done here - deskey.setKey(keyData, (short)0); - sig.init(deskey, Signature.MODE_SIGN); - short sigLength = sig.sign(buffer, START, (short)(offset - START), - byteArray8, (short)0); - offset = Util.arrayCopyNonAtomic(byteArray8, START, buffer, offset, SIGNATURE_LENGTH); - - apdu.setOutgoingAndSend(START, (short)(offset - START)); - transientBools[TRANSACTION_INITIALIZED] = true; - } - - /** - * Handles Complete Transaction APDU. - * @param apdu APDU object - */ - private void processCompleteTransaction(APDU apdu) { - if (!transientBools[TRANSACTION_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - byte[] buffer = apdu.getBuffer(); - if (buffer[ISO7816.OFFSET_LC] != LC_CT) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - - apdu.setIncomingAndReceive(); // get expected data - - //restore transaction data from transient - short newTN = transientShorts[TN_IX]; - short amount = transientShorts[AMOUNT_IX]; - short newBalance = transientShorts[NEW_BALANCE_IX]; - //The signature verification - //get CLA, INS, P1, P2, LC - short offset = Util.arrayCopyNonAtomic(buffer, (short)0, MAC_buffer,(byte)0, (short)5); - Util.arrayCopyNonAtomic(buffer, offset, byteArray8,(byte)0, SIGNATURE_LENGTH); - Util.arrayCopyNonAtomic(buffer, (short)(offset + SIGNATURE_LENGTH), MAC_buffer,(byte)5, (short)DATETIME_LENGTH); - deskey.setKey(keyData, (short)0); - sig.init(deskey, Signature.MODE_VERIFY); - boolean signatureOK = sig.verify(MAC_buffer, (short)0, (short)10, - byteArray8, START, SIGNATURE_LENGTH); - - //prepare transaction record in APDU buffer - offset = Util.setShort(buffer, START, newTN); - buffer[offset] = (byte)transientShorts[TRANSACTION_TYPE_IX]; - offset++; - offset = Util.setShort(buffer, offset, amount); - //CAD ID was left in this array from Initialize Transaction - offset = Util.arrayCopyNonAtomic(CAD_ID_array, START, buffer, offset, ID_LENGTH); - - //Date and time are copied in APDU buffer to where they should go - //in the transaction record. - short balanceOffset = offset = - Util.arrayCopyNonAtomic(buffer, (short)(ISO7816.OFFSET_CDATA + 8), - buffer, offset, DATETIME_LENGTH); - //Balance and SW will be added to transactionRecord later - if (!signatureOK) { - //Branch for unsuccessful transaction. Balance is not updated, - //otherwise transactionLog is recorded the same way as in successful transaction - offset = Util.setShort(buffer, offset, transientShorts[CURRENT_BALANCE_IX]); // old balance - Util.setShort(buffer, offset, SW_WRONG_SIGNATURE); - //done with preparing transaction record - - byte[] theRecord = transactionLogFile.getNewLogRecord(); - //The following few steps have to be performed atomically! - JCSystem.beginTransaction(); - TN = newTN; - Util.arrayCopy(buffer, START, - theRecord, START, TRANSACTION_RECORD_LENGTH); - transactionLogFile.updateNewLogRecord(); - JCSystem.commitTransaction(); - - //Now we can throw exception - transientBools[TRANSACTION_INITIALIZED] = false; - ISOException.throwIt(SW_WRONG_SIGNATURE); - } else { - //Branch for successful transaction. - offset = Util.setShort(buffer, offset, transientShorts[NEW_BALANCE_IX]); - Util.setShort(buffer, offset, ISO7816.SW_NO_ERROR); - // done with preparing transaction record - - byte[] theRecord = transactionLogFile.getNewLogRecord(); - //The following few steps have to be performed atomically! - JCSystem.beginTransaction(); - TN = transientShorts[TN_IX]; - //Update balance - Util.setShort(balancesRecord, START, newBalance); - Util.arrayCopy(buffer, START, - theRecord, START, TRANSACTION_RECORD_LENGTH); - transactionLogFile.updateNewLogRecord(); - JCSystem.commitTransaction(); - } - - // Do loyalty work - // We have all the information in the buffer, the loyalty applets shouldn't - // know transaction number and the balance of purse - so we zero out these - // fields first - Util.setShort(buffer, START, (short)0); - Util.setShort(buffer, balanceOffset, (short)0); - short loyaltyCADValue = Util.getShort(CAD_ID_array, START); - for (byte loyaltyIndex = 0; loyaltyIndex < MAX_LOYALTY; loyaltyIndex++) { - if (loyaltyCAD[loyaltyIndex] == loyaltyCADValue) { - loyaltySIO[loyaltyIndex].grantPoints (buffer); - break; - } - } - - offset = Util.setShort(MAC_buffer, START, newBalance); - Util.setShort(MAC_buffer, offset, SW_SUCCESS); - deskey.setKey(keyData, (short)0); - sig.init(deskey, Signature.MODE_SIGN); - short sigLength = sig.sign(MAC_buffer, (short)0, (short)4, - byteArray8, (short)0); - - //send R-APDU - offset = Util.setShort(buffer, START, newBalance); - offset = Util.arrayCopyNonAtomic(byteArray8, START, buffer, offset, SIGNATURE_LENGTH); - apdu.setOutgoingAndSend(START, (short)(offset - START)); - - transientBools[TRANSACTION_INITIALIZED] = false; - } - - - /** - * Handles Initialize Parameter Update APDU. - * - *

NOTE: In this sample implementation we assume that all the - * Parameter Updates are performed in somewhat secured facility and therefore - * the tearing of the card is not an issue. That's why we don't do any - * transactional protection while processing Initialize and Complete - * Parameter Update APDU commands. - * - * @param apdu APDU object - */ - private void processInitializeUpdate(APDU apdu) { - if (transientBools[UPDATE_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - if (!masterPIN.isValidated() && isPersonalized) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - - byte[] buffer = apdu.getBuffer(); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - - // Because this is a case 2 command (outgoing data only), the contents of P3 - // are undefined. In T=0, P3 is Le. In T=1, P3 is Lc. Therefore, we don't - // bother to test the contents of buffer[ISO7816.OFFSET_LC]. - - - PUN++; //Increment parameter Update Number - - // Send R-APDU - short offset = Util.arrayCopyNonAtomic(ID_Purse, START, buffer, START, ID_LENGTH); - offset = Util.arrayCopyNonAtomic(ExpDate, START, buffer, offset, DATE_LENGTH); - offset = Util.setShort(buffer, offset, PUN); - apdu.setOutgoingAndSend(START, (short)(offset - START)); - - transientBools[UPDATE_INITIALIZED] = true; - } - - /** - * Handles Complete Parameter Update APDU. - * @param apdu APDU object - */ - private void processCompleteUpdate(APDU apdu) { - if (!transientBools[UPDATE_INITIALIZED]) - ISOException.throwIt(SW_COMMAND_OUT_OF_SEQUENCE); - byte[] buffer = apdu.getBuffer(); - if ((buffer[ISO7816.OFFSET_P1] != 0) || (buffer[ISO7816.OFFSET_P2] != 0)) - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - short count = apdu.setIncomingAndReceive(); // get expected data - byte lc = buffer[ISO7816.OFFSET_LC]; - //The signature verification - //get CLA, INS, P1, P2, LC - //message to sign length - short messageLength = (short)(lc - SIGNATURE_LENGTH + 5); - short offset = Util.arrayCopyNonAtomic(buffer, (short)0, MAC_buffer,(byte)0, (short)messageLength); - offset = Util.arrayCopyNonAtomic(buffer, offset, byteArray8,(byte)0, SIGNATURE_LENGTH); - // verify signature if in coming apdu - deskey.setKey(keyData, (short)0); - sig.init(deskey, Signature.MODE_VERIFY); - boolean signatureOK = sig.verify(MAC_buffer, (short)0, messageLength, - byteArray8, START, SIGNATURE_LENGTH); - - if (!signatureOK) - ISOException.throwIt(SW_WRONG_SIGNATURE); - - switch (buffer[TLV_OFFSET]) { - case MASTER_PIN_UPDATE: - updatePIN(apdu, masterPIN); - setIsPersonalized(); - break; - case USER_PIN_UPDATE: - updatePIN(apdu, userPIN); - break; - case EXP_DATE_UPDATE: - updateParameterValue(apdu, ExpDate); - break; - case PURSE_ID_UPDATE: - updateParameterValue(apdu, ID_Purse); - break; - case MAX_BAL_UPDATE: - updateBalanceValue(apdu, OFFSET_BAL_MAX); - break; - case MAX_M_UPDATE: - updateBalanceValue(apdu, OFFSET_AMOUNT_MAX); - break; - case VERSION_UPDATE: - updateParametersFile(apdu); - break; - case LOYALTY1_UPDATE: - updateLoyaltyProgram(apdu, (byte)0); - break; - case LOYALTY2_UPDATE: - updateLoyaltyProgram(apdu, (byte)1); - break; - case LOYALTY3_UPDATE: - updateLoyaltyProgram(apdu, (byte)2); - break; - case LOYALTY4_UPDATE: - updateLoyaltyProgram(apdu, (byte)3); - break; - default: - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - - //sign the return message - //Admittedly, this is a poor MAC, but this message only returns the status - //(what is MACed here) and the MAC itself. A real application should return a - //little more information. - offset = Util.setShort(MAC_buffer, START, SW_SUCCESS); - deskey.setKey(keyData, (short)0); - sig.init(deskey, Signature.MODE_SIGN); - short sigLength = sig.sign(MAC_buffer, (short)0, (short)2, - byteArray8, (short)0); - - //send R-APDU - //offset = Util.arrayCopyNonAtomic(byteArray8, START, buffer, offset, SIGNATURE_LENGTH); - Util.arrayCopyNonAtomic(byteArray8, START, buffer, START, SIGNATURE_LENGTH); - apdu.setOutgoingAndSend(START, SIGNATURE_LENGTH); - - transientBools[UPDATE_INITIALIZED] = false; - - } - - /** - * Handles Verify Pin APDU. - * @param apdu APDU object - */ - private void processVerifyPIN(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - byte pinLength = buffer[ISO7816.OFFSET_LC]; - byte triesRemaining = (byte)0; - short count = apdu.setIncomingAndReceive(); // get expected data - if (count < pinLength) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - byte pinType = buffer[ISO7816.OFFSET_P2]; - - switch (pinType) { - case MASTER_PIN: - if (!masterPIN.check(buffer, ISO7816.OFFSET_CDATA, pinLength)) { - triesRemaining = masterPIN.getTriesRemaining(); - //The last nibble of return code is number of remaining tries - ISOException.throwIt((short)(SW_PIN_FAILED + triesRemaining)); - } - break; - case USER_PIN: - if (!userPIN.check(buffer, ISO7816.OFFSET_CDATA, pinLength)) { - triesRemaining = userPIN.getTriesRemaining(); - //The last nibble of return code is number of remaining tries - ISOException.throwIt((short)(SW_PIN_FAILED + triesRemaining)); - } - break; - default: - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - } - - /** - * Verifies numerical limitations on Transaction Amount. - * - *

NOTE: With some values of maxBalance and maxAmount the logic - * in this method might become somewhat unrealistic. It's the result of using - * short arithmetic on values which might be too big to fit in short variables. - * - * @param transactionType type of transaction. - * @param amount transaction amount. - * @return new balance - */ - private short checkTransactionValues(byte transactionType, short amount) { - short newBalance; - short currentBalance = Util.getShort(balancesRecord, OFFSET_BAL_CURRENT); - short maxBalance = Util.getShort(balancesRecord, OFFSET_BAL_MAX); - short maxAmount = Util.getShort(balancesRecord, OFFSET_AMOUNT_MAX); - switch (transactionType) { - case CREDIT : { - newBalance = (short)(currentBalance + amount); - transientShorts[NEW_BALANCE_IX] = newBalance; - if (newBalance > maxBalance || newBalance < 0) //to prevent rollover - ISOException.throwIt(SW_CREDIT_TOO_HIGH); - break; - } - case DEBIT : { - if (amount > maxAmount) ISOException.throwIt(SW_AMOUNT_TOO_HIGH); - newBalance = (short)(currentBalance - amount); - transientShorts[NEW_BALANCE_IX] = newBalance; - if (newBalance < 0)ISOException.throwIt(SW_NOT_ENOUGH_FUNDS); - break; - } - default : - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - transientShorts[CURRENT_BALANCE_IX] = currentBalance; - return currentBalance; - } - - /** - * Updates PIN. - * @param apdu APDU object - * @param PIN OwnerPIN object (masterPIN or userPIN) - */ - - private void updatePIN(APDU apdu, OwnerPIN PIN) { - byte[] buffer = apdu.getBuffer(); - PIN.update(buffer, (short)(TLV_OFFSET + 2), buffer[TLV_OFFSET + 1]); - } - - /** - * Set JavaPurse in personalized state. - * It happens only once - after the first update of masterPIN - */ - - private void setIsPersonalized() { - if (!isPersonalized) isPersonalized = true;//happens only once - } - - /** - * Update value of a Expiration Date or ID_Purse. Also updates corresponding - * records in Parameters File - * @param apdu APDU object - * @param value the byte array to be updated - */ - - private void updateParameterValue(APDU apdu, byte[] value) { - byte[] buffer = apdu.getBuffer(); - Util.arrayCopyNonAtomic(buffer, (short)(TLV_OFFSET + 2), value, - START, buffer[TLV_OFFSET + 1]); - updateParametersFile(apdu); - } - - /** - * Updates values of maximum balance or maximum amount for transaction in the - * balancesRecord. - * @param apdu APDU object - * @param offset the offset in balancesRecord to be updated - */ - - private void updateBalanceValue(APDU apdu, short offset) { - byte[] buffer = apdu.getBuffer(); - Util.arrayCopyNonAtomic(buffer, (short)(TLV_OFFSET + 2), - balancesRecord, offset, SHORT_LENGTH); - } - - /** - * Updates record in Parameters File. - * @param apdu APDU object - */ - - private void updateParametersFile(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - byte recordNumber = parametersFile.findRecord(buffer[TLV_OFFSET]);//match tag - - if (recordNumber == (byte)0) { - /* - * The record is not found. We have to create a new record. - * NOTE: This is an example that a requirement to perform all memory - * allocations (all "new") in class constructor is not an absolute one. - */ - byte[] newRecord = new byte[buffer[TLV_OFFSET + 1] + 2]; - Util.arrayCopyNonAtomic(buffer, TLV_OFFSET, newRecord, START, - (short)(buffer[TLV_OFFSET + 1] + 2)); - parametersFile.addRecord(newRecord); - } else { - byte[] theRecord = parametersFile.getRecord(recordNumber); - Util.arrayCopyNonAtomic(buffer, TLV_OFFSET, theRecord, START, - (short)(buffer[TLV_OFFSET + 1] + 2)); - } - } - - /** - * Selects file by FID according to ISO7816-4. - * This implementation doesn't support all variations of SELECT command - * in the standard, but provides reasonable subset for selection by FID - * (P1==2). - * @param apdu APDU object - */ - - private void processSelectFile(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - - // get the apdu data - apdu.setIncomingAndReceive(); - - if (buffer[ISO7816.OFFSET_P1] == (byte)2) { - - // select file by FID - if ( buffer[ISO7816.OFFSET_LC] != (byte)2) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - short fid = Util.getShort(buffer, ISO7816.OFFSET_CDATA); - switch (fid) { - case PARAMETERS_FID: - case TRANSACTION_LOG_FID: - case BALANCES_FID: - transientShorts[SELECTED_FILE_IX] = fid; - break; - default: - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } - } else - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - - /** - * Reads a record by the record number or reads the first occurrence - * of the record by the record identifier. - * This implementation doesn't support all variations of READ RECORD command - * in the ISO 7816-4 standard, but provides reasonable subset of it. It is - * here to demonstrate that even without "built-in" support for ISO 7816 - * File System an Applet can have the behavior prescribed by the standard. - * - * @param apdu APDU object - */ - - private void processReadRecord(APDU apdu) { - - // used to hold the record read - byte record[] = null; - short fid = 0; - - // get the APDU buffer and fields in the APDU header - byte buffer[] = apdu.getBuffer(); - byte P1 = buffer[ISO7816.OFFSET_P1]; - byte P2 = buffer[ISO7816.OFFSET_P2]; - - // process file selection here according to ISO 7816-4, 6.5.3 - // P2 = xxxxxyyy - // if xxxxx = 0, use the current selected file - // xxxxx(not all equal) = other value, select EF by SFI as - // specified in xxxxx - - if ( (P2 >> 3) == 0 ) { - if (transientShorts[SELECTED_FILE_IX] == (short)0) - ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED); - else - fid = transientShorts[SELECTED_FILE_IX]; - } else { - // Short file identifier - byte sfi = (byte) ( ( P2 >> 3 ) & 0x1F ); - fid = Util.makeShort(FID_BYTE, sfi); - switch (fid) { - case PARAMETERS_FID: - case TRANSACTION_LOG_FID: - case BALANCES_FID: - transientShorts[SELECTED_FILE_IX] = fid; - break; - default: - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } - } - - // check for security status (validated PIN) - switch (fid) { - case TRANSACTION_LOG_FID: - case BALANCES_FID: - if (!userPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - break; - case PARAMETERS_FID: - if (!masterPIN.isValidated()) - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - } - - // get the last three bits of P2 - P2 = (byte) (P2 & 0x07); - - // select the record by record number - if ( ( P2 & 0x04 ) != 0 ){ - - if ( P2 == 0x04 ) { - // P1 = 00 indicates in ISO 7816-4 the current record: we don't - // support it in this implementation - if (P1 == 0) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - switch (fid) { - case BALANCES_FID: - // There is only one record in balancesRecord - if (P1 == 1) - record = balancesRecord; - else - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - break; - case TRANSACTION_LOG_FID: - record = transactionLogFile.getRecord(P1); - break; - case PARAMETERS_FID: - record = parametersFile.getRecord(P1); - } - - if (record == null) - ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND); - } else - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } else { - // select record by record identifier (first byte of the record) - - // read the first occurrence - if ( P2 == 0) { - switch (fid) { - case BALANCES_FID: - // There is only one record in balancesRecords - if (balancesRecord[0] == P1) - record = balancesRecord; - else - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - break; - case TRANSACTION_LOG_FID: - P1 = transactionLogFile.findRecord(P1); - if (P1 == 0 ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - else - record = transactionLogFile.getRecord(P1); - break; - case PARAMETERS_FID: - P1 = parametersFile.findRecord(P1); - if (P1 == 0 ) - ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND); - else - record = parametersFile.getRecord(P1); - } - } else { - // function not supported, when P2 = 1, 2, 3 - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - } - - // set the data transfer direction to outbound - short Le = apdu.setOutgoing(); - - // if Lr < Le, set Le == Lr - // otherwise send exactly Le bytes back - if (record.length < Le) { - Le = (short)record.length; - } - - apdu.setOutgoingLength(Le); - apdu.sendBytesLong(record, (short)0, Le); - } - - /** - * Updates loyalty program. - * It takes standard TLV record for Parameter Update, interprets first - * two bytes as loyaltyCAD (to be compared with first two bytes of CAD ID - * in a transaction), the rest of record as AID for loyalty applet. - * In case of successful retrieval of Shareable Interface Object with this AID - * it is stored as an element of array, and method grantPoints of this loyalty - * applet will be called in transaction to grant loyalty points. If SIO is not - * returned, or loyaltyCAD in parameter is 0 the corresponding elements in - * loyaltyCAD and loyaltySIO arrays are cleared. The Parameters File is updated. - * - * @param apdu APDU object - * @param loyaltyIndex index to loyaltyCAD and loyaltySIO arrays - * @see com.sun.javacard.JavaLoyalty.JavaLoyalty - */ - - private void updateLoyaltyProgram(APDU apdu, byte loyaltyIndex) { - byte[] buffer = apdu.getBuffer(); - loyaltyCAD[loyaltyIndex] = Util.getShort(buffer,(short) (TLV_OFFSET+2)); - if (loyaltyCAD[loyaltyIndex] != (short)0) { - - AID loyaltyAID = JCSystem.lookupAID(buffer, (short) (TLV_OFFSET+4), - (byte)(buffer[TLV_OFFSET+1]-2)); - if (loyaltyAID != null) { - loyaltySIO[loyaltyIndex] = (JavaLoyaltyInterface) - JCSystem.getAppletShareableInterfaceObject(loyaltyAID, (byte)0); - if (loyaltySIO[loyaltyIndex] == null) - loyaltyCAD[loyaltyIndex] = (short)0; - } else - loyaltyCAD[loyaltyIndex] = (short)0; - } - if (loyaltyCAD[loyaltyIndex] == (short)0) { - // clean-up - buffer[TLV_OFFSET+1] = (byte)2; - Util.arrayFillNonAtomic (buffer,(short) (TLV_OFFSET+2), - (short) (buffer.length - TLV_OFFSET - 2), (byte)0); - } - updateParametersFile(apdu); - } - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.opt deleted file mode 100644 index 4e5f6d96..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/JavaPurseCrypto.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xb:0x1 com.sun.javacard.samples.JavaPurseCrypto.JavaPurseCrypto -com.sun.javacard.samples.JavaPurseCrypto -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xb 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/ParametersFile.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/ParametersFile.java deleted file mode 100644 index 9612e6c5..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/ParametersFile.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)ParametersFile.java 1.4 -// Version:1.4 -// Date:03/26/01 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/ParametersFile.java -// Modified:03/26/01 17:08:44 -// Original author: Zhiqun -// */ - -package com.sun.javacard.samples.JavaPurseCrypto; -import javacard.framework.*; - -/** - * This is the class for all linear variable-length record files, and the base class - * for linear variable-fixed and cyclic record files.

- * - */ - -class ParametersFile { - - // Variables - Record records[]; - byte numRecords; - - /** - * Constructor. - * @param maxNumRecords the maximum number of records in this file - */ - public ParametersFile(byte maxNumRecords) { - records = new Record[maxNumRecords]; - numRecords = 0; - } - - /** - * Get the actual number of records in this file. - * @return numRecords - */ - public byte getNumRecords() { - return numRecords; - } - - /** - * Add (append) a new record to the file. Note that - * the record reference is stored in the file object. A copy of the - * record byte array is not made. - * @param record the record byte array - * @exception ISOException if the file is full. - *

    - *
  • ISOException.reason = ISO7816.SW_FILE_FULL - *
- */ - public void addRecord(byte record[]) throws ISOException{ - if ( records.length == numRecords) - ISOException.throwIt(ISO7816.SW_FILE_FULL); - records[numRecords++] = new Record(record); - } - - /** - * Get the record byte array for the specified record number. This is a - * reference to the actual file data, not a copy of the file data. - * Records are in the order that they were added to the file. - * Record number is in the range from 1 to the number of records in the file - * @param recordNum the index (first record = 1) of the record. - * @return record or null if the record is not found - */ - public byte[] getRecord(byte recordNum) { - - // current record only has meaning in the context of file system - // file system will translate 0 to the currentRecord number in - // its methods - // but you can not pass in 0 to getRecord directly - if ( (recordNum <= 0) || ( recordNum > numRecords) ) - return null; - - return records[recordNum-1].record; - } - - /** - * Find the record. - * @param firstByte if non-0, the record's first byte must match this value; if 0, any value of the record's first byte matches. - * @return the record number, or 0 if the record is not found - */ - - public byte findRecord(byte firstByte) { - - // empty file - if (numRecords == 0) - return 0; - - byte eRecNum = numRecords; // existing record number - byte currentRecNumber = 1; - byte thisRec[]; - - while (true) { - - thisRec = getRecord(currentRecNumber); - - if ( firstByte == 0) { - return currentRecNumber; - } - - if ( thisRec[0] == firstByte) { - return currentRecNumber; - } - - if ( currentRecNumber == eRecNum ) - return 0; - currentRecNumber++; - } - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/Record.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/Record.java deleted file mode 100644 index 60db2e5f..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/JavaPurseCrypto/Record.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)Record.java 1.5 -// Version:1.5 -// Date:03/26/01 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/JavaPurse/Record.java -// Modified:03/26/01 17:08:44 -// Original author: Zhiqun Chen -// */ - -package com.sun.javacard.samples.JavaPurseCrypto; - -/** - * A Record. - *

The main reason for this class is that Java Card doesn't support multidimensional - * arrays, but supports array of objects - */ - -class Record -{ - - byte[] record; - - Record(byte[] data) { - this.record = data; - } - - Record(short size) { - record = new byte[size]; - } - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.java deleted file mode 100644 index 523b71a7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -// /* -// Workfile:@(#)NullApp.java 1.7 -// Version:1.7 -// Date:01/03/06 -// -// Archive: /Products/Europa/samples/com/sun/javacard/samples/NullApp/NullApp.java -// Modified:01/03/06 19:01:06 -// Original author: Mitch Butler -// */ - -package com.sun.javacard.samples.NullApp; - -import javacard.framework.*; - -/** - */ - -public class NullApp extends Applet -{ - /** - * Only this class's install method should create the applet object. - * @see APDU - * @param apdu the incoming APDU containing the INSTALL command. - */ - protected NullApp(APDU apdu) - { - register(); - } - - /** - * Installs this applet. - * @see APDU - * @param apdu the incoming APDU containing the INSTALL command. - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public static void install( byte[] bArray, short bOffset, byte bLength ) - { - new NullApp(null); - } - - /** - * Returns <0x6D,INS> response status always. - * @see APDU - * @param apdu the incoming APDU containing the INSTALL command. - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public void process(APDU apdu) throws ISOException - { - byte buffer[] = apdu.getBuffer(); - ISOException.throwIt(Util.makeShort((byte)(ISO7816.SW_INS_NOT_SUPPORTED>>8), buffer[1])); - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.opt deleted file mode 100644 index 7b65ddc9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/NullApp/NullApp.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3:0x1 com.sun.javacard.samples.NullApp.NullApp -com.sun.javacard.samples.NullApp -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/Purse.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/Purse.java deleted file mode 100644 index 206cd02b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/Purse.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.RMIDemo; - -import java.rmi.*; -import javacard.framework.*; - -/** - * - * @author vo113324 - */ -public interface Purse extends Remote{ - - public static final short UNDERFLOW = (short)0x6000; - public static final short OVERFLOW = (short)0x6001; - - public static final short BAD_ARGUMENT = (short)0x6002; - - public static final short MAX_AMOUNT = (short)400; // for whatever reason - - public short getBalance() throws RemoteException; - public void debit(short m) throws RemoteException, UserException; - public void credit(short m) throws RemoteException, UserException; - - public void setAccountNumber(byte[] number) throws RemoteException, UserException; - public byte[] getAccountNumber() throws RemoteException; -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseApplet.java deleted file mode 100644 index da49948c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseApplet.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.RMIDemo; - -import java.rmi.*; - -import javacard.framework.APDU; -import javacard.framework.ISOException; -import javacard.framework.UserException; -import javacard.framework.Util; -import javacard.framework.service.*; - -/** - * - * @author vo113324 - */ -public class PurseApplet extends javacard.framework.Applet { - - - private Dispatcher disp; - private RemoteService serv; - private Remote purse; - - public PurseApplet() { - purse = new PurseImpl(); - - disp = new Dispatcher( (short) 1); - serv = new RMIService(purse); - disp.addService(serv, Dispatcher.PROCESS_COMMAND); - - register(); - } - - - public static void install(byte[] aid, short s, byte b) { - new PurseApplet(); - } - - public void process(APDU apdu) throws ISOException { - - disp.process(apdu); - - } - -} - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseImpl.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseImpl.java deleted file mode 100644 index 2cbe126a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/PurseImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.RMIDemo; - -import javacard.framework.UserException; -import javacard.framework.Util; -import javacard.framework.service.CardRemoteObject; -import java.rmi.RemoteException; -/** - * - */ -public class PurseImpl extends CardRemoteObject implements Purse { - - private short balance = 0; - private byte[] number; - - - public PurseImpl() { - super(); // export it - number = new byte[5]; - } - - public void setAccountNumber(byte[] number) throws RemoteException, UserException { - if(number.length != 5) UserException.throwIt(BAD_ARGUMENT); - Util.arrayCopy(number, (short)0, this.number, (short)0, (short)5); - } - - public void credit(short m) throws RemoteException, UserException { - - if(m<=0) UserException.throwIt(BAD_ARGUMENT); - - if((short)(balance+m) > MAX_AMOUNT) UserException.throwIt(OVERFLOW); - - balance +=m; - - } - - public void debit(short m) throws RemoteException, UserException { - - if(m<=0) UserException.throwIt(BAD_ARGUMENT); - - if((short)(balance-m) < 0) UserException.throwIt(UNDERFLOW); - - balance -=m; - } - - public byte[] getAccountNumber() throws RemoteException { - return number; - } - - public short getBalance() throws RemoteException { - return balance; - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/RMIDemo.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/RMIDemo.opt deleted file mode 100644 index 5b72bc6a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/RMIDemo/RMIDemo.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x8:0x1 com.sun.javacard.samples.RMIDemo.PurseApplet -com.sun.javacard.samples.RMIDemo -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x8 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.java deleted file mode 100644 index 7330a4c6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)JavaLoyaltyInterface.java 1.9 06/01/03 - */ - -package com.sun.javacard.samples.SampleLibrary; - -import javacard.framework.*; - -/** - * Shareable Loyalty Interface - * - * @author Vadim Temkin - */ -public interface JavaLoyaltyInterface extends Shareable { - /** - * Used to ask JavaLoyalty Card applet to grant points.

- * Only primitive values, global arrays and Shareable Interface Objects should - * be passed as parameters and results across a context switch. The byte array - * buffer is APDU buffer in classes implementing this interface. - * See Java Card Runtime Environment (JCRE) Specification for details. - *

The format of data in the buffer is subset of Transaction Log record format: - * 2 bytes of 0, 1 byte of transaction type, 2 bytes amount of transaction, - * 4 bytes of CAD ID, 3 bytes of date, and 2 bytes of time. - * @param buffer Apdu buffer containing transaction data. - */ - void grantPoints (byte[] buffer); -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/SampleLibrary.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/SampleLibrary.opt deleted file mode 100644 index 871e8a6b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SampleLibrary/SampleLibrary.opt +++ /dev/null @@ -1,4 +0,0 @@ --out EXP JCA CAP --exportpath . -com.sun.javacard.samples.SampleLibrary -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x4 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/MySecurityService.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/MySecurityService.java deleted file mode 100644 index 2cabf643..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/MySecurityService.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)MySecurityService.java 1.9 06/01/03 - */ - -package com.sun.javacard.samples.SecureRMIDemo; - -import javacard.framework.*; -import javacard.framework.service.*; - - -public class MySecurityService extends BasicService implements SecurityService { - - private static final byte[] PRINCIPAL_APP_PROVIDER_ID = {0x12, 0x34}; - private static final byte[] PRINCIPAL_CARDHOLDER_ID = {0x43, 0x21}; - - static final byte APDU_SM_MASK_TYPE4 = (byte)0x0C; - - private OwnerPIN provider_pin, cardholder_pin = null; - - public MySecurityService() { - provider_pin = new OwnerPIN((byte)2,(byte)2); - cardholder_pin = new OwnerPIN((byte)2,(byte)2); - provider_pin.update(PRINCIPAL_APP_PROVIDER_ID, (short)0, (byte)2); - cardholder_pin.update(PRINCIPAL_CARDHOLDER_ID, (short)0, (byte)2); - } - - /** Pre-processes the input data for the command in the APDU object. - * When invoked, the APDU object - * should either be in STATE_INITIAL with the APDU buffer in the Init format - * or in STATE_FULL_INCOMING with the APDU buffer in the Input Ready format - * defined in BasicService. - *

The method must return true if no more - * pre-processing should be performed, and false otherwise. - * In particular, it must return false if it has not performed any - * processing on the command. - *

- * After normal completion, the APDU object is usually in STATE_FULL_INCOMING - * with the APDU buffer in the Input Ready format defined in BasicService. - * However, in some cases if the Service processes the command entirely, - * the APDU object may be in STATE_OUTGOING - * with the APDU buffer in the Output Ready format defined in BasicService. - * @param apdu the APDU object containing the command being processed. - * @return true if input processing is finished, false otherwise. - */ - public boolean processDataIn(APDU apdu) { - - - if(selectingApplet()) { - commandProperties = 0; - authenticated = 0; - return false; // in case some other service is interested - } - else { - return preprocessCommandAPDU(apdu); - } - } - - /** - * Checks whether a secure channel is in use between the card and the host for - * the ongoing command that guarantees the indicated properties. The result is only - * correct after pre-processing the command (for instance during the processing of - * the command). For properties on incoming data, the result is guaranteed to be - * correct; for outgoing data, the result reflects the expectations of the client - * software, with no other guarantee. - * @param properties the required properties. - * @return true if the required properties are true, false othewise - * @throws ServiceException with the following reason code:

    - *
  • ServiceException.ILLEGAL_PARAM if the specified - * property is unknown. - *
- */ - public boolean isCommandSecure(byte properties) throws ServiceException { - return (commandProperties & properties) != 0; - } - - private byte commandProperties; - - - /** - * Checks whether or not the specified principal is currently authenticated. - * The validity timeframe(selection or reset) and authentication method as well - * as the exact interpretation of the specified principal parameter needs to be - * detailed by the implementation class. - * The only generic guarantee is that the authentication has been performed in the - * current card session. - * @param principal an identifier of the principal that needs to be authenticated - * @return true if the expected principal is authenticated - * @throws ServiceException with the following reason code:
    - *
  • ServiceException.ILLEGAL_PARAM if the specified - * principal is unknown. - *
- */ - public boolean isAuthenticated(short principal) throws ServiceException { - - return (authenticated == principal); - } - - private byte authenticated; - - private boolean preprocessCommandAPDU(APDU apdu) { - - receiveInData(apdu); - - if(checkAndRemoveChecksum(apdu)) { - commandProperties |= SecurityService.PROPERTY_INPUT_INTEGRITY; - } - else { - commandProperties &= ~SecurityService.PROPERTY_INPUT_INTEGRITY; - } - - return false; - } - - private boolean checkAndRemoveChecksum(APDU apdu) { - byte[] buffer = apdu.getBuffer(); - - if(!apdu.isSecureMessagingCLA()) { - return false; - } - - // reset secure flag - apdu.getBuffer()[0] &= ~APDU_SM_MASK_TYPE4; - - short Lc = buffer[4]; - - if(Lc<2) return false; // must have at least the checksum - - short csum1 = 0; - buffer[4] -= 2; // decrease Lc - Lc = buffer[4]; - - for(short n = 5; n<(short)(Lc+5); ++n) { - csum1 += buffer[n]; - } - - final short csum2 = Util.getShort(buffer, (short)(Lc+5)); - - - return (csum1 == csum2); - } - - - public boolean processCommand(APDU apdu) { - if(isAuthenticate(apdu)) { - receiveInData(apdu); - if(apdu.getBuffer()[4] == 2) { - authenticated = 0; - - // short id = Util.getShort(apdu.getBuffer(), (short)5); - - if(provider_pin.check(apdu.getBuffer(), (short)5, (byte)2)) { - authenticated = PRINCIPAL_APP_PROVIDER; - setOutputLength(apdu,(short)0); - succeed(apdu); - } - else if(cardholder_pin.check(apdu.getBuffer(), (short)5, (byte)2)) { - authenticated = PRINCIPAL_CARDHOLDER; - setOutputLength(apdu,(short)0); - succeed(apdu); - } - else { - fail(apdu, (short)0x6666); - } - } - else { - fail(apdu, (short) 0x6565); - } - return true; - } - else { - return false; - } - } - - public boolean processDataOut(APDU apdu) { - - if(selectingApplet()) return false; - - // if not select... - // compute and append checksum - byte[] buffer = apdu.getBuffer(); - short Le = (short)(buffer[4] & 0x00FF); - - short csum = 0; - - for(short n = 5; n<(short)(Le+5); ++n) { - csum += buffer[n]; - } - - javacard.framework.Util.setShort(buffer, (short)(Le+5), csum); - buffer[4] += 2; - return false; - - - } - - public boolean isChannelSecure(byte prop) { - return false; - } - - private static final byte INS_SELECT = (byte)0xA4; - private static final byte APDU_CMD_MASK = (byte)0xFC; - - private static final byte CLA_AUTH = (byte)0x80; - private static final byte INS_AUTH = (byte)0x39; - - private boolean isAuthenticate(APDU command) { - return - (getCLA(command) == CLA_AUTH - && - getINS(command) == INS_AUTH); - - } - - - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/Purse.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/Purse.java deleted file mode 100644 index d7527cf2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/Purse.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.SecureRMIDemo; - -import java.rmi.*; -import javacard.framework.*; - -public interface Purse extends Remote{ - - public static final short UNDERFLOW = (short)0x6000; - public static final short OVERFLOW = (short)0x6001; - - public static final short BAD_ARGUMENT = (short)0x6002; - - public static final short REQUEST_DENIED = (short)0x6003; - - public static final short CORRUPTED_DATA = (short)0x6004; - - public static final short MAX_AMOUNT = (short)400; // for whatever reason - - // note: every method may throw RemoteException(RMI requirement) - // and UserException (if the request is denied) - - public short getBalance() throws RemoteException, UserException; - public void debit(short m) throws RemoteException, UserException; - public void credit(short m) throws RemoteException, UserException; - - public void setAccountNumber(byte[] number) throws RemoteException, UserException; - public byte[] getAccountNumber() throws RemoteException, UserException; -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseApplet.java deleted file mode 100644 index 11970c41..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseApplet.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.SecureRMIDemo; - -import java.rmi.RemoteException; - -import javacard.framework.APDU; -import javacard.framework.ISOException; -import javacard.framework.UserException; -import javacard.framework.Util; -import javacard.framework.service.*; - -public class SecurePurseApplet extends javacard.framework.Applet { - - - private Dispatcher disp; - - public SecurePurseApplet() { - - - SecurityService sec = new MySecurityService(); - - Purse purse = new SecurePurseImpl(sec); - - RemoteService rmi = new RMIService(purse); - - disp = new Dispatcher( (short) 4); - disp.addService(sec, Dispatcher.PROCESS_INPUT_DATA); - disp.addService(sec, Dispatcher.PROCESS_COMMAND); - disp.addService(rmi, Dispatcher.PROCESS_COMMAND); - disp.addService(sec, Dispatcher.PROCESS_OUTPUT_DATA); - - register(); - } - - - public static void install(byte[] aid, short s, byte b) { - new SecurePurseApplet(); - } - - public void process(APDU apdu) throws ISOException { - - disp.process(apdu); - - } - -} - - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseImpl.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseImpl.java deleted file mode 100644 index 502a9f3b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecurePurseImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.SecureRMIDemo; - -import javacard.framework.UserException; -import javacard.framework.Util; -import javacard.framework.service.CardRemoteObject; -import javacard.framework.service.SecurityService; -import java.rmi.RemoteException; -/** - * - */ -public class SecurePurseImpl extends CardRemoteObject implements Purse { - - private short balance = 0; - private byte[] number; - - private SecurityService security; - - - public SecurePurseImpl(SecurityService security) { - super(); // export it - this.security = security; - number = new byte[5]; - } - - public void debit(short m) throws RemoteException, UserException { - - if( !security.isCommandSecure(SecurityService.PROPERTY_INPUT_INTEGRITY)){ - UserException.throwIt(CORRUPTED_DATA); - } - - if(!security.isAuthenticated(SecurityService.PRINCIPAL_CARDHOLDER)) { - UserException.throwIt(REQUEST_DENIED); - } - - - if(m<=0) UserException.throwIt(BAD_ARGUMENT); - - if((short)(balance-m) < 0) UserException.throwIt(UNDERFLOW); - - balance -=m; - } - - - public void credit(short m) throws RemoteException, UserException { - - if( !security.isCommandSecure(SecurityService.PROPERTY_INPUT_INTEGRITY)){ - UserException.throwIt(CORRUPTED_DATA); - } - - if(!security.isAuthenticated(SecurityService.PRINCIPAL_APP_PROVIDER)) { - UserException.throwIt(REQUEST_DENIED); - } - - - - if(m<=0) UserException.throwIt(BAD_ARGUMENT); - - if((short)(balance+m) > MAX_AMOUNT) UserException.throwIt(OVERFLOW); - - balance +=m; - } - - - - public short getBalance() throws RemoteException, UserException { - - if( !security.isCommandSecure(SecurityService.PROPERTY_INPUT_INTEGRITY)){ - UserException.throwIt(CORRUPTED_DATA); - } - - if(!security.isAuthenticated(SecurityService.PRINCIPAL_APP_PROVIDER)) { - UserException.throwIt(REQUEST_DENIED); - } - - - return balance; - } - - public void setAccountNumber(byte[] number) throws RemoteException, UserException { - - if( !security.isCommandSecure(SecurityService.PROPERTY_INPUT_INTEGRITY)){ - UserException.throwIt(CORRUPTED_DATA); - } - - if(!security.isAuthenticated(SecurityService.PRINCIPAL_APP_PROVIDER)) { - UserException.throwIt(REQUEST_DENIED); - } - - - - - if(number.length != 5) UserException.throwIt(BAD_ARGUMENT); - Util.arrayCopy(number, (short)0, this.number, (short)0, (short)5); - } - - - - public byte[] getAccountNumber() throws RemoteException, UserException { - - if( !security.isCommandSecure(SecurityService.PROPERTY_INPUT_INTEGRITY)){ - UserException.throwIt(CORRUPTED_DATA); - } - - if(!security.isAuthenticated(SecurityService.PRINCIPAL_CARDHOLDER)) { - UserException.throwIt(REQUEST_DENIED); - } - - - return number; - } - - - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecureRMIDemo.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecureRMIDemo.opt deleted file mode 100644 index d290a7f2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/SecureRMIDemo/SecureRMIDemo.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xa:0x1 com.sun.javacard.samples.SecureRMIDemo.SecurePurseApplet -com.sun.javacard.samples.SecureRMIDemo -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xa 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/Main.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/Main.java deleted file mode 100644 index f0dd75b6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/Main.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * Main.java - * - * Created on September 19, 2001, 3:24 PM - */ - -package com.sun.javacard.samples.ServiceDemo; - -import javacard.framework.APDU; -import javacard.framework.ISOException; -import javacard.framework.service.*; - -/** - * - * @author vo113324 - */ -public class Main extends javacard.framework.Applet { - - - private Dispatcher disp; - private Service serv; - - public Main() - { - disp = new Dispatcher( (short) 1); - serv = new TestService(); - disp.addService(serv, Dispatcher.PROCESS_COMMAND); - - register(); - } - - - public static void install(byte[] aid, short s, byte b) - { - new Main(); - } - - public void process(APDU apdu) throws ISOException { - - disp.process(apdu); - - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PostProcess.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PostProcess.java deleted file mode 100644 index 5953c498..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PostProcess.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * PostProcess.java - * - * Created on October 8, 2001, 2:11 PM - */ - -package com.sun.javacard.samples.ServiceDemo; - -/** - * - * @author vo113324 - */ -public class PostProcess { - - /** Creates new PostProcess */ - public PostProcess() { - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PreProcess.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PreProcess.java deleted file mode 100644 index 4648fbea..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/PreProcess.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * PreProcess.java - * - * Created on October 8, 2001, 2:11 PM - */ - -package com.sun.javacard.samples.ServiceDemo; - -/** - * - * @author vo113324 - */ -public class PreProcess { - - /** Creates new PreProcess */ - public PreProcess() { - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/ServiceDemo.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/ServiceDemo.opt deleted file mode 100644 index b4afbf3a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/ServiceDemo.opt +++ /dev/null @@ -1,6 +0,0 @@ --noverify --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x9:0x1 com.sun.javacard.samples.ServiceDemo.Main -com.sun.javacard.samples.ServiceDemo -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x9 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/TestService.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/TestService.java deleted file mode 100644 index 5eecfb5d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/ServiceDemo/TestService.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * TestService.java - * - * Created on September 19, 2001, 4:28 PM - */ - -package com.sun.javacard.samples.ServiceDemo; - -import javacard.framework.*; -import javacard.framework.service.*; - -/** - * - */ -public class TestService extends BasicService { - - public boolean processCommand(APDU command) { - - - - // receiveInData(command); - - if(getINS(command) == (byte)1) { - setOutputLength(command, (short)1); - command.getBuffer()[5] = (byte) 0xAB; - succeedWithStatusWord(command, (short) 0x6617 ); - - return true; - } - - if(getINS(command) == (byte)2) { -// receiveInData(command); -// succeed(command); - - setOutputLength(command, (short)0); - - succeedWithStatusWord(command, (short) 0x6618 ); - - return true; - } - - if(getINS(command) == (byte)3) { -// receiveInData(command); - - setOutputLength(command, (short)0); - succeed(command); - return true; - } - - if(getINS(command) == (byte)3) { - receiveInData(command); - - setOutputLength(command, (short)0); - succeed(command); - return true; - } - - return false; - } - -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/SamplePasswdBioApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/SamplePasswdBioApplet.java deleted file mode 100644 index 5df3100d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/SamplePasswdBioApplet.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)SamplePasswdBioApplet.java 1.4 06/01/03 - */ - -package com.sun.javacard.samples.biometry.bioApplet; - -/** - * package AID: 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02 - * applet AID: 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02:0x01 - **/ -import javacard.framework.*; -import javacardx.biometry.*; - -public class SamplePasswdBioApplet extends Applet{ - public final static byte CLA=(byte)0xCF; - public final static byte INS_GET_REQ = (byte)0x10; - public final static byte INS_MATCH = (byte)0x11; - - //--Error codes - public static final short ERROR_MATCH_FAILED = (short)0x9101; - - private SharedBioTemplate bioImpl; - private static final byte[] BIO_SERVER_AID = {(byte)0xA0, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x62, (byte)0x03, (byte)0x01, (byte)0x0C, - (byte)0x0f, (byte)0x01, (byte)0x01}; - /** - * Only this class's install method should create the applet object. - */ - protected SamplePasswdBioApplet(byte[] bArray, short bOffset, byte bLength){ - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - register(); - } else { - register(bArray, (short)(bOffset+1), aidLen); - } - AID bioServerAID = JCSystem.lookupAID(BIO_SERVER_AID,(short)0,(byte)BIO_SERVER_AID.length); - bioImpl = (SharedBioTemplate)JCSystem.getAppletShareableInterfaceObject(bioServerAID,(byte)0); - } - - /** - * Installs this applet. - * @param bArray the array containing installation parameters - * @param bOffset the starting offset in bArray - * @param bLength the length in bytes of the parameter data in bArray - */ - public static void install(byte[] bArray, short bOffset, byte bLength) - { - new SamplePasswdBioApplet(bArray,bOffset,bLength); - } - /** - * Processes an incoming APDU. - * @see APDU - * @param apdu the incoming APDU - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public void process(APDU apdu){ - byte buffer[] = apdu.getBuffer(); - // check SELECT APDU command - if(selectingApplet()) - return; - switch (buffer[ISO7816.OFFSET_INS]){ - case INS_GET_REQ: - getRequirements(apdu); - break; - case INS_MATCH: - match(apdu); - break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - /** - * method returns the public template data. - **/ - public void getRequirements(APDU apdu){ - byte []buffer = apdu.getBuffer(); - //byte []pubTemp = JCSystem.makeTransientByteArray((short)4,JCSystem.CLEAR_ON_DESELECT); - - short length = bioImpl.getPublicTemplateData((short)0, buffer, (short)0, (short)buffer.length); - apdu.setOutgoing(); - apdu.setOutgoingLength(length); - apdu.sendBytes((short)0,length); - } - - /** - * following match method matches the password passed in with the reference - * template - **/ - public void match(APDU apdu){ - byte []buffer = apdu.getBuffer(); - short bytesRead = apdu.setIncomingAndReceive(); - short result = bioImpl.initMatch(buffer, ISO7816.OFFSET_CDATA, bytesRead); - if(result < BioTemplate.MINIMUM_SUCCESSFUL_MATCH_SCORE){ - ISOException.throwIt(ERROR_MATCH_FAILED); - } - } -} - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/bioApplet.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/bioApplet.opt deleted file mode 100644 index e426a72c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioApplet/bioApplet.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02:0x01 com.sun.javacard.samples.biometry.bioApplet.SamplePasswdBioApplet -com.sun.javacard.samples.biometry.bioApplet -0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/SampleBioServer.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/SampleBioServer.java deleted file mode 100644 index c4f714dc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/SampleBioServer.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)SampleBioServer.java 1.4 06/01/03 - */ - -package com.sun.javacard.samples.biometry.bioServer; - -import javacard.framework.*; -import javacardx.biometry.*; - -/** -* package AID: A0:00:00:00:62:03:01:0C:0f:01 -* applet AID: A0:00:00:00:62:03:01:0C:0f:01:01 -**/ -public class SampleBioServer extends Applet implements SharedBioTemplate{ - public final static byte CLA=(byte)0xCF; - public final static byte INS_ENROLL = (byte)0x10; - public final static byte MATCH_TRY_LIMIT = (byte)5; - private OwnerBioTemplate impl; - /** - * Only this class's install method should create the applet object. - */ - protected SampleBioServer(byte[] bArray, short bOffset, byte bLength){ - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - register(); - } else { - register(bArray, (short)(bOffset+1), aidLen); - } - impl = BioBuilder.buildBioTemplate(BioBuilder.PASSWORD,MATCH_TRY_LIMIT); - } - - /** - * Installs this applet. - * @param bArray the array containing installation parameters - * @param bOffset the starting offset in bArray - * @param bLength the length in bytes of the parameter data in bArray - */ - public static void install(byte[] bArray, short bOffset, byte bLength) - { - new SampleBioServer(bArray,bOffset,bLength); - } - /** - * Processes an incoming APDU. - * @see APDU - * @param apdu the incoming APDU - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public void process(APDU apdu){ - byte buffer[] = apdu.getBuffer(); - // check SELECT APDU command - if(selectingApplet()) - return; - switch (buffer[ISO7816.OFFSET_INS]){ - case INS_ENROLL: - enrollData(apdu); - break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - /** - * method takes in the data - * This implementation assumes that all the password data is given in the - * enroll method. - **/ - public void enrollData(APDU apdu){ - byte []buffer = apdu.getBuffer(); - short bytesRead = apdu.setIncomingAndReceive(); - impl.init(buffer, ISO7816.OFFSET_CDATA, bytesRead); - impl.doFinal(); - //enrollment complete - } - - public Shareable getShareableInterfaceObject(AID clientAID, byte parameter){ - return this; - } - - //--- the nethods below implement the SharedBioTemplate interface - public boolean isInitialized(){ - return impl.isInitialized(); - } - public boolean isValidated(){ - return impl.isValidated(); - } - public void reset(){ - impl.reset(); - } - public byte getTriesRemaining(){ - return impl.getTriesRemaining(); - } - public byte getBioType(){ - return impl.getBioType(); - } - public short getVersion(byte[] dest, short offset){ - return impl.getVersion(dest,offset); - } - public short getPublicTemplateData(short publicOffset, byte[] dest, - short destOffset, - short length) throws BioException{ - return impl.getPublicTemplateData(publicOffset,dest,destOffset,length); - } - public short initMatch(byte[] candidate, short offset, short length) - throws BioException{ - return impl.initMatch(candidate,offset,length); - } - public short match(byte[] candidate, short offset, short length) - throws BioException{ - return impl.match(candidate,offset,length); - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/bioServer.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/bioServer.opt deleted file mode 100644 index a3bb1d9b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/biometry/bioServer/bioServer.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x01:0x01 com.sun.javacard.samples.biometry.bioServer.SampleBioServer -com.sun.javacard.samples.biometry.bioServer -0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x01 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/C.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/C.java deleted file mode 100644 index cff070ef..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/C.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.odSample.libPackageC; - -/** - * package AID - 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 - * - * This class is the only one in this package which is used to demonstrate - * dependencies on package and package deletion. - */ -public class C{ - public static short DATA=1; //constant used by other packages -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/libPackageC.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/libPackageC.opt deleted file mode 100644 index f5dd58c6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/libPackageC/libPackageC.opt +++ /dev/null @@ -1,4 +0,0 @@ --out EXP JCA CAP --exportpath . -com.sun.javacard.samples.odSample.libPackageC -0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x07:0x03 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/packageA/A.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/packageA/A.java deleted file mode 100644 index 1a18b8ca..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/odSample/packageA/A.java +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.odSample.packageA; - -import javacard.framework.*; -import com.sun.javacard.impl.*; - -/** - * package AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 - * applet AID - 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 - * - * This applet used to demonstrate object deletion mechanism and also to - * monitor memory usage as other packages/applets get added/deleted - **/ - -public class A extends Applet { - - //APDU specific data - public final static byte A_CLA=(byte)0xC0; - public static short ST_ERROR_BAD_TRANSIENT_MEM_DESELECT = (short)0x9101; - public static short ST_ERROR_BAD_TRANSIENT_MEM_DESELECT_ELEMENT=(short)0x9102; - public static short ST_ERROR_BAD_TRANSIENT_MEM_RESET = (short)0x9103; - public static short ST_ERROR_BAD_TRANSIENT_MEM_RESET_ELEMENT=(short)0x9104; - public static short ST_ERROR_MEM_MATCH_OBJECTS=(short)0x9105; - public static short ST_ERROR_MEM_MATCH_TRANSIENT_DESELECT_OBJECTS=(short)0x9106; - public static short ST_ERROR_TRANSIENT_DESELECT_OBJECTS_EXIST=(short)0x9107; - public static short ST_ERROR_TRANSIENT_RESET_OBJECTS_EXIST=(short)0x9108; - public static short ST_ERROR_MEM_MATCH_TRANSIENT_RESET_OBJECTS=(short)0x9109; - public static short ST_ERROR_MEM_MATCH_ALL_ATTRIBUTES=(short)0x910A; - public static short ST_ERROR_MEM_MATCH_INITIAL=(short)0x910B; - public static short ST_ERROR_MEM_MATCH_BEFORE_PACK=(short)0x910C; - public static short ST_ERROR_APPLET_AID_NOT_FOUND=(short)0x910D; - public static short ST_ERROR_SHAREABLE_NOT_FOUND=(short)0x910E; - public static short ST_ERROR_TRANSIENT_DESELECT_MEM_NOT_RETURNED=(short)0x910F; - public static short ST_ERROR_TRANSIENT_RESET_MEM_NOT_RETURNED=(short)0x9110; - public static short SUCCESS=(short)0x9000; - - //BApp1AID is the Applet AID for applet BApp1 in packageB - public static byte[] BApp1AID={(byte)0xA0, (byte)0x00, - (byte)0x00, (byte)0x00, - (byte)0x62, (byte)0x03, - (byte)0x01, (byte)0x0C, - (byte)0x07, (byte)0x02, - (byte)0x01}; - - short initialMemUsage; //the initial available persistent memory snapshot - short initialTransientDeselectMem; //initial available transient memory of type MEMORY_TYPE_TRANSIENT_DESELECT - short initialTransientResetMem; //initial available transient memory of type MEMORY_TYPE_TRANSIENT_RESET - short objectRefMemUsage; //memory snapshot after making children tree - short transientDeselectUninitializedMemUsage;//memory after making array but not initializing - short transientDeselectMemUsage;//memory snapshort after making transient usign deselect and initializing - short transientResetUninitializedMemUsage;//memafter making array but not initializing it - short transientResetMemUsage; //memory snapshot after making transient using reset - - //reference attributes - ATreeNode left; - ATreeNode right; - static ATreeNode sleft; - static ATreeNode sright; - Object[] transientDeselectMem; //transient - Object[] transientResetMem;//transient - Shareable BApp1Ref; //ref to BApp1 - - //Constants - private static final short NUM_OBJECTS=2; - private static final short MAX_TREE_DEPTH=2; - - //constants, INS codes and variables for these tests - final static byte SETUP_PERSISTENT = (byte)0x19; - final static byte SETUP_TRANSIENT = (byte)0x20; - final static byte REQUEST_OD = (byte)0x10; - final static byte REMOVE_TREES = (byte)0x11; - final static byte ANALYZE_REMOVE_TREES = (byte)0x12; - final static byte ANALYZE_TRANSIENT_DESELECT_MEM=(byte)0x13; - final static byte ANALYZE_TRANSIENT_RESET_MEM=(byte)0x14; - final static byte REMOVE_ALL_ATTRIBUTES=(byte)0x15; - final static byte ANALYZE_REMOVE_ALL_ATTRIBUTES=(byte)0x16; - final static byte CAPTURE_INITIAL_MEM=(byte)0x17; - final static byte COMPARE_INITIAL_MEM=(byte)0x18; - final static byte GET_SHAREABLE_REF=(byte)0x21; - final static byte LOSE_REF_BAPP1=(byte)0x22; - - /** - * method instantiates aninstance of A - **/ - public static void install(byte []bArr,short bOffset,byte bLength){ - new A(); - } - - /** - * method sets up tree of objects. Two are statically referenced. - **/ - private void setupTrees(){ - left=new ATreeNode((short)0,MAX_TREE_DEPTH); - right=new ATreeNode((short)0,MAX_TREE_DEPTH); - sleft=new ATreeNode((short)0,MAX_TREE_DEPTH); - sright=new ATreeNode((short)0,MAX_TREE_DEPTH); - } - - /** - * Constructor. Calls register and captures the initial memory usage - **/ - private A(){ - //capture initial persistant memory available - register(); - initialMemUsage=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); - } - - /** - * method sets up the persistent objects by calling setupTrees() - * and captures the memory available - **/ - private void setupPersistent(){ - //setup object references - setupTrees(); - objectRefMemUsage=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); - } - - /** - * method sets up the transient objects and captures available memory - * of different kinds at various stages. - **/ - private void setupTransient(){ - //get initial memory available for persistent and transient memory - initialMemUsage=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); - initialTransientDeselectMem=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT); - initialTransientResetMem=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_RESET); - - //setup CLEAR_ON_DESELECT memory - transientDeselectMem=JCSystem.makeTransientObjectArray(NUM_OBJECTS,JCSystem.CLEAR_ON_DESELECT); - transientDeselectUninitializedMemUsage=JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); - for(short i=0;itrue indicates more data coming; false - * inidicates this is the last data chunk. - * @exception UserException - thrown if error condition occurs, or - * invalid parameters passed. - */ - public void loadPhoto(short photoID, byte[] data, - short size, short offset, boolean more) - throws RemoteException, UserException; - - /** - * This method deletes the photo whose ID is specified in the card. - * @param photoID - ID slot of photo to delete - * @exception UserException - thrown if error condition occurs, or - * invalid parameters passed. - */ - public void deletePhoto(short photoID) - throws RemoteException, UserException; - - /** - * This method retrieves the photo size whose ID is specified. - * @param photoID - ID slot of photo to access - * @exception UserException - thrown if error condition occurs, or - * invalid parameters passed. - */ - public short getPhotoSize(short photoID) - throws RemoteException, UserException; - - /** - * This method retrueves a series of bytes belonging to the photo - * from the smart card at the position specified. - * @param photoID - photo slot where to store data - * @param size - number of bytes expected from the smart card - * @param offset - position inside photo buffer where to access data. - * @return byte array with binary data from photo stored inside the - * smart card - * @exception UserException - thrown if error condition occurs, or - * invalid parameters passed. - */ - public byte[] getPhoto(short photoID, short offset, short size) - throws RemoteException, UserException; - - /** - * This method verifies on card the photo - * presented by the user. - * @param photoID - photo slot where to store data - * @param size - number of bytes expected from the smart card - * @param offset - position inside photo buffer where to access data. - * @param photoDigest - msg digest of photo sent by user - * @param photoOffset - position inside photoDigest where to access data - * @return void - * @exception UserException - thrown if error condition occurs, or - * invalid parameters passed. - */ - - public short verifyPhoto(short photoID, byte[] photoDigest, short photoOffset) - throws RemoteException, UserException ; -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardApplet.java deleted file mode 100644 index 4b98d4f2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardApplet.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)PhotoCardApplet.java 1.3 06/01/03 - */ - -package com.sun.javacard.samples.photocard; - -import java.rmi.*; - -import javacard.framework.APDU; -import javacard.framework.ISOException; -import javacard.framework.UserException; -import javacard.framework.Util; -import javacard.framework.service.*; - -/** - * - * @author oscarm - */ -public class PhotoCardApplet extends javacard.framework.Applet { - - - private Dispatcher disp; - private RemoteService serv; - private Remote photoStorage; - - public PhotoCardApplet() { - photoStorage = new PhotoCardImpl(); - - disp = new Dispatcher( (short) 1); - serv = new RMIService(photoStorage); - disp.addService(serv, Dispatcher.PROCESS_COMMAND); - - register(); - } - - - public static void install(byte[] aid, short s, byte b) { - new PhotoCardApplet(); - } - - public void process(APDU apdu) throws ISOException { - - disp.process(apdu); - - } - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardImpl.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardImpl.java deleted file mode 100644 index 86a8cb00..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/PhotoCardImpl.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)PhotoCardImpl.java 1.5 06/01/03 - */ - -package com.sun.javacard.samples.photocard; - -import javacard.framework.*; -import javacard.framework.service.*; -import java.rmi.RemoteException; -import javacard.security.*; - - -public class PhotoCardImpl extends CardRemoteObject implements PhotoCard { - - // Internal fields - // Arrat containing photo objects - private Object[] photos; - - private boolean[] photoReady; - private byte[] buffer; - - PhotoCardImpl() { - super(); // export it - // Initialize here - photos = new Object[(short)MAX_PHOTO_COUNT]; - photoReady = new boolean[(short)MAX_PHOTO_COUNT]; - buffer = new byte[(short)MAX_BUFFER_BYTES]; - for (short i = (short)0; i < (short)MAX_PHOTO_COUNT; i++) { - photoReady[i] = false; - } - } - - // Implementation methods from Interface PhotoCard - public short requestPhotoStorage(short size) - throws RemoteException, UserException { - - // 16-byte safety factor. For object header. - if (JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT) < - (short)(size + (short)16) ) { - UserException.throwIt(NO_SPACE_AVAILABLE); - } - - for (short i = (short)0; i < (short)MAX_PHOTO_COUNT;i++) { - byte[] thePhoto = (byte[])photos[i]; - - if (photos[i] == null) { - photos[i] = new byte[size]; - return (short)(i + 1); - } - } - UserException.throwIt(NO_SPACE_AVAILABLE); - // Compiler requires this unreachable statement - return (short)(-1); - } - - public void loadPhoto(short photoID, byte[] data, - short size, short offset, boolean more) - throws RemoteException, UserException { - - if (photoID > (short)MAX_PHOTO_COUNT) { - UserException.throwIt(PhotoCard.INVALID_PHOTO_ID); - } - - byte[] selPhoto = (byte[])photos[(short)(photoID - (short)1)]; - - if (selPhoto == null) { - UserException.throwIt(PhotoCard.NO_PHOTO_STORED); - } - - if (((short)(offset + size)) > selPhoto.length) { - UserException.throwIt(PhotoCard.INVALID_ARGUMENT); - } - - Util.arrayCopy(data, (short)0, selPhoto, offset, size); - if (more == false) { - photoReady[(short)(photoID - (short)1)] = true; - } - } - - public void deletePhoto(short photoID) - throws RemoteException, UserException { - - if (photoID > (short)MAX_PHOTO_COUNT) { - UserException.throwIt(PhotoCard.INVALID_PHOTO_ID); - } - - byte[] thePhoto = (byte[])photos[(short)(photoID - (short)1)]; - if (thePhoto != null) { - thePhoto = null; - JCSystem.requestObjectDeletion(); - photoReady[(short)(photoID - (short)1)] = false; - } else { - UserException.throwIt(PhotoCard.NO_PHOTO_STORED); - } - } - - public short getPhotoSize(short photoID) - throws RemoteException, UserException { - - if (photoID > (short)MAX_PHOTO_COUNT) { - UserException.throwIt(PhotoCard.INVALID_PHOTO_ID); - } - - byte[] thePhoto = (byte[])photos[(short)(photoID - (short)1)]; - if (thePhoto != null) { - return (short)(thePhoto.length); - } else { - return (short)0; - } - } - - public byte[] getPhoto(short photoID, short offset, short size) - throws RemoteException, UserException { - - if (photoID > (short)MAX_PHOTO_COUNT) { - UserException.throwIt(PhotoCard.INVALID_PHOTO_ID); - } - - byte[] selPhoto = (byte[])photos[(short)(photoID - (short)1)]; - - if ((selPhoto == null) || (photoReady[(short)(photoID - (short)1)] == false)) { - UserException.throwIt(PhotoCard.NO_PHOTO_STORED); - } - - if (((short)(offset + size)) > selPhoto.length) { - UserException.throwIt(PhotoCard.INVALID_ARGUMENT); - } - Util.arrayCopy(selPhoto, offset, buffer, (short)0, size); - return buffer; - } - - public short verifyPhoto(short photoID, byte[] photoDigest, short photoOffset) - throws RemoteException, UserException { - - MessageDigest md = null; - short response; - - if(photoOffset > (short) photoDigest.length){ - UserException.throwIt(PhotoCard.INVALID_OFFSET); - } - - if (photoID > (short)MAX_PHOTO_COUNT) { - UserException.throwIt(PhotoCard.INVALID_PHOTO_ID); - } - - byte[] selPhoto = (byte[])photos[(short)(photoID - (short)1)]; - - if ((selPhoto == null) || (photoReady[(short)(photoID - (short)1)] == false)) { - UserException.throwIt(PhotoCard.NO_PHOTO_STORED); - } - - try - { - md = MessageDigest.getInstance(MessageDigest.ALG_SHA_256,false); - }catch(CryptoException e) { - UserException.throwIt(PhotoCard.DOES_NOT_SUPPORT_PHOTO_VERIFICTAION); - } - - short resultLength = md.doFinal(selPhoto,(short) 0, (short) selPhoto.length, - buffer,(short)0); - response = compare(buffer,photoDigest,photoOffset,resultLength); - return response; - } - - private short compare(byte[] src, byte[] destination, - short photoOffset, short length){ - - try { - if (length != (short)32){ - ISOException.throwIt( FAIL4 ); - } - - short comp = Util.arrayCompare(src, (short)0, - destination, photoOffset, length); - - if(comp == 0){ - return (short)0; - } - else{ - return (short) FAIL1; - } - - } - catch( CryptoException e ){ - return FAIL3; - } - } - - -} - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/photocard.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/photocard.opt deleted file mode 100644 index 4047f1ed..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/photocard/photocard.opt +++ /dev/null @@ -1,4 +0,0 @@ --out JCA CAP EXP --applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x07:0x01 com.sun.javacard.samples.photocard.PhotoCardApplet --exportpath . -com.sun.javacard.samples.photocard 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x07 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/SigMsgRecApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/SigMsgRecApplet.java deleted file mode 100644 index 7e6f57b4..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/SigMsgRecApplet.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - /* - * @(#)SigMsgRecApplet.java 1.3 06/01/03 - */ - - package com.sun.javacard.samples.sigMsgRec; - - -import javacard.framework.*; -import javacard.security.RSAPublicKey; -import javacard.security.RSAPrivateKey; -import javacard.security.SignatureMessageRecovery; -import javacard.security.KeyPair; -import javacard.security.Signature; -import javacard.security.KeyBuilder; - -/** -* package AID 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0C -**/ - -public class SigMsgRecApplet extends Applet{ - public final static byte CLA=(byte)0xCF; - public final static byte INS_SIGN=(byte)0x10; - public final static byte INS_VERIFY_FULL_MSG_REC=(byte)0x11; - public final static byte INS_VERIFY_PART_MSG_REC=(byte)0x12; - - //--Error codes - public static final short ERROR_BAD_SIG_LEN=(short)0x9101; - public static final short ERROR_VERIFICATION_FAILED=(short)0x9102; - - public final static short SIG_LENGTH=64; - - - //--RSA Keypair data - private static final byte[] RSA_PUB_KEY_EXP = {(byte)0x01, (byte)0x00, (byte)0x01}; - private static final byte[] RSA_PUB_PRIV_KEY_MOD = { (byte)0xbe, (byte)0xdf, - (byte)0xd3, (byte)0x7a, (byte)0x08, (byte)0xe2, (byte)0x9a, (byte)0x58, - (byte)0x27, (byte)0x54, (byte)0x2a, (byte)0x49, (byte)0x18, (byte)0xce, - (byte)0xe4, (byte)0x1a, (byte)0x60, (byte)0xdc, (byte)0x62, (byte)0x75, - (byte)0xbd, (byte)0xb0, (byte)0x8d, (byte)0x15, (byte)0xa3, (byte)0x65, - (byte)0xe6, (byte)0x7b, (byte)0xa9, (byte)0xdc, (byte)0x09, (byte)0x11, - (byte)0x5f, (byte)0x9f, (byte)0xbf, (byte)0x29, (byte)0xe6, (byte)0xc2, - (byte)0x82, (byte)0xc8, (byte)0x35, (byte)0x6b, (byte)0x0f, (byte)0x10, - (byte)0x9b, (byte)0x19, (byte)0x62, (byte)0xfd, (byte)0xbd, (byte)0x96, - (byte)0x49, (byte)0x21, (byte)0xe4, (byte)0x22, (byte)0x08, (byte)0x08, - (byte)0x80, (byte)0x6c, (byte)0xd1, (byte)0xde, (byte)0xa6, (byte)0xd3, - (byte)0xc3, (byte)0x8f}; - - private static final byte[] RSA_PRIV_KEY_EXP = { (byte)0x84, (byte)0x21, - (byte)0xfe, (byte)0x0b, (byte)0xa4, (byte)0xca, (byte)0xf9, (byte)0x7d, - (byte)0xbc, (byte)0xfc, (byte)0x0e, (byte)0xa9, (byte)0xbb, (byte)0x7a, - (byte)0xbd, (byte)0x7d, (byte)0x65, (byte)0x40, (byte)0x2b, (byte)0x08, - (byte)0xc6, (byte)0xdf, (byte)0xc9, (byte)0x4b, (byte)0x09, (byte)0x6a, - (byte)0x29, (byte)0x3b, (byte)0xc2, (byte)0x42, (byte)0x88, (byte)0x23, - (byte)0x44, (byte)0xaf, (byte)0x08, (byte)0x82, (byte)0x4c, (byte)0xff, - (byte)0x42, (byte)0xa4, (byte)0xb8, (byte)0xd2, (byte)0xda, (byte)0xcc, - (byte)0xee, (byte)0xc5, (byte)0x34, (byte)0xed, (byte)0x71, (byte)0x01, - (byte)0xab, (byte)0x3b, (byte)0x76, (byte)0xde, (byte)0x6c, (byte)0xa2, - (byte)0xcb, (byte)0x7c, (byte)0x38, (byte)0xb6, (byte)0x9a, (byte)0x4b, - (byte)0x28, (byte)0x01}; - - - RSAPublicKey pubKey; - RSAPrivateKey privKey; - - SignatureMessageRecovery sig; - /** - * the sigBuff buffer would hold the signature output of the Signature - * class and an extra 2 bytes for the length of recoverable message - * sent back to the caller - **/ - byte []sigBuff; - short sigLen; - /** - * the following state variable has the following value: - * 0 => recovery has not yet started - * 1 => signature recovered. Waiting for rest of message - **/ - byte recState; - - /** - * Only this class's install method should create the applet object. - */ - protected SigMsgRecApplet(byte[] bArray, short bOffset, byte bLength){ - byte aidLen = bArray[bOffset]; - if (aidLen== (byte)0){ - //System.out.println("using dfault"); - register(); - } else { - //System.out.println("using provided"); - register(bArray, (short)(bOffset+1), aidLen); - } - pubKey = (RSAPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512,false); - privKey = (RSAPrivateKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512,false); - privKey.setExponent(RSA_PRIV_KEY_EXP,(short)0,(short)RSA_PRIV_KEY_EXP.length); - privKey.setModulus(RSA_PUB_PRIV_KEY_MOD,(short)0,(short)RSA_PUB_PRIV_KEY_MOD.length); - pubKey.setExponent(RSA_PUB_KEY_EXP,(short)0,(short)RSA_PUB_KEY_EXP.length); - pubKey.setModulus(RSA_PUB_PRIV_KEY_MOD,(short)0,(short)RSA_PUB_PRIV_KEY_MOD.length); - sigBuff = JCSystem.makeTransientByteArray((short)(SIG_LENGTH+2),JCSystem.CLEAR_ON_DESELECT); - sig = (SignatureMessageRecovery)Signature.getInstance(Signature.ALG_RSA_SHA_ISO9796_MR,false); - recState = (byte)0; - } - /** - * Installs this applet. - * @param bArray the array containing installation parameters - * @param bOffset the starting offset in bArray - * @param bLength the length in bytes of the parameter data in bArray - */ - public static void install(byte[] bArray, short bOffset, byte bLength) - { - new SigMsgRecApplet(bArray,bOffset,bLength); - } - - /** - * Processes an incoming APDU. - * @see APDU - * @param apdu the incoming APDU - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public void process(APDU apdu) - { - byte buffer[] = apdu.getBuffer(); - - // check SELECT APDU command - if ((buffer[ISO7816.OFFSET_CLA] == 0) && - (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4))){ - return; - } - - switch (buffer[ISO7816.OFFSET_INS]){ - case INS_SIGN: - testCryptoSign(apdu); - break; - case INS_VERIFY_FULL_MSG_REC: - testCryptoVerifyFullMsgRecovery(apdu); - break; - case INS_VERIFY_PART_MSG_REC: - testCryptoVerifyPartMsgRecovery(apdu); - break; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - - } - - /** - * For the purposes of this sample, Assumed that all the data to be - * signed fits into one APDU buffer - **/ - private void testCryptoSign(APDU apdu){ - byte []buffer = apdu.getBuffer(); - short bytesRead = apdu.setIncomingAndReceive(); - short []m1Data = JCSystem.makeTransientShortArray((short)1,JCSystem.CLEAR_ON_DESELECT); - - sig.init(privKey,Signature.MODE_SIGN); - sigLen=sig.sign(buffer,ISO7816.OFFSET_CDATA,bytesRead,sigBuff,(short)0,m1Data,(short)0); - - //set m1Length into sigBuff array - sigBuff[sigLen] = (byte)((short)(m1Data[(short)0] & ((short)0xFF00)) >> ((short)8)); - sigBuff[(short)(sigLen+1)] = (byte)(m1Data[(short)0] & ((short)0x00FF)); - - apdu.setOutgoing(); - apdu.setOutgoingLength((short)(sigLen+2));//The extra 2 bytes for m1Length - apdu.sendBytesLong(sigBuff,(short)0,(short)(sigLen+2)); - } - - /** - * in this case, all the message is inside the signature. - * We only expect one APDU with signature - **/ - private void testCryptoVerifyFullMsgRecovery(APDU apdu){ - sig.init(pubKey,Signature.MODE_VERIFY); - boolean verified=false; - byte []buffer = apdu.getBuffer(); - short dataLength = (short)(buffer[ISO7816.OFFSET_LC] & (short)0xFF); - //get the signature from APDU - short bytesRead = apdu.setIncomingAndReceive(); - Util.arrayCopyNonAtomic(buffer, ISO7816.OFFSET_CDATA, sigBuff, (short)0,bytesRead); - short m1Length = sig.beginVerify(sigBuff,(short)0,bytesRead); - verified = sig.verify(sigBuff,(short)0,(short)0); - //In either case m1 is consumed by this applet - if(!verified){ - ISOException.throwIt(ERROR_VERIFICATION_FAILED); - } - } - - /** - * This method is called when there is partial message recovery. The recoverable - * message inside the signature is consumed by this applet. In this case, the - * first APDU contains the signature and returns true if recovery successful - * the second APDU contains the remainder of the message and the return value - * represents signature verification - **/ - private void testCryptoVerifyPartMsgRecovery(APDU apdu){ - byte []buffer = apdu.getBuffer(); - short dataLength = (short)(buffer[ISO7816.OFFSET_LC] & (short)0xFF); - //get the signature from APDU - short bytesRead = apdu.setIncomingAndReceive(); - Util.arrayCopyNonAtomic(buffer, ISO7816.OFFSET_CDATA, sigBuff, (short)0,bytesRead); - if(recState == 0){ - //recover the recoverable message from signature - sig.init(pubKey,Signature.MODE_VERIFY); - short m1Length = sig.beginVerify(sigBuff,(short)0,bytesRead); - //consume the recoverable message. Theen discard it - sigBuff[0] = (byte)((short)(m1Length & ((short)0xFF00)) >> ((short)8)); - sigBuff[1] = (byte)(m1Length & ((short)0x00FF)); - //return back the length of recoverable message - apdu.setOutgoing(); - apdu.setOutgoingLength((short)2); - apdu.sendBytesLong(sigBuff,(short)0,(short)2); - recState = 1; - }else{ - recState = 0; - //rest of message sent. verify - if(!sig.verify(sigBuff,(short)0,bytesRead)){ - ISOException.throwIt(ERROR_VERIFICATION_FAILED); - } - } - } -} - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/sigMsgRec.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/sigMsgRec.opt deleted file mode 100644 index b9d5154d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/sigMsgRec/sigMsgRec.opt +++ /dev/null @@ -1,4 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0C:0x01 com.sun.javacard.samples.sigMsgRec.SigMsgRecApplet -com.sun.javacard.samples.sigMsgRec 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0C 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.java deleted file mode 100644 index 3f0980f0..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.java +++ /dev/null @@ -1,916 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.samples.transit; - -import javacard.framework.APDU; -import javacard.framework.Applet; -import javacard.framework.ISO7816; -import javacard.framework.ISOException; -import javacard.framework.JCSystem; -import javacard.framework.OwnerPIN; -import javacard.framework.Util; -import javacard.security.DESKey; -import javacard.security.KeyBuilder; -import javacard.security.RandomData; -import javacard.security.Signature; -import javacardx.crypto.Cipher; - -/** - * This applet implements the on-card part of a transit system solution. The - * on-card applet and the off-card applications (transit terminal and POS - * terminal) use a mutual authentication scheme based on a dynamically generated - * DES session key to ensure data integrity and origin authentication during a - * session. - * - * When interacting with a POS terminal, the account maintained on the card can - * be credited or queried for the current balance. - * - * When interacting with a transit terminal, the transit system entry and the - * exit events are checked for consistency and processed - the account - * maintained on the card is debited upon proper exit from the transit system. - * - * Design notes: - * - This sample transit applet does not account for any admin or self-admin use cases such as - * resetting the card of a transit system user when it is in an inconsistent transit - * state. Such an inconsistent state can, for example, result from the user jumping the gates when - * the turnstile is out of order... - * - This sample transit applet does not account for any system-wide transactional - * operations. For example, during a credit operation, if the user removes his card - * just after the balance has been updated but before the APDU response gets to - * the terminal, the account on the card will remain credited but the terminal will - * only be able to detect an IO error b/w the card and the card reader. - * - The constants defined for this class should have been shared through - * an additional class or interface with the terminal code - * (see com.sun.javacard.clientsamples.transit.Constants). - * - This applet could be refactored so that the mutual authentication code - * be moved in a base abstract class and the transit system specific behavior be - * implemented in a subclass of this base class. This refactoring would facilitate - * the reuse of the mutual authentication scheme in other application domain. - */ -public class TransitApplet extends Applet { - - // Codes of INS byte in the command APDU header - - /** - * INS value for ISO 7816-4 VERIFY command - */ - final static byte VERIFY = (byte) 0x20; - - /** - * INS value for INITIALIZE_SESSION command - */ - final static byte INITIALIZE_SESSION = (byte) 0x30; - - /** - * INS value for PROCESS_REQUEST command - */ - final static byte PROCESS_REQUEST = (byte) 0x40; - - // Tags for TLV records in PROCESS_REQUEST C-APDU - - /** - * TLV Tag for PROCESS_ENTRY request - */ - final static byte PROCESS_ENTRY = (byte) 0xC1; - - /** - * TLV Tag for PROCESS_EXIT request - */ - final static byte PROCESS_EXIT = (byte) 0xC2; - - /** - * TLV Tag for CREDIT request - */ - final static byte CREDIT = (byte) 0xC3; - - /** - * TLV Tag for GET_BALANCE request - */ - final static byte GET_BALANCE = (byte) 0xC4; - - // Offsets of TLV components in PROCESS_REQUEST C-APDU [CLA, INS, P1, P2, LC - // T L V...] - - /** - * TLV tag offset - */ - final static short TLV_TAG_OFFSET = ISO7816.OFFSET_CDATA; - - /** - * TLV length offset - */ - final static short TLV_LENGTH_OFFSET = TLV_TAG_OFFSET + 1; - - /** - * TLV value offset - */ - final static short TLV_VALUE_OFFSET = TLV_LENGTH_OFFSET + 1; - - /** - * Maximum allowed balance - */ - final static short MAX_BALANCE = (short) 500; - - /** - * Minimum balance to start transit - */ - final static short MIN_TRANSIT_BALANCE = (short) 10; - - /** - * Maximum amount to be credited - */ - final static short MAX_CREDIT_AMOUNT = (short) 100; - - /** - * Maximum number of incorrect tries before the PIN is blocked - */ - final static byte MAX_PIN_TRIES = (byte) 0x03; - - /** - * Maximum PIN size - */ - final static byte MAX_PIN_SIZE = (byte) 0x08; - - /** - * SW bytes for PIN verification failure - */ - final static short SW_VERIFICATION_FAILED = 0x6300; - - /** - * SW bytes for PIN validation required - */ - final static short SW_PIN_VERIFICATION_REQUIRED = 0x6301; - - /** - * SW bytes for invalid credit amount (amount > MAX_CREDIT_AMOUNT or amount < - * 0) - */ - final static short SW_INVALID_TRANSACTION_AMOUNT = 0x6A83; - - /** - * SW bytes for maximum balance exceeded - */ - final static short SW_EXCEED_MAXIMUM_BALANCE = 0x6A84; - - /** - * SW bytes for negative balance reached - */ - final static short SW_NEGATIVE_BALANCE = 0x6A85; - - /** - * SW bytes for wrong signature condition - */ - final static short SW_WRONG_SIGNATURE = (short) 0x9105; - - /** - * SW bytes for minimum transit balance not met - */ - final static short SW_MIN_TRANSIT_BALANCE = (short) 0x9106; - - /** - * SW bytes for invalid transit state - */ - final static short SW_INVALID_TRANSIT_STATE = (short) 0x9107; - - /** - * SW bytes for success, used in MAC - */ - final static short SW_SUCCESS = (short) 0x9000; - - /** - * Unique ID length - */ - final static short UID_LENGTH = (short) 8; - - /** - * DES key length in bytes - */ - final static short LENGTH_DES_BYTE = (short) (KeyBuilder.LENGTH_DES / 8); - - /** - * Host and card challenge length (note: (2 * CHALLENGE_LENGTH) * 8 == - * KeyBuilder.LENGTH_DES - */ - final static short CHALLENGE_LENGTH = (short) 4; - - /** - * MAC length as generated by Signature.ALG_DES_MAC8_ISO9797_M2 - */ - final static short MAC_LENGTH = (short) 8; - - /** - * Unique ID - */ - private byte[] uid; - - // Signature/key objects - - /** - * Cipher used to encrypt - using the static DES key - the derivation data - * to form the session key - */ - private Cipher cipher; - - /** - * DES static key, shared b/w host and card - */ - private DESKey staticKey; - - /** - * 4-bytes Card challenge - */ - private byte[] cardChallenge; // Transient - - /** - * 8-bytes key derivation data, generated from the host challenge and the - * card challenge - */ - private byte[] keyDerivationData; // Transient - - /** - * 8-bytes session key data, generated from the derivation data - */ - private byte[] sessionKeyData; // Transient - - /** - * DES session key, generated from the derivation data - */ - private DESKey sessionKey; // Transient key - - /** - * Indicates whether or not to use transient session key - for performance - * measurement only - */ - private boolean useTransientKey = true; - - /** - * Signature initialized with the DES key and used to verify incoming - * messages and to sign outgoing messages - */ - private Signature signature; - - /** - * Random data generator, used to generate the card challenge - */ - private RandomData random; - - /** - * The user PIN - */ - private OwnerPIN pin; - - /** - * The balance - */ - private short balance = (short) 0; - - /** - * The entry ststion id, set to (-1) when not in transit - */ - private short entryStationId = (short) -1; - - /** - * A correlation id that may be used by the backend system to correlate - * entry and exit events - */ - private byte correlationId = (byte) 0; - - /** - * Creates a new Transit applet instance. - * - * @param bArray - * The array containing installation parameters - * @param bOffset - * The starting offset in bArray - * @param bLength - * The length in bytes of the parameter data in bArray - */ - protected TransitApplet(byte[] bArray, short bOffset, byte bLength) { - - // Create static DES key - staticKey = (DESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_DES, - KeyBuilder.LENGTH_DES, false); - - // Create cipher - cipher = Cipher.getInstance(Cipher.ALG_DES_CBC_ISO9797_M2, false); - - // Create card challenge transient buffer - cardChallenge = JCSystem.makeTransientByteArray(CHALLENGE_LENGTH, - JCSystem.CLEAR_ON_DESELECT); - - // Create key derivation data transient buffer - keyDerivationData = JCSystem.makeTransientByteArray( - (short) (2 * CHALLENGE_LENGTH), JCSystem.CLEAR_ON_DESELECT); - - // Create session key data transient buffer - sessionKeyData = JCSystem.makeTransientByteArray( - (short) (2 * keyDerivationData.length), - JCSystem.CLEAR_ON_DESELECT); - // XXX: Allocates more than actual key to contain the complete - // encrypted key derivation data - - // Create signature - signature = Signature.getInstance(Signature.ALG_DES_MAC8_ISO9797_M2, - false); - - byte aidLen = bArray[bOffset]; // aid length - if (aidLen == (byte) 0) { - register(); - } else { - register(bArray, (short) (bOffset + 1), aidLen); - } - - // Ignore control info - bOffset = (short) (bOffset + aidLen + 1); - byte infoLen = bArray[bOffset]; // control info length - bOffset = (short) (bOffset + infoLen + 1); - - byte paramLen = bArray[bOffset++]; // applet parameters length - - // Retrieve UID, static key data and the PIN initialization values from - // installation parameters - - if (paramLen <= (LENGTH_DES_BYTE + UID_LENGTH) - || paramLen > (LENGTH_DES_BYTE + UID_LENGTH + MAX_PIN_SIZE)) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Retrieve the UID - uid = new byte[UID_LENGTH]; - Util.arrayCopy(bArray, bOffset, uid, (short) 0, UID_LENGTH); - bOffset += UID_LENGTH; - - // Retrieve the static key data - staticKey.setKey(fixParity(bArray, bOffset, LENGTH_DES_BYTE), bOffset); - bOffset += LENGTH_DES_BYTE; - - // Retrieve the flag indicating whether or not to use a transient key - useTransientKey = (bArray[bOffset] != (byte) 0); - bOffset++; - - // Retrieve the PIN - pin = new OwnerPIN(MAX_PIN_TRIES, MAX_PIN_SIZE); - pin.update(bArray, bOffset, - (byte) (paramLen - UID_LENGTH - LENGTH_DES_BYTE - 1)); - - // Create transient DES session key - if (useTransientKey) { - sessionKey = (DESKey) KeyBuilder.buildKey( - KeyBuilder.TYPE_DES_TRANSIENT_DESELECT, KeyBuilder.LENGTH_DES, - false); - } else { - sessionKey = (DESKey) KeyBuilder.buildKey( - KeyBuilder.TYPE_DES, KeyBuilder.LENGTH_DES, - false); - } - - // Create and initialize the ramdom data generator with the UID (seed) - random = RandomData.getInstance(RandomData.ALG_PSEUDO_RANDOM); - random.setSeed(uid, (short) 0, UID_LENGTH); - - // Initialize the cipher with the static key - cipher.init(staticKey, Cipher.MODE_ENCRYPT); - - } - - public static void install(byte[] bArray, short bOffset, byte bLength) { - // Create a Transit applet instance - new TransitApplet(bArray, bOffset, bLength); - } - - public boolean select() { - // The applet declines to be selected - // if the PIN is blocked. - if (pin.getTriesRemaining() == 0) { - return false; - } - return true; - } - - public void deselect() { - // Reset the PIN value - pin.reset(); - if (!useTransientKey) { - sessionKey.clearKey(); - } - } - - public void process(APDU apdu) { - - // C-APDU: [CLA, INS, P1, P2, LC, ...] - - byte[] buffer = apdu.getBuffer(); - - // Dispatch C-APDU for processing - if (!apdu.isISOInterindustryCLA()) { - switch (buffer[ISO7816.OFFSET_INS]) { - case INITIALIZE_SESSION: - initializeSession(apdu); - return; - case PROCESS_REQUEST: - processRequest(apdu); - return; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } else { - if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) { - return; - } else if (buffer[ISO7816.OFFSET_INS] == VERIFY) { - verify(apdu); - } else { - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - } - - /** - * Initializes a CAD/card interaction session. This is the first step of - * mutual authentication. A new card challenge is generated and used along - * with the passed-in host challenge to generate the derivation data from - * which a new session key is derived. The card challenge is appended to the - * response message. The response message is signed using the newly - * generated session key then sent back. Note that mutual authentication is - * subsequently completed upon succesful verification of the signature of - * the first request received. - * - * @param apdu - * The APDU - */ - private void initializeSession(APDU apdu) { - - // C-APDU: [CLA, INS, P1, P2, LC, [4-bytes Host Challenge]] - - byte[] buffer = apdu.getBuffer(); - - if ((buffer[ISO7816.OFFSET_P1] != 0) - || (buffer[ISO7816.OFFSET_P2] != 0)) { - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - byte count = (byte) apdu.setIncomingAndReceive(); - - if (numBytes != CHALLENGE_LENGTH || count != CHALLENGE_LENGTH) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Generate card challenge - generateCardChallenge(); - - // Generate key derivation data from host challenge and card challenge - generateKeyDerivationData(buffer); - - // Generate session key from derivation data - generateSessionKey(); - - // R-APDU: [[4-bytes Card Challenge], [2-bytes Status Word], [8-bytes - // MAC]] - - short offset = 0; - - // Append card challenge to response message - offset = Util.arrayCopyNonAtomic(cardChallenge, (short) 0, buffer, - offset, CHALLENGE_LENGTH); - - // Append status word to response message - offset = Util.setShort(buffer, offset, SW_SUCCESS); - - // Sign response message and append MAC to response message - offset = generateMAC(buffer, offset); - - // Send R-APDU - apdu.setOutgoingAndSend((short) 0, offset); - } - - /** - * Processes an incoming request. The request message signature is verified, - * then it is dispatched to the relevant handling method. The response - * message is then signed and sent back. - * - * @param apdu - * The APDU - */ - private void processRequest(APDU apdu) { - - // C-APDU: [CLA, INS, P1, P2, LC, [Request Message], [8-bytes MAC]] - // Request Message: [T, L, [V...]] - - byte[] buffer = apdu.getBuffer(); - - if ((buffer[ISO7816.OFFSET_P1] != 0) - || (buffer[ISO7816.OFFSET_P2] != 0)) { - ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2); - } - - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - byte count = (byte) apdu.setIncomingAndReceive(); - - if (numBytes != count) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Check request message signature - if (!checkMAC(buffer)) { - ISOException.throwIt(SW_WRONG_SIGNATURE); - } - - if ((numBytes - MAC_LENGTH) != (buffer[TLV_LENGTH_OFFSET] + 2)) { - ISOException.throwIt(ISO7816.SW_WRONG_DATA); - } - - // R-APDU: [[Response Message], [2-bytes Status Word], [8-bytes MAC]] - - short offset = 0; - - // Dispatch request message for processing - switch (buffer[TLV_TAG_OFFSET]) { - case PROCESS_ENTRY: - offset = processEntry(buffer, TLV_VALUE_OFFSET, - buffer[TLV_LENGTH_OFFSET]); - break; - case PROCESS_EXIT: - offset = processExit(buffer, TLV_VALUE_OFFSET, - buffer[TLV_LENGTH_OFFSET]); - break; - case CREDIT: - offset = credit(buffer, TLV_VALUE_OFFSET, buffer[TLV_LENGTH_OFFSET]); - break; - case GET_BALANCE: - offset = getBalance(buffer, TLV_VALUE_OFFSET, - buffer[TLV_LENGTH_OFFSET]); - break; - default: - ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - - // Append status word to response message - offset = Util.setShort(buffer, offset, SW_SUCCESS); - - // Sign response message and append MAC to response message - offset = generateMAC(buffer, offset); - - // Send R-APDU - apdu.setOutgoingAndSend((short) 0, offset); - } - - /** - * Verifies the PIN. - * - * @param apdu - * The APDU - */ - private void verify(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - byte count = (byte) apdu.setIncomingAndReceive(); - - if (numBytes != count) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Verify PIN - if (pin.check(buffer, ISO7816.OFFSET_CDATA, numBytes) == false) { - ISOException.throwIt(SW_VERIFICATION_FAILED); - } - } - - /** - * Generates a new random card challenge. - * - */ - private void generateCardChallenge() { - // Generate random card challenge - random.generateData(cardChallenge, (short) 0, CHALLENGE_LENGTH); - } - - /** - * Generates the session key derivation data from the passed-in host - * challenge and the card challenge. - * - * @param buffer - * The APDU buffer - */ - private void generateKeyDerivationData(byte[] buffer) { - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - if (numBytes < CHALLENGE_LENGTH) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Derivation data: [[8-bytes host challenge], [8-bytes card challenge]] - - // Append host challenge (from buffer) to derivation data - Util.arrayCopy(buffer, ISO7816.OFFSET_CDATA, keyDerivationData, - (short) 0, CHALLENGE_LENGTH); - // Append card challenge to derivation data - Util.arrayCopy(cardChallenge, (short) 0, keyDerivationData, - CHALLENGE_LENGTH, CHALLENGE_LENGTH); - } - - /** - * Generates a new DES session key from the derivation data. - * - */ - private void generateSessionKey() { - cipher.doFinal(keyDerivationData, (short) 0, (short) keyDerivationData.length, - sessionKeyData, (short) 0); - // Generate new session key from encrypted derivation data - sessionKey.setKey(fixParity(sessionKeyData, (short) 0, (short) sessionKeyData.length /*LENGTH_DES_BYTE*/), (short) 0); - } - - /** - * Checks the request message signature. - * - * @param buffer - * The APDU buffer - * @return true if the message signature is correct; false otherwise - */ - private boolean checkMAC(byte[] buffer) { - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - if (numBytes <= MAC_LENGTH) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Initialize signature with current session key for verification - signature.init(sessionKey, Signature.MODE_VERIFY); - // Verify request message signature - return signature.verify(buffer, ISO7816.OFFSET_CDATA, - (short) (numBytes - MAC_LENGTH), buffer, - (short) (ISO7816.OFFSET_CDATA + numBytes - MAC_LENGTH), - MAC_LENGTH); - } - - /** - * Generates the response message MAC: generates the MAC and appends the MAC - * to the response message. - * - * @param buffer - * The APDU buffer - * @param offset - * The offset of the MAC in the buffer - * @return The resulting length of the response message - */ - private short generateMAC(byte[] buffer, short offset) { - // Initialize signature with current session key for signing - signature.init(sessionKey, Signature.MODE_SIGN); - // Sign response message and append the MAC to the response message - short sigLength = signature.sign(buffer, (short) 0, offset, buffer, - offset); - return (short) (offset + sigLength); - } - - /** - * Processes a transit entry event. The passed-in entry station ID is - * recorded and the correlation ID is incremented. The UID and the - * correlation ID are returned in the response message. - * - * Request Message: [2-bytes Entry Station ID] - * - * Response Message: [[2-bytes UID], [2-bytes Correlation ID]] - * - * @param buffer - * The APDU buffer - * @param messageOffset - * The offset of the request message content in the APDU buffer - * @param messageLength - * The length of the request message content. - * @return The offset at which content can be appended to the response - * message - */ - private short processEntry(byte[] buffer, short messageOffset, - short messageLength) { - - // Request Message: [2-bytes Entry Station ID] - - if (messageLength != 2) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Check minimum balance - if (balance < MIN_TRANSIT_BALANCE) { - ISOException.throwIt(SW_MIN_TRANSIT_BALANCE); - } - - // Check consistent transit state: should not currently be in transit - if (entryStationId >= 0) { - ISOException.throwIt(SW_INVALID_TRANSIT_STATE); - } - - JCSystem.beginTransaction(); - - // Get/assign entry station ID from request message - entryStationId = Util.getShort(buffer, messageOffset); - - // Increment correlation ID - correlationId++; - - JCSystem.commitTransaction(); - - // Response Message: [[8-bytes UID], [2-bytes Correlation ID]] - - short offset = 0; - - // Append UID to response message - offset = Util.arrayCopy(uid, (short) 0, buffer, offset, UID_LENGTH); - - // Append correlation ID to response message - offset = Util.setShort(buffer, offset, correlationId); - - return offset; - } - - /** - * Processes a transit exit event. The passed-in transit fee is debited from - * the account. The UID and the correlation ID are returned in the response - * message. - * - * Request Message: [1-byte Transit Fee] - * - * Response Message: [[2-bytes UID], [2-bytes Correlation ID]] - * - * @param buffer - * The APDU buffer - * @param messageOffset - * The offset of the request message content in the APDU buffer - * @param messageLength - * The length of the request message content. - * @return The offset at which content can be appended to the response - * message - */ - private short processExit(byte[] buffer, short messageOffset, - short messageLength) { - - // Request Message: [1-byte Transit Fee] - - if (messageLength != 1) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Check minimum balance - if (balance < MIN_TRANSIT_BALANCE) { - ISOException.throwIt(SW_MIN_TRANSIT_BALANCE); - } - - // Check consistent transit state: should be currently in transit - if (entryStationId < 0) { - ISOException.throwIt(SW_INVALID_TRANSIT_STATE); - } - - // Get transit fee from request message - byte transitFee = buffer[messageOffset]; - - // Check potential negative balance - if (balance < transitFee) { - ISOException.throwIt(SW_NEGATIVE_BALANCE); - } - - JCSystem.beginTransaction(); - - // Debit transit fee - balance -= transitFee; - - // Reset entry station ID - entryStationId = -1; - - JCSystem.commitTransaction(); - - // Response Message: [[8-bytes UID], [2-bytes Correlation ID]] - - short offset = 0; - - // Append UID to response message - offset = Util.arrayCopy(uid, (short) 0, buffer, offset, UID_LENGTH); - - // Append correlation ID to response message - offset = Util.setShort(buffer, offset, correlationId); - - return offset; - } - - /** - * Credits the account of the passed-in amount. - * - * Request Message: [1-byte Credit Amount] - * - * Response Message: [] - * - * @param buffer - * The APDU buffer - * @param messageOffset - * The offset of the request message content in the APDU buffer - * @param messageLength - * The length of the request message content. - * @return The offset at which content can be appended to the response - * message - */ - private short credit(byte[] buffer, short messageOffset, short messageLength) { - - // Check access authorization - if (!pin.isValidated()) { - ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED); - } - - // Request Message: [1-byte Credit Amount] - - if (messageLength != 1) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Get credit amount from request message - byte creditAmount = buffer[messageOffset]; - - // Check credit amount - if ((creditAmount > MAX_CREDIT_AMOUNT) || (creditAmount < 0)) { - ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT); - } - - // Check the new balance - if ((short) (balance + creditAmount) > MAX_BALANCE) { - ISOException.throwIt(SW_EXCEED_MAXIMUM_BALANCE); - } - - // Credit the amount - balance += creditAmount; - - // Response Message: [] - - return 0; - } - - /** - * Gets/returns the balance. - * - * Request Message: [] - * - * Response Message: [2-bytes Balance] - * - * @param buffer - * The APDU buffer - * @param messageOffset - * The offset of the request message content in the APDU buffer - * @param messageLength - * The length of the request message content. - * @return The offset at which content can be appended to the response - * message - */ - private short getBalance(byte[] buffer, short messageOffset, - short messageLength) { - - // Check access authorization - if (!pin.isValidated()) { - ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED); - } - - // Request Message: [] - - if (messageLength != 0) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Response Message: [2-bytes Balance] - - short offset = 0; - - // Append balance to response message - offset = Util.setShort(buffer, offset, balance); - - return offset; - } - - /** - * Fixes the parity on DES key data. - * - * @param buffer - * The buffer containing the DES key data - * @param offset - * The offset of the DES key data in the buffer - * @param messageLength - * The length of the DES key data - * @return The passed-in buffer with the DES key data parity fixed - */ - private byte[] fixParity(byte[] buffer, short offset, short length) { - for (byte i = 0; i < length; i++) { - short parity = 0; - buffer[(short) (offset + i)] &= 0xFE; - for (byte j = 1; j < 8; j++) { - if ((buffer[(short) (offset + i)] & (byte) (1 << j)) != 0) { - parity++; - } - } - if ((parity % 2) == 0) { - buffer[(short) (offset + i)] |= 1; - } - } - return buffer; - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.opt deleted file mode 100644 index dc3f8a9c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/transit/TransitApplet.opt +++ /dev/null @@ -1,6 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xD:0x1 com.sun.javacard.samples.transit.TransitApplet -com.sun.javacard.samples.transit -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0xD 1.0 - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/BrokerApplet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/BrokerApplet.java deleted file mode 100644 index 787101b9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/BrokerApplet.java +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - - -package com.sun.javacard.samples.utilitydemo; - -import javacard.framework.*; -import javacardx.framework.math.*; -import javacardx.framework.tlv.*; -import javacardx.framework.util.intx.JCint; - -/** - * This class demonstrates usage of new Utility APIs including APIs for TLV - * integer manipulation and big number math API - */ -public class BrokerApplet extends Applet{ - /** - * Initial account balance - */ - final static byte[] INITIAL_ACCOUNT_BALANCE = - {(byte)0x01, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00 }; - /** - * INS value for ISO 7816-4 VERIFY command - */ - final static byte VERIFY = (byte) 0x20; - - /** - * INS value to get complete portfolio - */ - final static byte GET_COMPLETE_PORTFOLIO = (byte)0x01; - - /** - * INS value to get information on a stock - */ - final static byte GET_STOCK_INFO = (byte)0x02; - - /** - * INS value to generate a stock purchase request for the broker - */ - final static byte BUY_STOCK = (byte)0x03; - - /** - * INS value to generate a sell stocks request for the broker - */ - final static byte SELL_STOCK = (byte)0x04; - - /** - * INS value to update the portfolio - */ - final static byte UPDATE_PORTFOLIO = (byte)0x05; - - /** - * INS value to get balance - */ - final static byte GET_BALANCE = (byte)0x06; - - /** - * Length of a stock symbol - */ - final static byte STOCK_SYMBOL_LENGTH = (byte)5; - - /** - * Maximum number of incorrect tries before the PIN is blocked - */ - final static byte MAX_PIN_TRIES = (byte) 0x03; - - /** - * Maximum PIN size - */ - final static byte MAX_PIN_SIZE = (byte) 0x08; - - /** - * SW bytes for PIN verification failure - */ - final static short SW_VERIFICATION_FAILED = 0x6300; - - /** - * SW bytes for No stock info found - */ - final static short SW_STOCK_NOT_FOUND = 0x6301; - - /** - * SW bytes for Not enough account balance - */ - final static short SW_NOT_ENOUGH_ACCOUNT_BALANCE = 0x6302; - - /** - * SW bytes for not enough stocks to sell - */ - final static short SW_NOT_ENOUGH_STOCKS_TO_SELL = 0x6303; - - /** - * SW bytes for malformed broker confirmation - */ - final static short INVALID_BROKER_CONFIRMATION = 0x6304; - - /** - * SW bytes for invalid broker signature - */ - final static short INVALID_BROKER_SIGNATURE = 0x6305; - - /** - * SW bytes for TLV Exception - */ - final static short TLV_EXCEPTION = 0x6306; - - /** - * SW bytes for Arithmetic exception - */ - final static short ARITHMETIC_EXCEPTION = 0x6307; - - /** - * SW bytes for Arithmetic exception - */ - final static short INVALID_NUMBER_FORMAT = 0x6308; - - /** - * The user PIN - */ - private OwnerPIN pin; - - /** - * Amount of money in user's account - */ - private BigNumber accountBalance; - - /** - * This constructed BER TLV holds the portfolio - */ - private ConstructedBERTLV portfolio; - - /** - * dummy broker signature - */ - private static final byte[] dummySignature = {(byte)0x88, (byte)0x88, - (byte)0x88, (byte)0x88, - (byte)0x88, (byte)0x88, - (byte)0x88, (byte)0x88}; - - /** - * constructed BER TLV Tag for portfolio - */ - ConstructedBERTag portfolioTag; - - /** - * constructed BER TLV Tag stock informaiton - */ - ConstructedBERTag stockInfoTag; - - /** - * constructed BER TLV Tag for sell stock request for broker - */ - ConstructedBERTag sellStockReqTag; - - /** - * constructed BER TLV Tag for stock purchase request for broker - */ - ConstructedBERTag buyStockReqTag; - - /** - * constructed BER TLV Tag for stock purchase confirmation from broker - */ - ConstructedBERTag purchaseConfirmTag; - - /** - * constructed BER TLV Tag for sell stock confirmation from broker - */ - ConstructedBERTag sellConfirmTag; - - /** - * constructed BER TLV Tag for last trade information - */ - ConstructedBERTag lastTradeTag; - - /** - * Primitive BER TLV Tag for number of stocks - */ - PrimitiveBERTag numStocksTag; - /** - * Primitive BER TLV Tag for price information - */ - PrimitiveBERTag priceTag; - /** - * Primitive BER TLV Tag for stock symbol information - */ - PrimitiveBERTag symbolTag; - /** - * Primitive BER TLV Tag for broker signature - */ - PrimitiveBERTag signatureTag; - - /** - * Big number for temporary calculations - */ - BigNumber tempBigNum; - - /** - * temporary buffer used as scratch space - */ - byte[] scratchSpace; - - /** - * The constructor - * @param bArray input array - * @param bOffset is the offset in input array - * @param bLength input array length - */ - BrokerApplet(byte[] bArray, short bOffset, byte bLength) { - byte aidLen = bArray[bOffset]; // aid length - if (aidLen == (byte) 0) { - register(); - } else { - register(bArray, (short) (bOffset + 1), aidLen); - } - - // Ignore control info - bOffset = (short) (bOffset + aidLen + 1); - byte infoLen = bArray[bOffset]; // control info length - bOffset = (short) (bOffset + infoLen + 1); - - byte paramLen = bArray[bOffset++]; // applet parameters length - - // Retrieve PIN initialization value from installation parameters - - if (paramLen > MAX_PIN_SIZE) { - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - } - - // Retrieve the PIN - pin = new OwnerPIN(MAX_PIN_TRIES, MAX_PIN_SIZE); - pin.update(bArray, bOffset, (byte)(paramLen)); - - // initialize account balance to 100,000.00 - accountBalance = new BigNumber((byte)8); - accountBalance.init(INITIAL_ACCOUNT_BALANCE, (byte)0, - (byte)INITIAL_ACCOUNT_BALANCE.length, BigNumber.FORMAT_BCD); - - // initialize the temporary big number - tempBigNum = new BigNumber(BigNumber.getMaxBytesSupported()); - - // initialize primitive tags - initPrimitiveTags(); - - // initialize constructed tags - initConstructedTags(); - - // initialize the scratchSpace - scratchSpace = JCSystem.makeTransientByteArray((short)10, - JCSystem.CLEAR_ON_DESELECT); - - // create an empty portfolio - portfolioTag.toBytes(scratchSpace, (short)0); - portfolio = (ConstructedBERTLV)BERTLV.getInstance(scratchSpace, - (short)0, (short)2); - } - - /** - * Initialize the constructed tags - */ - private void initConstructedTags(){ - portfolioTag = new ConstructedBERTag(); - stockInfoTag = new ConstructedBERTag(); - sellStockReqTag = new ConstructedBERTag(); - buyStockReqTag = new ConstructedBERTag(); - purchaseConfirmTag = new ConstructedBERTag(); - sellConfirmTag = new ConstructedBERTag(); - lastTradeTag = new ConstructedBERTag(); - - portfolioTag.init((byte)3, (short)1); - stockInfoTag.init((byte)3, (short)2); - sellStockReqTag.init((byte)3, (short)3); - buyStockReqTag.init((byte)3, (short)4); - sellConfirmTag.init((byte)3, (short)5); - purchaseConfirmTag.init((byte)3, (short)6); - lastTradeTag.init((byte)3, (short)7); - } - - /** - * Initialize the primitive tags - */ - private void initPrimitiveTags(){ - symbolTag = new PrimitiveBERTag(); - numStocksTag = new PrimitiveBERTag(); - priceTag = new PrimitiveBERTag(); - signatureTag = new PrimitiveBERTag(); - - symbolTag.init((byte)3, (short)8); - numStocksTag.init((byte)3, (short)9); - priceTag.init((byte)3, (short)10); - signatureTag.init((byte)3, (short)11); - } - - /** - * Installs this applet. - * @see APDU - * @param apdu the incoming APDU containing the INSTALL command. - * @exception ISOException with the response bytes per ISO 7816-4 - */ - public static void install( byte[] bArray, short bOffset, byte bLength ){ - new BrokerApplet(bArray, bOffset, bLength); - } - - /** - * Select method - */ - public boolean select() { - // The applet declines to be selected - // if the PIN is blocked. - if (pin.getTriesRemaining() == 0) { - return false; - } - return true; - } - - /** - * deselect method - */ - public void deselect() { - // Reset the PIN value - pin.reset(); - } - - /** - * Process method - */ - public void process(APDU apdu) throws ISOException { - // get the APDU buffer - byte buffer[] = apdu.getBuffer(); - - // return if this APDU is for applet selection - if(selectingApplet())return; - - // mask the channel information - buffer[ISO7816.OFFSET_CLA] = - (byte) (buffer[ISO7816.OFFSET_CLA] & (byte) 0xFC); - - // get the data part of the APDU if this is not getPortfolio command or - // get balance command - if(buffer[ISO7816.OFFSET_INS] != GET_COMPLETE_PORTFOLIO && - buffer[ISO7816.OFFSET_INS] != GET_BALANCE) - apdu.setIncomingAndReceive(); - - // pin verification command - if (buffer[ISO7816.OFFSET_CLA] == ISO7816.CLA_ISO7816) { - if (buffer[ISO7816.OFFSET_INS] == VERIFY) { - verify(buffer); - return; - } else { - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - } - - // if PIN is not already verified throw exception - if(!pin.isValidated()){ - ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); - } - - short responseSize = 0; - try{ - switch(buffer[ISO7816.OFFSET_INS]){ - case GET_COMPLETE_PORTFOLIO: - responseSize = getPortfolio(buffer); - break; - case GET_STOCK_INFO: - responseSize = getStockInfo(buffer); - break; - case BUY_STOCK: - responseSize = genStockPurchaseRequest(buffer); - break; - case SELL_STOCK: - responseSize = genSellStockRequest(buffer); - break; - case UPDATE_PORTFOLIO: - updatePortfolio(buffer); - return; - case GET_BALANCE: - responseSize = getBalance(buffer); - break; - default: ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED); - } - }catch(TLVException e){ - ISOException.throwIt(TLV_EXCEPTION); - }catch(ArithmeticException e){ - ISOException.throwIt(ARITHMETIC_EXCEPTION); - } - - // send the response data back - apdu.setOutgoingAndSend((short)0, (byte)responseSize); - - } - - /** - * Verifies the PIN. - * - * @param buffer The APDU buffer - */ - private void verify(byte[] buffer) { - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - // Verify PIN - if (pin.check(buffer, ISO7816.OFFSET_CDATA, numBytes) == false) { - ISOException.throwIt(SW_VERIFICATION_FAILED); - } - } - - /** - * Return following information on all the stocks - * - Primitive TLV for stock symbol - * - Primitive TLV for number of stocks we currently have - * - Constructed TLV for last trade containing following - * - Primitive TLV for number of stocks - * - Primitive TLV for price - * @param buffer is the input APDU buffer - * @return size of response data - */ - private short getPortfolio(byte[] buffer){ - try{ - return portfolio.toBytes(buffer, (short)0); - }catch(TLVException e){ - if(e.getReason() == TLVException.EMPTY_TLV) - ISOException.throwIt(SW_STOCK_NOT_FOUND); - } - return 0; - } - - /** - * Returns stock information - * Input: 5 bytes representing stock symbol - * Output: Constructed BER TLV containing the following: - * - Primitive TLV for stock symbol - * - Primitive TLV for number of stocks we currently have - * - Constructed TLV for last trade containing following - * - Primitive TLV for number of stocks - * - Primitive TLV for price - * @param buffer is the input APDU buffer - * @return size of response data - */ - private short getStockInfo(byte[] buffer){ - // Find the stock in the portfolio - ConstructedBERTLV stockInfo = findStock(buffer, ISO7816.OFFSET_CDATA); - if(stockInfo == null)ISOException.throwIt(SW_STOCK_NOT_FOUND); - return stockInfo.toBytes(buffer, (short)0); - } - - /** - * Finds a stock that matches the stock symbol - * @param buffer is the byte array containing the stock symbol - * @param offset is the offset in the byte array for stock symbol - * @return ConstructedBERTLV for the stock information if stock - * is found. If the stock is not found ISOException is thrown - */ - private ConstructedBERTLV findStock(byte[] buffer, short offset){ - // We go through all the stocks that we have to find the - // one we're looking for - ConstructedBERTLV stockInfo = - (ConstructedBERTLV)portfolio.find(stockInfoTag); - - while(stockInfo != null){ - PrimitiveBERTLV symbol = (PrimitiveBERTLV)stockInfo.find(symbolTag); - symbol.getValue(scratchSpace, (short)0); - if(Util.arrayCompare(buffer, offset, scratchSpace, - (short)0, STOCK_SYMBOL_LENGTH) == 0){ - return stockInfo; - } - stockInfo = - (ConstructedBERTLV)portfolio.findNext(stockInfoTag, stockInfo, (short)1); - } - return null; - } - - /** - * Return current balance - * @param buffer is the input APDU buffer - * @return size of response data - */ - private short getBalance(byte[] buffer){ - if(buffer[ISO7816.OFFSET_P1] == BigNumber.FORMAT_BCD) - accountBalance.toBytes(buffer, (short)0, - (short)8, BigNumber.FORMAT_BCD); - else if (buffer[ISO7816.OFFSET_P1] == BigNumber.FORMAT_HEX) - accountBalance.toBytes(buffer, (short)0, - (short)8, BigNumber.FORMAT_HEX); - else - ISOException.throwIt(INVALID_NUMBER_FORMAT); - return (short)8; - } - - - /** - * Performs the following steps to assist in buying a stock - * - Check available funds - * - Create a "signed" request for the broker - * @param buffer is the input APDU buffer - * @return size of response data - */ - private byte genStockPurchaseRequest(byte[] buffer){ - short offset = ISO7816.OFFSET_CDATA; - // first 5 bytes contain the stock symbol with each byte represnting - // an ASCII value - offset += (short)5; - - // Now get the number of stocks we want to buy. - int numStocksToBuy = JCint.getInt(buffer, offset); - offset += (short)4; - - // get the desired buy price - short priceToBuyAt = Util.getShort(buffer, offset); - offset += (short)2; - - // verify that we have enough balance available - verifyBalanceAvailability(buffer); - - // Generate the request. The request is a constructed BER TLV with - // following elements: - // - Stock symbol - // - desired price - // - number of stocks to buy - - // output the broker request tag and length - offset = buyStockReqTag.toBytes(buffer, (short)0); - buffer[offset++] = (byte)0; - - // output the stock symbol TLV - offset = symbolTag.toBytes(scratchSpace, (short)0); - scratchSpace[offset++] = STOCK_SYMBOL_LENGTH; - offset = Util.arrayCopyNonAtomic(buffer, ISO7816.OFFSET_CDATA, - scratchSpace, offset, STOCK_SYMBOL_LENGTH); - ConstructedBERTLV.append(scratchSpace, (short)0, buffer, (short)0); - completeBrokerRequest(buffer, priceToBuyAt, numStocksToBuy); - return (byte)(buffer[1] + 2); // total length of TLV - } - - /** - * Verifies that we have enough balance available to buy a stock - * @param buffer is the input buffer containing the number of stocks - * we want to buy and the price of the stock - */ - void verifyBalanceAvailability(byte[] buffer){ - try{ - short offset = ISO7816.OFFSET_CDATA + (short)5; - // check if we have enough balance available to buy this stock - // initialize the number with number of stocks to buy - tempBigNum.init(buffer, offset, (short)4, BigNumber.FORMAT_HEX); - offset += (short)4; - //multiply this number by desired stock price - tempBigNum.multiply(buffer, offset, (short)2, BigNumber.FORMAT_HEX); - - // now we compare this number against the current available balance - // to determine if we have enough funds available. - if(accountBalance.compareTo(tempBigNum) < (byte)0){ - ISOException.throwIt(SW_NOT_ENOUGH_ACCOUNT_BALANCE); - } - }catch(ArithmeticException e){ - ISOException.throwIt(SW_NOT_ENOUGH_ACCOUNT_BALANCE); - } - } - - /** - * Returns stock a sell stock request to the client if we hold - * enough stocks. - * Input: Stock symbol, the number of stocks to sell and desired price - * Output: Constructed BER TLV containing the following: - * - Primitive TLV for stock symbol - * - Primitive TLV for desired stock price - * - Primitive TLV for number of stocks to sell - * - Primitive TLV for signature - * @param buffer is the input APDU buffer - * @return size of response data - */ - private byte genSellStockRequest(byte[] buffer){ - short offset = ISO7816.OFFSET_CDATA; - - // check to see if we actually have this stock - ConstructedBERTLV stockInfo = findStock(buffer, offset); - if(stockInfo == null) ISOException.throwIt(SW_STOCK_NOT_FOUND); - - offset += STOCK_SYMBOL_LENGTH; - - // Now get the number of stocks we want to sell. - int numStocksToSell = JCint.getInt(buffer, offset); - offset += (short)4; - - // get the desired sell price - short priceToSellAt = Util.getShort(buffer, offset); - offset += (short)2; - - // now within this constructed BER TLV, we need to find the Primitive - // TLV that has the number of stocks we currently hold - PrimitiveBERTLV numStocksTLV = - (PrimitiveBERTLV)stockInfo.find(numStocksTag); - // use the buffer as scratch space since we have already - // taken out the values that we wanted to take out. - numStocksTLV.getValue(buffer, (short)0); - // we already know that this is a 4 byte integer value - // create an integer from bytes - int numCurrStock = JCint.getInt(buffer, (byte)0); - - // check that we have enough stocks that meet the - // sell request requirement - if(numCurrStock < numStocksToSell) - ISOException.throwIt(SW_NOT_ENOUGH_STOCKS_TO_SELL); - - Util.arrayFillNonAtomic(buffer, (short)0, (short)100, (byte)0); - // output the broker request tag and length - offset = sellStockReqTag.toBytes(buffer, (short)0); - buffer[offset] = 0; - - // output the stock symbol TLV - PrimitiveBERTLV stockSymbol = - (PrimitiveBERTLV)stockInfo.find(symbolTag); - - offset = stockSymbol.toBytes(scratchSpace, (short)0); - // append to sell request - ConstructedBERTLV.append(scratchSpace, (short)0, buffer, (short)0); - completeBrokerRequest(buffer, priceToSellAt, numStocksToSell); - return (byte)(buffer[1] + 1); // length of TLV - } - - /** - * This method completes the stock sell or purchase request for broker. - * In this method we add the following primitive TLVs to the broker - * request constructed TLV - * Primitive TLV for desired stock price - * Primitive TLV for number of stocks to sell - * Primitive TLV for signature - * @param buffer is the input APDU buffer - * @return size of response data - */ - private void completeBrokerRequest(byte[] buffer, - short priceToSellAt, int numStocksToSell){ - short offset = 0; - // output the desired stock price TLV - offset = priceTag.toBytes(scratchSpace, (short)0); - scratchSpace[offset++] = (byte)2; - Util.setShort(scratchSpace, offset, priceToSellAt); - ConstructedBERTLV.append(scratchSpace, (short)0, buffer, (short)0); - - // output number of stocks: Tag then length then value - offset = numStocksTag.toBytes(scratchSpace, (short)0); - scratchSpace[offset++] = (byte)4; - JCint.setInt(scratchSpace, offset, numStocksToSell); - ConstructedBERTLV.append(scratchSpace, (short)0, buffer, (short)0); - - // output the signature tag length and value - offset = signatureTag.toBytes(scratchSpace, (short)0); - scratchSpace[offset++] = (byte)8; // signature length - Util.arrayCopyNonAtomic(dummySignature, (short)0, scratchSpace, - offset, (byte)8); - ConstructedBERTLV.append(scratchSpace, (short)0, buffer, (short)0); - } - - - /** - * Verifies the signature of broker and if the signature is verified - * update the portfolio including stocks and available balance - * @param buffer is the input APDU buffer - */ - private void updatePortfolio(byte[] buffer){ - short offset = ISO7816.OFFSET_CDATA; - boolean isSellConfirmation = false; - /* - * The buffer contains the constructed BER TLV received from the - * broker. The constructed BER TLV contains the following values - * in form of primitive TLV objects - * - Stock Symbol - * - Stock Price - * - Number of stocks - * - Broker Signature (dummy signature 9999 9999 is used) - */ - // To find out if this a sell confirmation or purchase confirmation - // we match the tag against sell and purchase confirmation tags - if(!BERTag.isConstructed(buffer, offset) || - BERTag.tagClass(buffer, offset) != (byte)3) - ISOException.throwIt(INVALID_BROKER_CONFIRMATION); - // get the tag number - short confirmTagNumber = BERTag.tagNumber(buffer, offset); - if(confirmTagNumber == sellConfirmTag.tagNumber()) - isSellConfirmation = true; - else if(confirmTagNumber == purchaseConfirmTag.tagNumber()) - isSellConfirmation = false; - else - ISOException.throwIt(INVALID_BROKER_CONFIRMATION); - - // get the stock symbol TLV - symbolTag.toBytes(scratchSpace, (short)0); - short symbolTLVOffset = ConstructedBERTLV.find(buffer, offset, - scratchSpace, (short)0); - - numStocksTag.toBytes(scratchSpace, (short)0); - short numStocksTLVOffset = ConstructedBERTLV.find(buffer, offset, - scratchSpace, (short)0); - short numStocksValueOffset = PrimitiveBERTLV.getValueOffset(buffer, - numStocksTLVOffset); - // get the stock price - priceTag.toBytes(scratchSpace, (short)0); - short priceTLVOffset = ConstructedBERTLV.find(buffer, offset, - scratchSpace, (short)0); - short priceValueOffset = PrimitiveBERTLV.getValueOffset(buffer, - priceTLVOffset); - - verifyBrokerSignature(buffer, ISO7816.OFFSET_CDATA); - - // next is the stock symbol in 5 bytes. If we find already have - // the stock, we will update that TLV accordingly. If we do not - // have the stock, we'll add the new stock to portfolio - ConstructedBERTLV stockInfo = findStock(buffer, - PrimitiveBERTLV.getValueOffset(buffer, symbolTLVOffset)); - - if(stockInfo == null){ - if(isSellConfirmation){ - // we didn't have the stock that we sold!!! - ISOException.throwIt(INVALID_BROKER_CONFIRMATION); - } - // create the new constructed TLV for this stock - stockInfo = createNewStockTLV(buffer, symbolTLVOffset, - numStocksTLVOffset, priceTLVOffset); - portfolio.append(stockInfo); - updateAccountBalance(buffer, numStocksValueOffset, - priceValueOffset, isSellConfirmation); - return; - } - // update the existing stockInfoTLV - // update num stocks - PrimitiveBERTLV numStocksTLV = - (PrimitiveBERTLV)stockInfo.find(numStocksTag); - numStocksTLV.getValue(scratchSpace, (short)0); - tempBigNum.init(scratchSpace, (short)0, (byte)4, BigNumber.FORMAT_HEX); - if(!isSellConfirmation){ - tempBigNum.add(buffer, numStocksValueOffset, (short)4, - BigNumber.FORMAT_HEX); - }else{ - tempBigNum.subtract(buffer, numStocksValueOffset, (short)4, - BigNumber.FORMAT_HEX); - // if stocks now number 0, we remove this TLV - Util.arrayFillNonAtomic(scratchSpace, (short)0, (short)1, (byte)0); - if(tempBigNum.compareTo(scratchSpace, (short)0, - (short)1, BigNumber.FORMAT_HEX) == 0){ - portfolio.delete(stockInfo, (short)1); - return; - } - } - tempBigNum.toBytes(scratchSpace, (short)0, (short)4, - BigNumber.FORMAT_HEX); - numStocksTLV.replaceValue(scratchSpace, (short)0, (short)4); - - // update last trade information - ConstructedBERTLV lastTradeTLV = - (ConstructedBERTLV)stockInfo.find(lastTradeTag); - numStocksTLV = (PrimitiveBERTLV)lastTradeTLV.find(numStocksTag); - numStocksTLV.replaceValue(buffer, numStocksValueOffset, (short)4); - PrimitiveBERTLV priceTLV = (PrimitiveBERTLV)lastTradeTLV.find(priceTag); - priceTLV.replaceValue(buffer, priceValueOffset, (short)2); - - // update the account balance - updateAccountBalance(buffer, numStocksValueOffset, - priceValueOffset, isSellConfirmation); - } - - /** - * Update the account balance - * @param buffer is the input buffer - * @param numStocksOffset is the offset in the buffer where number of - * stocks information is at - * @param priceOffset is the offset in the buffer where stock price - * information is at - * @param sold is the boolean indicating the if the stock was bought or - * sold - */ - void updateAccountBalance(byte[] buffer, short numStocksOffset, - short priceOffset, boolean sold){ - tempBigNum.init(buffer, numStocksOffset, (byte)4, BigNumber.FORMAT_HEX); - - // get the amount for this trade - tempBigNum.multiply(buffer, priceOffset, (short)2, - BigNumber.FORMAT_HEX); - - tempBigNum.toBytes(scratchSpace, (short)0, - (short)8, BigNumber.FORMAT_HEX); - - if(sold){ - // if stock was sold, we add to the balance - accountBalance.add(scratchSpace, (short)0, - (short)8, BigNumber.FORMAT_HEX); - }else{ - // if stock was bought we subtract the amount - // from balance - accountBalance.subtract(scratchSpace, (short)0, - (short)8, BigNumber.FORMAT_HEX); - } - } - - /** - * Verify the broker signature. This method throws an exception if the - * broker signature is invalid - * @param buffer is the input APDU buffer - * @param TLVOffset is the offset within the buffer where the TLV for - * the broker signature starts - */ - void verifyBrokerSignature(byte[] buffer, short TLVOffset){ - // get the stock price - signatureTag.toBytes(scratchSpace, (short)0); - short sigTLVOffset = ConstructedBERTLV.find(buffer, TLVOffset, - scratchSpace, (short)0); - short sigValueOffset = PrimitiveBERTLV.getValueOffset(buffer, - sigTLVOffset); - if(Util.arrayCompare(buffer, sigValueOffset, dummySignature, - (short)0, (byte)dummySignature.length) != 0){ - ISOException.throwIt(INVALID_BROKER_SIGNATURE); - } - } - - /** - * As a rsult of a stock that is bought, we create a new - * TLV to hold the information regarding the newly bought stock - * @param buffer contains the new stock information - * @param symbolOffset is the offset within buffer where the new - * stock symbol is present - * @param numOffset is the offset within the buffer where the - * information regarding number of stocks is at - * @param priceOffset is the offset within the buffer where the - * information regarding price at which the stock was bought is at - * @return newly created constructed BERTLV object that is eventually - * added to the portfolio. - */ - private ConstructedBERTLV createNewStockTLV(byte buffer[], - short symbolOffset, short numOffset, short priceOffset){ - // this TLV contains the following - // - Primitive TLV for stock symbol - // - Primitive TLV for number of stocks we currently have - // - Constructed TLV for last trade containing following - // - Primitive TLV for number of stocks - // - Primitive TLV for price - Util.arrayFillNonAtomic(scratchSpace, (short)0, - (short)scratchSpace.length, (byte)0); - short offset = stockInfoTag.toBytes(scratchSpace, (short)0); - // length is 0 which is already set in so don't need to modify - ConstructedBERTLV stockInfo = (ConstructedBERTLV)BERTLV.getInstance( - scratchSpace, (short)0, (short)2); - // create the stock symbol TLV - offset = symbolTag.toBytes(scratchSpace, (short)0); - PrimitiveBERTLV symbolTLV = (PrimitiveBERTLV)BERTLV.getInstance( - buffer, symbolOffset, (short)7); - // append to the stockInfo TLV - stockInfo.append(symbolTLV); - - // clean up the scratch space for number TLV - PrimitiveBERTLV numStocksTLV = (PrimitiveBERTLV)BERTLV.getInstance( - buffer, numOffset, (short)6); - // append to the stockInfo TLV - stockInfo.append(numStocksTLV); - - // create the last trade TLV - offset = lastTradeTag.toBytes(scratchSpace, (short)0); - scratchSpace[offset] = 0; - ConstructedBERTLV lastTradeInfo = (ConstructedBERTLV)BERTLV.getInstance( - scratchSpace, (short)0, (short)2); - - PrimitiveBERTLV LTradeNumStocksTLV = (PrimitiveBERTLV)BERTLV.getInstance( - buffer, numOffset, (short)6); - lastTradeInfo.append(LTradeNumStocksTLV); - - PrimitiveBERTLV priceTLV = (PrimitiveBERTLV)BERTLV.getInstance( - buffer, priceOffset, (short)4); - lastTradeInfo.append(priceTLV); - - // now append the last trade TLV to stockInfo TLV - stockInfo.append(lastTradeInfo); - - // this completes the stockInfo - return stockInfo; - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/utilitydemo.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/utilitydemo.opt deleted file mode 100644 index f390c6cc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/utilitydemo/utilitydemo.opt +++ /dev/null @@ -1,6 +0,0 @@ --out EXP JCA CAP --exportpath . --i --applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x10:0x01 com.sun.javacard.samples.utilitydemo.BrokerApplet -com.sun.javacard.samples.utilitydemo -0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x10 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.java deleted file mode 100644 index 81b196b5..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)Wallet.java 1.11 06/01/03 - */ - -package com.sun.javacard.samples.wallet; -import javacard.framework.*; - -public class Wallet extends Applet { - - /* constants declaration */ - - // code of CLA byte in the command APDU header - final static byte Wallet_CLA =(byte)0x80; - - // codes of INS byte in the command APDU header - final static byte VERIFY = (byte) 0x20; - final static byte CREDIT = (byte) 0x30; - final static byte DEBIT = (byte) 0x40; - final static byte GET_BALANCE = (byte) 0x50; - - // maximum balance - final static short MAX_BALANCE = 0x7FFF; - // maximum transaction amount - final static byte MAX_TRANSACTION_AMOUNT = 127; - - // maximum number of incorrect tries before the - // PIN is blocked - final static byte PIN_TRY_LIMIT =(byte)0x03; - // maximum size PIN - final static byte MAX_PIN_SIZE =(byte)0x08; - - // signal that the PIN verification failed - final static short SW_VERIFICATION_FAILED = - 0x6300; - // signal the the PIN validation is required - // for a credit or a debit transaction - final static short SW_PIN_VERIFICATION_REQUIRED = - 0x6301; - // signal invalid transaction amount - // amount > MAX_TRANSACTION_AMOUNT or amount < 0 - final static short SW_INVALID_TRANSACTION_AMOUNT = 0x6A83; - - // signal that the balance exceed the maximum - final static short SW_EXCEED_MAXIMUM_BALANCE = 0x6A84; - // signal the the balance becomes negative - final static short SW_NEGATIVE_BALANCE = 0x6A85; - - /* instance variables declaration */ - OwnerPIN pin; - short balance; - - private Wallet (byte[] bArray,short bOffset,byte bLength) { - - // It is good programming practice to allocate - // all the memory that an applet needs during - // its lifetime inside the constructor - pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE); - - byte iLen = bArray[bOffset]; // aid length - bOffset = (short) (bOffset+iLen+1); - byte cLen = bArray[bOffset]; // info length - bOffset = (short) (bOffset+cLen+1); - byte aLen = bArray[bOffset]; // applet data length - - // The installation parameters contain the PIN - // initialization value - pin.update(bArray, (short)(bOffset+1), aLen); - register(); - - } // end of the constructor - - public static void install(byte[] bArray, short bOffset, byte bLength) { - // create a Wallet applet instance - new Wallet(bArray, bOffset, bLength); - } // end of install method - - public boolean select() { - - // The applet declines to be selected - // if the pin is blocked. - if ( pin.getTriesRemaining() == 0 ) - return false; - - return true; - - }// end of select method - - public void deselect() { - - // reset the pin value - pin.reset(); - - } - - public void process(APDU apdu) { - - // APDU object carries a byte array (buffer) to - // transfer incoming and outgoing APDU header - // and data bytes between card and CAD - - // At this point, only the first header bytes - // [CLA, INS, P1, P2, P3] are available in - // the APDU buffer. - // The interface javacard.framework.ISO7816 - // declares constants to denote the offset of - // these bytes in the APDU buffer - - byte[] buffer = apdu.getBuffer(); - // check SELECT APDU command - - if (apdu.isISOInterindustryCLA()) { - if (buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) { - return; - } else { - ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED); - } - } - - // verify the reset of commands have the - // correct CLA byte, which specifies the - // command structure - if (buffer[ISO7816.OFFSET_CLA] != Wallet_CLA) - ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); - - switch (buffer[ISO7816.OFFSET_INS]) { - case GET_BALANCE: - getBalance(apdu); - return; - case DEBIT: - debit(apdu); - return; - case CREDIT: - credit(apdu); - return; - case VERIFY: - verify(apdu); - return; - default: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - - } // end of process method - - private void credit(APDU apdu) { - - // access authentication - if ( ! pin.isValidated() ) - ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED); - - byte[] buffer = apdu.getBuffer(); - - // Lc byte denotes the number of bytes in the - // data field of the command APDU - byte numBytes = buffer[ISO7816.OFFSET_LC]; - - // indicate that this APDU has incoming data - // and receive data starting from the offset - // ISO7816.OFFSET_CDATA following the 5 header - // bytes. - byte byteRead = - (byte)(apdu.setIncomingAndReceive()); - - // it is an error if the number of data bytes - // read does not match the number in Lc byte - if ( ( numBytes != 1 ) || (byteRead != 1) ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - // get the credit amount - byte creditAmount = buffer[ISO7816.OFFSET_CDATA]; - - // check the credit amount - if ( ( creditAmount > MAX_TRANSACTION_AMOUNT) - || ( creditAmount < 0 ) ) - ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT); - - // check the new balance - if ( (short)( balance + creditAmount) > MAX_BALANCE ) - ISOException.throwIt(SW_EXCEED_MAXIMUM_BALANCE); - - // credit the amount - balance = (short)(balance + creditAmount); - - } // end of deposit method - - private void debit(APDU apdu) { - - // access authentication - if ( ! pin.isValidated() ) - ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED); - - byte[] buffer = apdu.getBuffer(); - - byte numBytes = - (byte)(buffer[ISO7816.OFFSET_LC]); - - byte byteRead = - (byte)(apdu.setIncomingAndReceive()); - - if ( ( numBytes != 1 ) || (byteRead != 1) ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - // get debit amount - byte debitAmount = buffer[ISO7816.OFFSET_CDATA]; - - // check debit amount - if ( ( debitAmount > MAX_TRANSACTION_AMOUNT) - || ( debitAmount < 0 ) ) - ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT); - - // check the new balance - if ( (short)( balance - debitAmount ) < (short)0 ) - ISOException.throwIt(SW_NEGATIVE_BALANCE); - - balance = (short) (balance - debitAmount); - - } // end of debit method - - private void getBalance(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - - // inform system that the applet has finished - // processing the command and the system should - // now prepare to construct a response APDU - // which contains data field - short le = apdu.setOutgoing(); - - if ( le < 2 ) - ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); - - //informs the CAD the actual number of bytes - //returned - apdu.setOutgoingLength((byte)2); - - // move the balance data into the APDU buffer - // starting at the offset 0 - buffer[0] = (byte)(balance >> 8); - buffer[1] = (byte)(balance & 0xFF); - - // send the 2-byte balance at the offset - // 0 in the apdu buffer - apdu.sendBytes((short)0, (short)2); - - } // end of getBalance method - - private void verify(APDU apdu) { - - byte[] buffer = apdu.getBuffer(); - // retrieve the PIN data for validation. - byte byteRead = (byte)(apdu.setIncomingAndReceive()); - - // check pin - // the PIN data is read into the APDU buffer - // at the offset ISO7816.OFFSET_CDATA - // the PIN data length = byteRead - if ( pin.check(buffer, ISO7816.OFFSET_CDATA, - byteRead) == false ) - ISOException.throwIt(SW_VERIFICATION_FAILED); - - } // end of validate method -} // end of class Wallet - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.opt b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.opt deleted file mode 100644 index 984f6ae4..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/com/sun/javacard/samples/wallet/Wallet.opt +++ /dev/null @@ -1,5 +0,0 @@ --out EXP JCA CAP --exportpath . --applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x6:0x1 com.sun.javacard.samples.wallet.Wallet -com.sun.javacard.samples.wallet -0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x6 1.0 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioApplet.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioApplet.scr deleted file mode 100644 index 7800cae4..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioApplet.scr +++ /dev/null @@ -1,59 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x1F 0x00 0x4E 0x00 0x10 0x00 0xC8 0x00 0x18 0x00 0x1F 0x00 0x00 0x00 0xA0 0x00 0x02 0x00 0x01 0x00 0x0B 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x02 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x02 0x01 0x00 0x3C 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x13 0x06 0x00 0x10 0x00 0x80 0x03 0x01 0x00 0x01 0x07 0x03 0x00 0x00 0x00 0x4A 0x00 0x7D 0x00 0xA2 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xC8 0x00 0x04 0x42 0x18 0x8C 0x00 0x07 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x01 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x02 0x7B 0x00 0x03 0x03 0x7B 0x00 0x03 0x92 0x5B 0x8D 0x00 0x04 0x28 0x05 0x18 0x15 0x05 0x03 0x8D 0x00 0x05 0x94 0x00 0x00 0x06 0x87 0x00 0x7A 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x30 0x8F 0x00 0x08 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x09 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0A 0x2D 0x18 0x8B 0x00 0x0B 0x60 0x03 0x7A 0x1A 0x04 0x25 0x75 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1B 0x00 0x02 0x00 0x10 0x00 0x0D 0x00 0x11 0x00 0x14 0x18 0x19 0x8B 0x00 0x0C 0x70 0x0F 0x18 0x19 0x8B 0x00 0x0D 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x0E 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x22 0x19 0x8B 0x00 0x0A 0x2D 0xAD 0x00 0x03 0x1A 0x03 0x1A 0x92 0x8E 0x05 0x00 0x06 0x02 0x32 0x19 0x8B 0x00 0x0F 0x3B 0x19 0x1F 0x8B 0x00 0x10 0x19 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x8B 0x00 0x11 0x7A 0x04 0x23 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x12 0x32 0xAD 0x00 0x1A 0x08 0x1F 0x8E 0x04 0x00 0x06 0x07 0x29 0x04 0x16 0x04 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x0B 0x40 0x00 0x6D 0x08 0x11 0x91 0x01 0x8D 0x00 0x0E 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x1B 0x08 0x00 0x18 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x4E 0x00 0x13 0x02 0x00 0x00 0x00 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x06 0x80 0x08 0x04 0x01 0x81 0x02 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x80 0x03 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x03 0x00 0x00 0x09 0x06 0x80 0x07 0x7F; -0x80 0xB4 0x05 0x00 0x11 0x01 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x04 0x03 0x80 0x0A 0x06 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x1F 0x00 0x03 0x3A 0x4B 0x2A 0x00 0x18 0x05 0x0D 0x0C 0x03 0x04 0x05 0x09 0x04 0x08 0x07 0x08 0x05 0x18 0x07 0x08 0x07 0x0C 0x06 0x06 0x06 0x07 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x02 0x0A 0x10 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioServer.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioServer.scr deleted file mode 100644 index c41a2994..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/_tmp/bioServer.scr +++ /dev/null @@ -1,61 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x1F 0x00 0x36 0x00 0x3F 0x00 0xE9 0x00 0x0A 0x00 0x27 0x00 0x00 0x01 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x02 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x01 0x00 0x2A 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x3F 0x43 0x80 0x03 0x01 0x00 0x01 0x05 0x0D 0x00 0x00 0x00 0x7E 0xFF 0xFF 0x00 0x38 0x00 0x60 0x00 0x82 0x00 0x8C 0x00 0x96 0x00 0xA0 0x00 0xAA 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xB4 0x00 0xC0 0x00 0xCF 0x00 0xDC 0x81 0x00 0x09 0x0A 0x09 0x0F 0x0D 0x0E 0x0B 0x0C 0x10 0x11 0x80 0x02 0x00 0x81 0x02 0x09 0x0A 0x09 0x0F 0x0D 0x0E 0x0B 0x0C 0x7F; -0x80 0xB4 0x06 0x00 0x02 0x10 0x11 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xE9 0x00 0x04 0x41 0x18 0x8C 0x00 0x04 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x01 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x02 0x18 0x10 0x1F 0x08 0x8D 0x00 0x03 0x87 0x00 0x7A 0x05 0x30 0x8F 0x00 0x05 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x06 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x2D 0x18 0x8B 0x00 0x08 0x60 0x03 0x7A 0x1A 0x04 0x25 0x75 0x00 0x10 0x00 0x01 0x00 0x10 0x00 0x09 0x18 0x19 0x8B 0x00 0x09 0x70 0x08 0x11 0x6D 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x7A 0x04 0x22 0x19 0x8B 0x00 0x07 0x2D 0x19 0x8B 0x00 0x0B 0x32 0xAD 0x00 0x1A 0x08 0x1F 0x8E 0x04 0x00 0x0C 0x09 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x01 0x30 0x18 0x77 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x01 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x00 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0C 0x05 0x7A 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x06 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x03 0x78 0x03 0x30 0xAD 0x00 0x19 0x1E 0x8E 0x03 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0C 0x04 0x78 0x05 0x50 0xAD 0x00 0x1D 0x1A 0x1F 0x16 0x04 0x8E 0x05 0x00 0x0C 0x02 0x78 0x04 0x40 0xAD 0x00 0x19 0x1E 0x1F 0x8E 0x04 0x00 0x0C 0x07 0x78 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x0C 0x40 0xAD 0x00 0x19 0x1E 0x1F 0x8E 0x04 0x00 0x0C 0x08 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x36 0x00 0x0D 0x02 0x00 0x00 0x00 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x06 0x81 0x04 0x00 0x06 0x80 0x03 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x06 0x80 0x07 0x01 0x03 0x80 0x0A 0x06 0x01 0x81 0x01 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x27 0x00 0x0C 0x28 0x45 0x0A 0x0E 0x0A 0x0A 0x0A 0x0A 0x0A 0x0C 0x0F 0x0D 0x00 0x17 0x05 0x0D 0x0C 0x07 0x08 0x07 0x08 0x05 0x14 0x08 0x07 0x05 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x0A 0x07 0x0E 0x0A 0x0A 0x0A 0x0A 0x0C 0x0F 0x0D 0x0D 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr deleted file mode 100644 index ce28327c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr +++ /dev/null @@ -1,181 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x1F 0x00 0x36 0x00 0x3F 0x00 0xE9 0x00 0x0A 0x00 0x27 0x00 0x00 0x01 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x02 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x01 0x00 0x2A 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x3F 0x43 0x80 0x03 0x01 0x00 0x01 0x05 0x0D 0x00 0x00 0x00 0x7E 0xFF 0xFF 0x00 0x38 0x00 0x60 0x00 0x82 0x00 0x8C 0x00 0x96 0x00 0xA0 0x00 0xAA 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xB4 0x00 0xC0 0x00 0xCF 0x00 0xDC 0x81 0x00 0x09 0x0A 0x09 0x0F 0x0D 0x0E 0x0B 0x0C 0x10 0x11 0x80 0x02 0x00 0x81 0x02 0x09 0x0A 0x09 0x0F 0x0D 0x0E 0x0B 0x0C 0x7F; -0x80 0xB4 0x06 0x00 0x02 0x10 0x11 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xE9 0x00 0x04 0x41 0x18 0x8C 0x00 0x04 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x01 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x02 0x18 0x10 0x1F 0x08 0x8D 0x00 0x03 0x87 0x00 0x7A 0x05 0x30 0x8F 0x00 0x05 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x06 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x2D 0x18 0x8B 0x00 0x08 0x60 0x03 0x7A 0x1A 0x04 0x25 0x75 0x00 0x10 0x00 0x01 0x00 0x10 0x00 0x09 0x18 0x19 0x8B 0x00 0x09 0x70 0x08 0x11 0x6D 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x7A 0x04 0x22 0x19 0x8B 0x00 0x07 0x2D 0x19 0x8B 0x00 0x0B 0x32 0xAD 0x00 0x1A 0x08 0x1F 0x8E 0x04 0x00 0x0C 0x09 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x01 0x30 0x18 0x77 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x01 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x00 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0C 0x05 0x7A 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x06 0x78 0x01 0x10 0xAD 0x00 0x8E 0x01 0x00 0x0C 0x03 0x78 0x03 0x30 0xAD 0x00 0x19 0x1E 0x8E 0x03 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0C 0x04 0x78 0x05 0x50 0xAD 0x00 0x1D 0x1A 0x1F 0x16 0x04 0x8E 0x05 0x00 0x0C 0x02 0x78 0x04 0x40 0xAD 0x00 0x19 0x1E 0x1F 0x8E 0x04 0x00 0x0C 0x07 0x78 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x0C 0x40 0xAD 0x00 0x19 0x1E 0x1F 0x8E 0x04 0x00 0x0C 0x08 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x36 0x00 0x0D 0x02 0x00 0x00 0x00 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x06 0x81 0x04 0x00 0x06 0x80 0x03 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x06 0x80 0x07 0x01 0x03 0x80 0x0A 0x06 0x01 0x81 0x01 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioServer/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x27 0x00 0x0C 0x28 0x45 0x0A 0x0E 0x0A 0x0A 0x0A 0x0A 0x0A 0x0C 0x0F 0x0D 0x00 0x17 0x05 0x0D 0x0C 0x07 0x08 0x07 0x08 0x05 0x14 0x08 0x07 0x05 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x0A 0x07 0x0E 0x0A 0x0A 0x0A 0x0A 0x0C 0x0F 0x0D 0x0D 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x1F 0x00 0x4E 0x00 0x10 0x00 0xC8 0x00 0x18 0x00 0x1F 0x00 0x00 0x00 0xA0 0x00 0x02 0x00 0x01 0x00 0x0B 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x02 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x02 0x01 0x00 0x3C 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x13 0x06 0x00 0x10 0x00 0x80 0x03 0x01 0x00 0x01 0x07 0x03 0x00 0x00 0x00 0x4A 0x00 0x7D 0x00 0xA2 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xC8 0x00 0x04 0x42 0x18 0x8C 0x00 0x07 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x01 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x02 0x7B 0x00 0x03 0x03 0x7B 0x00 0x03 0x92 0x5B 0x8D 0x00 0x04 0x28 0x05 0x18 0x15 0x05 0x03 0x8D 0x00 0x05 0x94 0x00 0x00 0x06 0x87 0x00 0x7A 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x30 0x8F 0x00 0x08 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x09 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0A 0x2D 0x18 0x8B 0x00 0x0B 0x60 0x03 0x7A 0x1A 0x04 0x25 0x75 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1B 0x00 0x02 0x00 0x10 0x00 0x0D 0x00 0x11 0x00 0x14 0x18 0x19 0x8B 0x00 0x0C 0x70 0x0F 0x18 0x19 0x8B 0x00 0x0D 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x0E 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x22 0x19 0x8B 0x00 0x0A 0x2D 0xAD 0x00 0x03 0x1A 0x03 0x1A 0x92 0x8E 0x05 0x00 0x06 0x02 0x32 0x19 0x8B 0x00 0x0F 0x3B 0x19 0x1F 0x8B 0x00 0x10 0x19 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x8B 0x00 0x11 0x7A 0x04 0x23 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x12 0x32 0xAD 0x00 0x1A 0x08 0x1F 0x8E 0x04 0x00 0x06 0x07 0x29 0x04 0x16 0x04 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x0B 0x40 0x00 0x6D 0x08 0x11 0x91 0x01 0x8D 0x00 0x0E 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x1B 0x08 0x00 0x18 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0F 0x01 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x4E 0x00 0x13 0x02 0x00 0x00 0x00 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x06 0x80 0x08 0x04 0x01 0x81 0x02 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x80 0x03 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x03 0x00 0x00 0x09 0x06 0x80 0x07 0x7F; -0x80 0xB4 0x05 0x00 0x11 0x01 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x04 0x03 0x80 0x0A 0x06 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/biometry/bioApplet/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x1F 0x00 0x03 0x3A 0x4B 0x2A 0x00 0x18 0x05 0x0D 0x0C 0x03 0x04 0x05 0x09 0x04 0x08 0x07 0x08 0x05 0x18 0x07 0x08 0x07 0x0C 0x06 0x06 0x06 0x07 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x02 0x0A 0x10 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -// resume printing output during functional test -output on; - -//create bioserver applet with AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 -0x80 0xB8 0x00 0x00 0x0d 0x0b 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 0x00 0x7f; - -//select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 0x7f; -//expected output 90 00 - -//send enrollment data of 20 bytes -0x80 0x10 0x00 0x00 0x14 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x7f; -//expect 90 00 - - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -//create bioApplet applet with AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 -0x80 0xB8 0x00 0x00 0x0d 0x0b 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 0x00 0x7f; - -//select bio-applet -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 0x7f; -//expected output 90 00 - -//get public template data -0x80 0x10 0x00 0x00 0x00 0x7f; -//expected output to be version information - -//send 20 bytes of data to match -0x80 0x11 0x00 0x00 0x14 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x7f; -//expect 90 00 - - - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr.expected.out deleted file mode 100644 index 123ebe61..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryDemo.scr.expected.out +++ /dev/null @@ -1,12 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 01, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 01, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 14, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 02, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 02, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 0f, 02, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 04, 01, 00, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 11, P1: 00, P2: 00, Lc: 14, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryEnroll.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryEnroll.scr deleted file mode 100644 index b186eb0f..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryEnroll.scr +++ /dev/null @@ -1,15 +0,0 @@ -// resume printing output during functional test -output on; - -//create bioserver applet with AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 -0x80 0xB8 0x00 0x00 0x0d 0x0b 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 0x00 0x7f; - -//select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x01 0x01 0x7f; -//expected output 90 00 - -//send enrollment data of 20 bytes -0x80 0x10 0x00 0x00 0x14 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x7f; -//expect 90 00 - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryMatch.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryMatch.scr deleted file mode 100644 index ec4d292c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/biometry/biometryMatch.scr +++ /dev/null @@ -1,20 +0,0 @@ -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -//create bioApplet applet with AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 -0x80 0xB8 0x00 0x00 0x0d 0x0b 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 0x00 0x7f; - -//select bio-applet -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0f 0x02 0x01 0x7f; -//expected output 90 00 - -//get public template data -0x80 0x10 0x00 0x00 0x00 0x7f; -//expected output to be version information - -//send 20 bytes of data to match -0x80 0x11 0x00 0x00 0x14 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x7f; -//expect 90 00 - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr deleted file mode 100644 index fc960ae9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr +++ /dev/null @@ -1,550 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)demo1.scr 1.13 -// Version:1.13 -// Date:01/11/06 -//- - -///////////////////////////////////////////////////////////////////// -// This is a sample input file used by the jp.bat file. -// -// Comments lines begin with "//". -// Non-comment lines are C-APDUs represented by hex digits. -// -// Beneath each C-APDU is a comment the corresponding R-APDU expected to be returned -// by the card. -// -// Compare the expected with the actual APDUs to verify correct behavior. -///////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////// -// Select all installed Applets -///////////////////////////////////////////////////////////////////// - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// create JavaPurse -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x2 0x01 0x00 0x7F; - -// create JavaLoyalty -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x5 0x01 0x00 0x7F; - -// create wallet applet -0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x08 0 0 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; - -///////////////////////////////////////////////////////////////////// -// Initialize JavaPurse -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1 -//For the second and consecutive runs it can be 69 82 - -// Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678 -0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00 -// For second and consecutive runs it can be 91 04 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2 - -// Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4 - -// Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7 - -// Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8 - -// Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = "0xa0,00,00,00,62,03,01,0c,05,01 " -0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -////////////////////////////////////////////////////////////////////// -// End of initialization session, all values are set up. -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// A session with various errors at CAD 33445566 -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN (User PIN 01030507) -0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00; -// 69 c4 = SW_PIN_FAILED, 4 tries remained - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00 = SW_NO_ERROR - -// Complete Transaction: Date 10/28/97; Time 18:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x2d 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:48 -0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F; -// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log - -// Complete Transaction: Date 10/28/97; Time 18:50; -0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE -// (Transaction with a wrong signature is in a way completed, -// We can't retry with another signature.) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19 - -// Initialize transaction: Debit $30.01 -0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00) - -// Initialize transaction: Credit $127.82 -0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00, -// this transaction would bring it to 320.01) - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19, Max Balance = $320.00, Max Transaction = $30; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -// Read the second record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x02 0x1c 0x00 0x7F; -// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00; -// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed), SW_WRONG_SIGNATURE (9105) -// Attempt of the transaction is recorded, but balance wasn't change, see next record. - -// Read the third record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x03 0x1c 0x00 0x7F; -// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00 -// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000) - -// Read the fifth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x05 0x1c 0x00 0x7F; -// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00; -// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688; -// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000) - -// Read the sixth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x06 0x1c 0x00 0x7F; -// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 -// Empty record - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62) - -// Select File: select EF under current DF (P1 = 0x02); FID = 0x9103 -0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00; -// 90 00; - -// Read the first record in the selected file -// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04 -0x00 0xb2 0x01 0x04 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -///////////////////////////////////////////////////////////// -// Additional JavaPurse tests to increase coverage -///////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Wrong INS for Java Purse CLA -0x80 0x34 0x00 0x00 0x00 0x00; -// 6d 00; - -// Wrong CLA -0x60 0x00 0x00 0x00 0x00 0x00; -// 6e 00; - -// Wrong INS for ISO CLA -0x00 0x74 0x00 0x00 0x00 0x00; -// 6d 00 - -// Initialize transaction: wrong transaction type -0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect P2 -0x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect LC -0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19 - -// Complete Transaction: incorrect LC -0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Complete Transaction: incorrect P1 -0x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Transaction: incorrect P2 -0x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -///////////////////////////////////////////////////////// -// Additional cases for Parameter Update -///////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 6a 86 == SW_INCORRECT_P1P2 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x11 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x11 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F; -// 91 05 == SW_WRONG_SIGNATURE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 81 == SW_FUNC_NOT_SUPPORTED - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize transaction: Debit $199.99 -0x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 02 == SW_NOT_ENOUGH_FUNDS - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -// Select JavaLoyalty (AID = "Loyalty") -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127; -// 90 00 = SW_NO_ERROR - -// Read Balance -0x80 0x20 0x00 0x00 0x00 0x00; -// 00 16 90 00 = Balance=22 points - -// Reset Balance -0x80 0x22 0x00 0x00 0x00 0x00; -// 90 00 = SW_NO_ERROR - -///////////////////////////////////////////////////////////////////// -// Initialize Wallet -///////////////////////////////////////////////////////////////////// - -//Select Wallet -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Verify user pin -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//90 00 = SW_NO_ERROR - -//Get wallet balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR - -//Attempt to debit from an empty account -0x80 0x40 0x00 0x00 0x01 0x64 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Credit $100 to the empty account -0x80 0x30 0x00 0x00 0x01 0x64 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR - -//Debit $50 from the account -0x80 0x40 0x00 0x00 0x01 0x32 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Credit $128 to the account -0x80 0x30 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $51 from the account -0x80 0x40 0x00 0x00 0x01 0x33 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $128 from the account -0x80 0x40 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Reselect Wallet applet so that userpin is reset -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Credit $127 to the account before pin verification -0x80 0x30 0x00 0x00 0x01 0x7F 0x7F; -//0x6301 = SW_PIN_VERIFICATION_REQUIRED - -//Verify User pin with wrong pin value -0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F; -//0x6300 = SW_VERIFICATION_FAILED - -//Verify user pin again with correct pin value -//0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F; -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//0x9000 = SW_NO_ERROR - -//Get balance with incorrect LE value -0x80 0x50 0x00 0x00 0x00 0x01; -//0x6700 = ISO7816.SW_WRONG_LENGTH - -//Get balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -// *** SCRIPT END *** -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr.expected.out deleted file mode 100644 index dee3ec52..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo1/demo1.scr.expected.out +++ /dev/null @@ -1,114 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 14, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, 08, 00, 00, 05, 01, 02, 03, 04, 05, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 01, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1a, 11, 22, 33, 44, 00, 00, 00, 00, c1, 08, 01, 02, 03, 04, 05, 06, 07, 08, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 02, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c2, 04, 01, 02, 03, 04, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 03, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 62, 00, 04, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c6, 04, 05, 05, 05, 05, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 05, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c7, 02, 7d, 00, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 06, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 0b, b8, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 07, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c9, 04, 02, 01, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 08, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1e, 11, 22, 33, 44, 00, 00, 00, 00, ca, 0c, 33, 55, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 61, a8, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 21, Le: 0a, 61, a8, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 09, c4, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 61, a8, 00, 02, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 23, Le: 0a, 57, e4, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 55, 77, 99, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 57, e4, 00, 03, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 11, 2d, Le: 0a, 4e, ed, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 03, 05, 07, Le: 00, SW1: 69, SW2: c4 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 2d, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 04, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 11, 11, 11, 11, 11, 11, 11, 11, 0a, 1c, 61, 12, 30, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 35, a9, 3b, 26, 50, 58, 97, 93, 0a, 1c, 61, 12, 32, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 05, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 4b, 13, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 03 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 31, ee, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 01 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 24, Lc: 00, Le: 06, 4b, 13, 7d, 00, 0b, b8, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 1c, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 02, P2: 1c, Lc: 00, Le: 12, 00, 04, 02, 08, f7, 33, 44, 55, 66, 0a, 1c, 61, 12, 30, 4e, ed, 91, 05, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 03, P2: 1c, Lc: 00, Le: 12, 00, 03, 02, 08, f7, 33, 55, 77, 99, 0a, 1b, 61, 11, 2d, 4e, ed, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 05, P2: 1c, Lc: 00, Le: 12, 00, 01, 01, 61, a8, 22, 44, 66, 88, 0a, 1b, 61, 0f, 21, 61, a8, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 06, P2: 1c, Lc: 00, Le: 12, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 05, c5, 03, 0c, 1f, 62, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 02, P2: 0c, Lc: 02, 91, 03, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 04, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 34, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 60, INS: 00, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 99 -CLA: 00, INS: 74, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 80, INS: 20, P1: 03, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0b, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 06, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0c, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 22, P1: 11, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 22, P1: 00, P2: 11, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 86, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 11, P2: 00, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 11, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 09, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 26, P1: 11, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 11, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 11, 00, 11, 00, 11, 00, 11, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, cf, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 81 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 0a, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 4e, 20, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4e, 1f, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 02 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4b, 13, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 06, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 16, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 64, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 32, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 33, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 7f, Le: 00, SW1: 63, SW2: 01 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 04, 01, 03, 02, 66, Le: 00, SW1: 63, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr deleted file mode 100644 index 5e9602e6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr +++ /dev/null @@ -1,1120 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x00 0x00 0x15 0x00 0x02 0x00 0x03 0x00 0x01 0x00 0x0A 0x00 0x04 0x00 0x05 0x00 0x1A 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x06 0x06 0x00 0x03 0xC1 0x81 0x02 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x04 0x07 0x00 0x01 0x00 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x08 0x0A 0x00 0x05 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x05 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x07 0x09 0x00 0x04 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x21 0x00 0x3A 0x00 0x1D 0x00 0xDB 0x00 0x0A 0x00 0x1E 0x00 0x00 0x00 0xAA 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x21 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x04 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x1D 0x42 0x80 0x03 0x01 0xFF 0x00 0x05 0x04 0x00 0x02 0x00 0x33 0xFF 0xFF 0x00 0x7F 0x00 0x3C 0x00 0xBE 0x00 0xD4 0x80 0x02 0x00 0x81 0x00 0x01 0x08 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xDB 0x00 0x05 0x30 0x8F 0x00 0x01 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x03 0x3B 0x7A 0x04 0x41 0x18 0x8C 0x00 0x02 0x18 0x03 0x89 0x00 0x19 0x1E 0x25 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x04 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x05 0x7A 0x01 0x30 0x1E 0x61 0x04 0x18 0x77 0x01 0x77 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x21 0x19 0x06 0x8D 0x00 0x06 0x31 0x1E 0x10 0x64 0x47 0x31 0x19 0x05 0x25 0x75 0x00 0x1D 0x00 0x02 0x00 0x01 0x00 0x16 0x00 0x02 0x00 0x0D 0x18 0xAF 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x89 0x00 0x70 0x09 0x18 0xAF 0x00 0x1E 0x43 0x89 0x00 0xAF 0x00 0x63 0x06 0x18 0x03 0x89 0x00 0xAF 0x00 0x11 0x75 0x30 0x6F 0x08 0x18 0x11 0x75 0x30 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7A 0x02 0x21 0x19 0x8B 0x00 0x07 0x2D 0x19 0x8B 0x00 0x08 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x09 0x1A 0x04 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x75 0x00 0x1A 0x00 0x02 0x00 0x20 0x00 0x0D 0x00 0x22 0x00 0x14 0x18 0x19 0x8B 0x00 0x0A 0x70 0x0E 0x18 0x8B 0x00 0x0B 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x7A 0x03 0x21 0x19 0x8B 0x00 0x07 0x2D 0x1A 0x03 0xAF 0x00 0x8D 0x00 0x0C 0x3B 0x19 0x03 0x05 0x8B 0x00 0x0D 0x7A 0x02 0x10 0x18 0x03 0x89 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x3A 0x00 0x0E 0x02 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x06 0x80 0x03 0x00 0x06 0x00 0x00 0x0F 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x1D 0x04 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x03 0x00 0x00 0x80 0x03 0x00 0x00 0x81 0x06 0x80 0x10 0x06 0x03 0x80 0x0A 0x08 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x1E 0x00 0x0B 0x18 0x43 0x04 0x05 0x04 0x02 0x06 0x02 0x0B 0x4B 0x11 0x00 0x0F 0x04 0x07 0x08 0x11 0x0C 0x11 0x42 0x05 0x10 0x15 0x06 0x08 0x07 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x01 0x07 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x21 0x01 0x72 0x00 0x40 0x0A 0x6E 0x00 0x10 0x01 0x74 0x00 0x00 0x03 0x84 0x00 0x02 0x00 0x01 0x00 0x03 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x21 0x03 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x04 0x03 0x01 0x0C 0x04 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x02 0x01 0x00 0xCA 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x40 0x00 0x80 0x00 0x04 0x00 0x01 0x01 0x00 0x00 0x04 0x00 0x37 0x00 0x63 0x00 0x95 0x00 0xA1 0x00 0x81 0x03 0x10 0x00 0x0D 0x04 0x04 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x94 0xFF 0xFF 0xFF 0xFF 0x01 0xA1 0x00 0x80 0x00 0x02 0x00 0x01 0x01 0x04 0x00 0x00 0x09 0xE7 0x09 0xEC 0x0A 0x12 0x0A 0x27 0x00 0x80 0x00 0x01 0x00 0x01 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x0A 0x6E 0x00 0x05 0x31 0x18 0x8C 0x00 0x20 0x18 0x02 0x88 0x00 0x18 0x1D 0x04 0x41 0x5B 0x30 0x1D 0x88 0x01 0x18 0xAE 0x01 0x91 0x00 0x1B 0x87 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x32 0x1F 0xAE 0x01 0x6D 0x15 0xAD 0x02 0x1F 0x8F 0x00 0x1B 0x3D 0x1E 0x8C 0x00 0x17 0x37 0x1F 0x04 0x41 0x5B 0x32 0x70 0xEA 0x7A 0x03 0x20 0x1D 0x04 0x6C 0x0A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAE 0x01 0x04 0x43 0x5B 0x6F 0x08 0x11 0x6A 0x83 0x8D 0x00 0x19 0xAE 0x00 0x1D 0x43 0x04 0x41 0x5B 0x3D 0x30 0x63 0x08 0x1D 0xAE 0x01 0x41 0x5B 0x30 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x1D 0x24 0x83 0x03 0x77 0x04 0x23 0x18 0x3D 0x84 0x01 0x3F 0x12 0x04 0x43 0x5B 0x88 0x01 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x1C 0x28 0x04 0x1D 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x11 0xAD 0x02 0xAE 0x04 0x24 0x83 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x2C 0x19 0x77 0x03 0x10 0x18 0x3D 0x84 0x00 0x04 0x41 0x5B 0x3F 0x12 0x88 0x00 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x00 0x18 0x3D 0x84 0x04 0x04 0x41 0x5B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3F 0x12 0x88 0x04 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x23 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x26 0x3B 0x7A 0x05 0x41 0x18 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x59 0x18 0x07 0x90 0x0B 0x87 0x05 0x18 0x06 0x90 0x0B 0x87 0x06 0xAD 0x06 0x03 0x10 0x0C 0x38 0xAD 0x06 0x04 0x10 0x1F 0x38 0xAD 0x06 0x05 0x10 0x63 0x38 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x06 0x90 0x0B 0x87 0x07 0x18 0x07 0x90 0x0C 0x87 0x08 0x18 0x07 0x91 0x00 0x1F 0x87 0x09 0x18 0x03 0x89 0x0A 0x18 0x03 0x89 0x0B 0x18 0x03 0x88 0x0C 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x06 0x05 0x8D 0x00 0x5A 0x87 0x0D 0x18 0x05 0x05 0x8D 0x00 0x18 0x87 0x0E 0x18 0x07 0x05 0x8D 0x00 0x1A 0x87 0x0F 0x18 0x10 0x08 0x05 0x8D 0x00 0x1A 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x18 0x8F 0x00 0x1D 0x3D 0x04 0x10 0x08 0x8C 0x00 0x1E 0x87 0x11 0x18 0x8F 0x00 0x1D 0x3D 0x08 0x10 0x08 0x8C 0x00 0x1E 0x87 0x12 0x18 0x8F 0x00 0x21 0x3D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0B 0x8C 0x00 0x22 0x87 0x13 0x18 0x8F 0x00 0x24 0x3D 0x10 0x0A 0x10 0x12 0x8C 0x00 0x25 0x87 0x14 0xAD 0x07 0x03 0x03 0x8D 0x00 0x27 0x3B 0x19 0x1E 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x28 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x29 0x7A 0x01 0x10 0xAD 0x12 0x8B 0x00 0x2A 0xAD 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x2A 0x7A 0x02 0x21 0x19 0x8B 0x00 0x2B 0x2D 0x19 0x8B 0x00 0x2C 0x61 0x3E 0x1A 0x04 0x25 0x73 0x00 0x31 0x00 0x20 0x00 0x26 0x00 0x15 0x00 0x31 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1C 0x00 0x31 0x00 0x23 0x00 0x31 0x00 0x2A 0x18 0x19 0x8C 0x00 0x2D 0x70 0x5C 0x18 0x19 0x8C 0x00 0x2E 0x70 0x55 0x18 0x19 0x8C 0x00 0x2F 0x70 0x4E 0x18 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x30 0x70 0x47 0x11 0x6D 0x00 0x8D 0x00 0x19 0x70 0x3F 0x1A 0x04 0x25 0x10 0x20 0x6B 0x09 0x18 0x19 0x8C 0x00 0x31 0x70 0x31 0x1A 0x04 0x25 0x10 0xA4 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6B 0x16 0x18 0x8B 0x00 0x32 0x60 0x09 0x18 0x19 0x8C 0x00 0x33 0x70 0x1D 0x18 0x19 0x8C 0x00 0x34 0x70 0x16 0x1A 0x04 0x25 0x10 0xB2 0x6B 0x09 0x18 0x19 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x35 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x19 0x7A 0x05 0x22 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x03 0x10 0x6F 0x38 0x1A 0x05 0x10 0x84 0x38 0x1A 0x06 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x36 0x1A 0x07 0x8B 0x00 0x37 0x38 0x06 0x1A 0x06 0x25 0x41 0x32 0x1A 0x1F 0x59 0x03 0x01 0x7B 0x00 0x38 0x92 0x5B 0x38 0x7B 0x00 0x38 0x03 0x1A 0x1F 0x7B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x38 0x92 0x8D 0x00 0x39 0x32 0x1A 0x04 0x1F 0x05 0x43 0x5B 0x38 0x19 0x03 0x1F 0x8B 0x00 0x3A 0x7A 0x05 0x26 0xAD 0x0E 0x03 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0xAD 0x12 0x8B 0x00 0x3B 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x10 0x0A 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x3B 0x1A 0x05 0x25 0x32 0xAD 0x0D 0x07 0x1F 0x39 0x1A 0x08 0x8D 0x00 0x3D 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0xAD 0x0D 0x06 0x16 0x04 0x39 0x18 0x1F 0x16 0x04 0x8C 0x00 0x3E 0x29 0x05 0xAF 0x0A 0x04 0x41 0x29 0x06 0xAD 0x0D 0x03 0x16 0x06 0x39 0x1A 0x10 0x07 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0F 0x03 0x07 0x8D 0x00 0x39 0x3B 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0xAD 0x05 0x03 0x1A 0x03 0x07 0x8D 0x00 0x39 0x29 0x07 0xAD 0x06 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x07 0x06 0x8D 0x00 0x39 0x29 0x07 0x1A 0x16 0x07 0x16 0x05 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x16 0x06 0x8D 0x00 0x27 0x29 0x07 0xAD 0x10 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x39 0x29 0x07 0x19 0x03 0x16 0x07 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x03 0x04 0x38 0x7A 0x06 0x29 0xAD 0x0E 0x03 0x25 0x61 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x11 0x91 0x04 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x10 0x0D 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x3B 0xAD 0x0D 0x03 0x26 0x32 0xAD 0x0D 0x06 0x26 0x29 0x04 0xAD 0x0D 0x04 0x26 0x29 0x05 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x03 0x1A 0x08 0xAD 0x10 0x03 0x10 0x08 0x8D 0x00 0x40 0x6B 0x05 0x04 0x70 0x03 0x03 0x29 0x06 0x1A 0x03 0x1F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0xAD 0x0D 0x07 0x26 0x5B 0x38 0x59 0x07 0x01 0x1A 0x16 0x07 0x16 0x04 0x8D 0x00 0x27 0x29 0x07 0xAD 0x0F 0x03 0x1A 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x07 0x8D 0x00 0x39 0x29 0x07 0x1A 0x10 0x0D 0x1A 0x16 0x07 0x08 0x8D 0x00 0x39 0x3D 0x29 0x07 0x29 0x08 0x16 0x06 0x61 0x46 0x1A 0x16 0x07 0xAD 0x0D 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x11 0x91 0x05 0x8D 0x00 0x27 0x3B 0xAD 0x14 0x8B 0x00 0x41 0x28 0x09 0x8D 0x00 0x42 0x18 0x1F 0x89 0x0A 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x43 0x3B 0xAD 0x14 0x8B 0x00 0x44 0x8D 0x00 0x45 0xAD 0x0E 0x03 0x03 0x38 0x11 0x91 0x05 0x8D 0x00 0x19 0x70 0x45 0x1A 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0xAD 0x0D 0x04 0x26 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x11 0x90 0x00 0x8D 0x00 0x27 0x3B 0xAD 0x14 0x8B 0x00 0x41 0x28 0x09 0x8D 0x00 0x42 0x18 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x03 0x26 0x89 0x0A 0xAD 0x07 0x03 0x16 0x05 0x8D 0x00 0x27 0x3B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x43 0x3B 0xAD 0x14 0x8B 0x00 0x44 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x45 0x1A 0x03 0x03 0x8D 0x00 0x27 0x3B 0x1A 0x16 0x08 0x03 0x8D 0x00 0x27 0x3B 0xAD 0x0F 0x03 0x8D 0x00 0x3D 0x29 0x09 0x03 0x29 0x0A 0x16 0x0A 0x07 0x6D 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x08 0x16 0x0A 0x26 0x16 0x09 0x6B 0x0F 0xAD 0x09 0x16 0x0A 0x24 0x1A 0x8E 0x02 0x00 0x1F 0x00 0x70 0x0B 0x16 0x0A 0x04 0x41 0x5B 0x29 0x0A 0x70 0xDE 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x1A 0x03 0x16 0x05 0x8D 0x00 0x27 0x29 0x07 0xAD 0x10 0x03 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x39 0x29 0x07 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x03 0x16 0x07 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x03 0x03 0x38 0x7A 0x05 0x22 0xAD 0x0E 0x04 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x00 0x19 0xAD 0x11 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x3B 0x61 0x0C 0xAE 0x0C 0x60 0x08 0x11 0x69 0x82 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x18 0x3D 0x85 0x0B 0x04 0x41 0x89 0x0B 0xAD 0x05 0x03 0x1A 0x03 0x07 0x8D 0x00 0x39 0x32 0xAD 0x06 0x03 0x1A 0x1F 0x06 0x8D 0x00 0x39 0x32 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0xAF 0x0B 0x8D 0x00 0x27 0x32 0x19 0x03 0x1F 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x04 0x04 0x38 0x7A 0x06 0x23 0xAD 0x0E 0x04 0x25 0x61 0x08 0x11 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x32 0x1A 0x07 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x04 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x03 0xAD 0x10 0x03 0x1A 0x08 0x16 0x04 0x41 0x10 0x08 0x43 0x10 0x08 0x8D 0x00 0x40 0x6A 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x91 0x05 0x8D 0x00 0x19 0x1A 0x10 0x0D 0x25 0x73 0x00 0x80 0xFF 0xC1 0xFF 0xCD 0x00 0x21 0x00 0x2E 0x00 0x80 0x00 0x80 0x00 0x37 0x00 0x40 0x00 0x49 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x00 0x59 0x00 0x60 0x00 0x68 0x00 0x70 0x00 0x78 0x18 0x19 0xAD 0x11 0x8C 0x00 0x46 0x18 0x8C 0x00 0x47 0x70 0x5A 0x18 0x19 0xAD 0x12 0x8C 0x00 0x46 0x70 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x18 0x19 0xAD 0x06 0x8C 0x00 0x48 0x70 0x48 0x18 0x19 0xAD 0x05 0x8C 0x00 0x48 0x70 0x3F 0x18 0x19 0x05 0x8C 0x00 0x49 0x70 0x37 0x18 0x19 0x07 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x49 0x70 0x2F 0x18 0x19 0x8C 0x00 0x4A 0x70 0x28 0x18 0x19 0x03 0x8C 0x00 0x4B 0x70 0x20 0x18 0x19 0x04 0x8C 0x00 0x4B 0x70 0x18 0x18 0x19 0x05 0x8C 0x00 0x4B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x10 0x18 0x19 0x06 0x8C 0x00 0x4B 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0xAD 0x10 0x03 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x08 0x8D 0x00 0x39 0x3B 0x19 0x03 0x10 0x08 0x8B 0x00 0x3A 0xAD 0x0E 0x04 0x03 0x38 0x7A 0x04 0x25 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x32 0x03 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x19 0x8B 0x00 0x3C 0x29 0x05 0x16 0x05 0x1F 0x6D 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x06 0x25 0x29 0x06 0x16 0x06 0x75 0x00 0x45 0x00 0x02 0xFF 0x81 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0D 0xFF 0x82 0x00 0x29 0xAD 0x11 0x1A 0x08 0x1F 0x8B 0x00 0x4C 0x61 0x36 0xAD 0x11 0x8B 0x00 0x4D 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x24 0xAD 0x12 0x1A 0x08 0x1F 0x8B 0x00 0x4C 0x61 0x1A 0xAD 0x12 0x8B 0x00 0x4D 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x86 0x8D 0x00 0x19 0x7A 0x03 0x34 0xAD 0x07 0x03 0x8D 0x00 0x3D 0x29 0x04 0xAD 0x07 0x05 0x8D 0x00 0x3D 0x29 0x05 0xAD 0x07 0x07 0x8D 0x00 0x3D 0x29 0x06 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x75 0x00 0x47 0x00 0x02 0x00 0x01 0x00 0x0D 0x00 0x02 0x00 0x27 0x16 0x04 0x1E 0x41 0x32 0xAD 0x0D 0x04 0x1F 0x39 0x1F 0x16 0x05 0x6E 0x05 0x1F 0x63 0x30 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x01 0x8D 0x00 0x19 0x70 0x28 0x1E 0x16 0x06 0x6F 0x08 0x11 0x91 0x03 0x8D 0x00 0x19 0x16 0x04 0x1E 0x43 0x32 0xAD 0x0D 0x04 0x1F 0x39 0x1F 0x63 0x10 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x02 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0xAD 0x0D 0x05 0x16 0x04 0x39 0x16 0x04 0x78 0x05 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1A 0x1B 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0F 0x1B 0x10 0x0E 0x25 0x8B 0x00 0x4E 0x7A 0x02 0x10 0xAE 0x0C 0x61 0x06 0x18 0x04 0x88 0x0C 0x7A 0x06 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1B 0x10 0x0F 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1B 0x10 0x0E 0x25 0x8D 0x00 0x39 0x3B 0x18 0x19 0x8C 0x00 0x4A 0x7A 0x05 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1B 0x10 0x0F 0xAD 0x07 0x1E 0x05 0x8D 0x00 0x39 0x3B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x06 0x23 0x19 0x8B 0x00 0x2B 0x2D 0xAD 0x13 0x1A 0x10 0x0D 0x25 0x8B 0x00 0x4F 0x32 0x1F 0x61 0x25 0x1A 0x10 0x0E 0x25 0x05 0x41 0x90 0x0B 0x28 0x04 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x39 0x3B 0xAD 0x13 0x15 0x04 0x8B 0x00 0x50 0x70 0x1A 0xAD 0x13 0x1F 0x8B 0x00 0x51 0x28 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x39 0x3B 0x7A 0x03 0x22 0x19 0x8B 0x00 0x2B 0x2D 0x19 0x8B 0x00 0x3C 0x3B 0x1A 0x05 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x6B 0x31 0x1A 0x07 0x25 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x08 0x8D 0x00 0x3D 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x00 0x0D 0xAD 0x0D 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0x7A 0x04 0x26 0x01 0x2D 0x03 0x32 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x2B 0x28 0x04 0x15 0x04 0x05 0x25 0x29 0x05 0x15 0x04 0x06 0x25 0x29 0x06 0x16 0x06 0x06 0x4F 0x61 0x17 0xAD 0x0D 0x08 0x26 0x61 0x0A 0x11 0x69 0x86 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x70 0x35 0xAD 0x0D 0x08 0x26 0x32 0x70 0x2E 0x16 0x06 0x06 0x4F 0x10 0x1F 0x53 0x29 0x07 0x10 0x91 0x16 0x07 0x8D 0x00 0x52 0x32 0x1F 0x73 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0D 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x19 0x1F 0x73 0x00 0x29 0x91 0x02 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x1C 0x00 0x0D 0x00 0x0D 0xAD 0x12 0x8B 0x00 0x3B 0x61 0x17 0x11 0x69 0x82 0x8D 0x00 0x19 0x70 0x0F 0xAD 0x11 0x8B 0x00 0x3B 0x61 0x08 0x11 0x69 0x82 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0x16 0x06 0x10 0x07 0x53 0x29 0x06 0x16 0x06 0x07 0x53 0x60 0x57 0x16 0x06 0x07 0x6B 0x4A 0x16 0x05 0x61 0x08 0x11 0x6A 0x83 0x8D 0x00 0x19 0x1F 0x73 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x31 0x91 0x02 0x91 0x04 0x00 0x29 0x00 0x1F 0x00 0x0D 0x16 0x05 0x04 0x6B 0x07 0xAD 0x07 0x2D 0x70 0x1C 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x14 0xAD 0x14 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x0A 0xAD 0x13 0x16 0x05 0x8B 0x00 0x51 0x2D 0x1A 0x9F 0x00 0x7E 0x11 0x6A 0x82 0x8D 0x00 0x19 0x70 0x75 0x11 0x6A 0x81 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0x70 0x6D 0x16 0x06 0x61 0x63 0x1F 0x73 0x00 0x5E 0x91 0x02 0x91 0x04 0x00 0x41 0x00 0x22 0x00 0x0D 0xAD 0x07 0x03 0x25 0x16 0x05 0x6B 0x07 0xAD 0x07 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x2D 0x70 0x46 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x3E 0xAD 0x14 0x16 0x05 0x8B 0x00 0x53 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x14 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x1F 0xAD 0x13 0x16 0x05 0x8B 0x00 0x4F 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x0A 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x16 0x05 0x8B 0x00 0x51 0x2D 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0x19 0x8B 0x00 0x54 0x29 0x07 0x1A 0x92 0x16 0x07 0x6D 0x06 0x1A 0x92 0x29 0x07 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x07 0x8B 0x00 0x55 0x19 0x1A 0x03 0x16 0x07 0x8B 0x00 0x56 0x7A 0x04 0x32 0x19 0x8B 0x00 0x2B 0x2E 0xAD 0x08 0x1E 0x1B 0x10 0x0F 0x8D 0x00 0x3D 0x39 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x1E 0x26 0x60 0x35 0x1B 0x10 0x11 0x1B 0x10 0x0E 0x25 0x05 0x43 0x5B 0x8D 0x00 0x57 0x28 0x04 0x15 0x04 0x66 0x1D 0xAD 0x09 0x1E 0x15 0x04 0x03 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x58 0x94 0x00 0x00 0x1F 0x37 0xAD 0x09 0x1E 0x24 0x67 0x0E 0xAD 0x08 0x1E 0x03 0x39 0x70 0x07 0xAD 0x08 0x1E 0x03 0x39 0xAD 0x08 0x1E 0x26 0x61 0x16 0x1B 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0E 0x05 0x38 0x1B 0x10 0x0F 0x1B 0x92 0x10 0x0D 0x43 0x05 0x43 0x03 0x8D 0x00 0x3F 0x3B 0x18 0x19 0x8C 0x00 0x4A 0x7A 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x00 0x1B 0x87 0x15 0x18 0x03 0x88 0x16 0x7A 0x01 0x10 0xAE 0x16 0x78 0x05 0x20 0xAD 0x15 0x92 0xAE 0x16 0x6B 0x08 0x11 0x6A 0x84 0x8D 0x00 0x19 0xAD 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x3D 0x84 0x16 0x3F 0x12 0x04 0x41 0x5B 0x88 0x16 0x8F 0x00 0x1B 0x3D 0x19 0x8C 0x00 0x5B 0x37 0x7A 0x03 0x20 0x1D 0x65 0x07 0x1D 0xAE 0x16 0x6F 0x04 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x77 0xAD 0x15 0x1D 0x04 0x43 0x24 0x83 0x03 0x77 0x02 0x23 0xAE 0x16 0x61 0x04 0x03 0x78 0xAE 0x16 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x51 0x28 0x04 0x1D 0x61 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x11 0x19 0x87 0x03 0x7A 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x1D 0x90 0x0B 0x87 0x03 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x13 0x08 0x00 0x10 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x03 0xA5 0x01 0x42 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x72 0x00 0x5C 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x02 0x00 0x36 0x00 0x02 0x00 0x00 0x03 0x02 0x00 0x12 0x08 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x09 0x02 0x00 0x12 0x0A 0x02 0x00 0x12 0x0B 0x02 0x00 0x12 0x0C 0x02 0x00 0x12 0x0D 0x02 0x00 0x12 0x0E 0x02 0x00 0x12 0x0F 0x02 0x00 0x12 0x06 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x07 0x02 0x00 0x12 0x04 0x02 0x00 0x12 0x05 0x02 0x00 0x12 0x02 0x02 0x00 0x12 0x03 0x02 0x00 0x12 0x00 0x02 0x00 0x12 0x01 0x02 0x00 0x24 0x00 0x02 0x00 0x24 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x06 0x00 0x0A 0x61 0x06 0x81 0x08 0x0C 0x06 0x81 0x07 0x01 0x06 0x81 0x08 0x0D 0x01 0x00 0x36 0x00 0x03 0x00 0x00 0x80 0x01 0x81 0x09 0x00 0x06 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x82 0x00 0x00 0x06 0x80 0x00 0x00 0x01 0x00 0x24 0x00 0x06 0x00 0x09 0xD5 0x01 0x00 0x12 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xD8 0x06 0x81 0x10 0x06 0x03 0x81 0x03 0x01 0x03 0x81 0x03 0x02 0x03 0x81 0x09 0x05 0x03 0x81 0x0A 0x01 0x03 0x81 0x0A 0x0E 0x06 0x00 0x02 0x71 0x06 0x00 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x36 0x06 0x00 0x04 0xCC 0x06 0x00 0x05 0x32 0x06 0x00 0x06 0x30 0x03 0x81 0x03 0x03 0x06 0x00 0x02 0x28 0x06 0x00 0x07 0xAE 0x06 0x00 0x07 0xF6 0x06 0x81 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x03 0x81 0x06 0x03 0x05 0x00 0x00 0x00 0x06 0x81 0x10 0x02 0x03 0x81 0x0A 0x08 0x03 0x81 0x09 0x04 0x03 0x81 0x0A 0x06 0x06 0x81 0x10 0x04 0x06 0x00 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xA2 0x06 0x81 0x10 0x03 0x06 0x81 0x10 0x00 0x03 0x00 0x00 0x82 0x06 0x81 0x08 0x01 0x06 0x81 0x10 0x01 0x03 0x00 0x00 0x83 0x06 0x81 0x08 0x02 0x06 0x00 0x07 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x13 0x06 0x00 0x07 0x26 0x06 0x00 0x07 0x31 0x06 0x00 0x07 0x4B 0x06 0x00 0x07 0x5E 0x06 0x00 0x09 0x6B 0x03 0x81 0x09 0x01 0x03 0x81 0x09 0x02 0x03 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x08 0x03 0x00 0x24 0x04 0x03 0x00 0x24 0x02 0x03 0x00 0x24 0x03 0x06 0x81 0x10 0x05 0x03 0x00 0x00 0x81 0x03 0x81 0x0A 0x07 0x03 0x81 0x0A 0x09 0x03 0x81 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x15 0x05 0x06 0x81 0x08 0x0B 0x06 0x81 0x08 0x04 0x06 0x81 0x03 0x00 0x06 0x81 0x08 0x0F 0x06 0x00 0x0A 0x56 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x01 0x74 0x00 0xA0 0x0A 0x09 0x03 0x05 0x05 0x04 0x1B 0x0D 0x0C 0x05 0x04 0x07 0x07 0x29 0x02 0x03 0x09 0x07 0x02 0x06 0x04 0x07 0x02 0x06 0x1B 0x06 0x02 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x06 0x0B 0x06 0x07 0x04 0x04 0x04 0x09 0x08 0x08 0x09 0x0D 0x0D 0x0C 0x0E 0x02 0x24 0x05 0xD8 0x0C 0x33 0x0C 0x0F 0x06 0x09 0x08 0x03 0x08 0x0B 0x20 0x16 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x33 0x05 0x06 0x06 0x03 0x0B 0x1B 0x13 0x22 0x13 0x0C 0x0D 0x08 0x10 0x13 0x0B 0x04 0x02 0x14 0x17 0x10 0x09 0x16 0x03 0x11 0x16 0x08 0x0C 0x07 0x21 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x0A 0x0C 0x0E 0x08 0x2B 0x03 0x09 0x3F 0x0D 0x09 0x09 0x44 0x03 0x08 0x12 0x39 0x0A 0x12 0x0A 0x1B 0x08 0x08 0x1B 0x25 0x16 0x1E 0x06 0x27 0x10 0x27 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x4B 0x34 0x0E 0x26 0x1B 0x0F 0x3C 0x0D 0x0A 0x2E 0x08 0x0D 0x15 0x0A 0x15 0x36 0x0A 0x19 0x0E 0x06 0x07 0x05 0x2B 0x04 0x05 0x05 0x03 0x0A 0x04 0x07 0x12 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x05 0x06 0x2F 0x0D 0x00 0xD0 0x05 0x13 0x0F 0x05 0x1D 0x2D 0x57 0x07 0x08 0x30 0x15 0x08 0x08 0x09 0x06 0x07 0x06 0x07 0x06 0x06 0x06 0x08 0x09 0x0E 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x05 0x07 0x05 0x1F 0x07 0x07 0x07 0x08 0x0E 0x0D 0x07 0x07 0x0E 0x08 0x07 0x10 0x05 0x0F 0x06 0x06 0x04 0x0E 0x0F 0x05 0x08 0x04 0x0E 0x0B 0x04 0x0F 0x0F 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x18 0x0B 0x0A 0x0C 0x0A 0x0A 0x0D 0x0B 0x14 0x04 0x0E 0x10 0x04 0x1C 0x0C 0x0E 0x16 0x0C 0x0C 0x13 0x0B 0x06 0x05 0x0E 0x06 0x03 0x0B 0x0C 0x0B 0x06 0x05 0x0F 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0B 0x06 0x03 0x06 0x08 0x07 0x1D 0x16 0x08 0x0D 0x0B 0x14 0x05 0x0C 0x04 0x11 0x11 0x0A 0x08 0x09 0x14 0x04 0x11 0x04 0x10 0x12 0x08 0x2C 0x04 0x09 0x09 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x08 0x07 0x08 0x08 0x08 0x08 0x08 0x0A 0x0B 0x08 0x0C 0x0C 0x0D 0x1C 0x07 0x0B 0x0A 0x07 0x0B 0x08 0x09 0x08 0x08 0x28 0x0D 0x13 0x08 0x0F 0x0C 0x12 0x0D 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x07 0x0B 0x08 0x0A 0x1D 0x08 0x08 0x11 0x08 0x05 0x13 0x05 0x1C 0x08 0x0B 0x20 0x19 0x1C 0x13 0x08 0x07 0x08 0x1C 0x1E 0x09 0x0A 0x0B 0x08 0x27 0x09 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x17 0x09 0x0A 0x0C 0x09 0x09 0x04 0x12 0x08 0x07 0x0A 0x14 0x0F 0x04 0x2C 0x06 0x07 0x05 0x1B 0x10 0x05 0x29 0x23 0x0B 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x15 0x00 0x62 0x00 0x12 0x01 0xCB 0x00 0x0A 0x00 0x3C 0x00 0x00 0x00 0xD6 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x01 0x00 0x41 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x15 0x06 0x00 0x12 0x00 0x80 0x03 0x02 0x00 0x01 0x04 0x04 0x00 0x00 0x00 0x5C 0xFF 0xFF 0x00 0x4F 0x00 0x64 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x01 0xCB 0x00 0x05 0x43 0x18 0x8C 0x00 0x03 0x18 0x8F 0x00 0x13 0x3D 0x06 0x10 0x08 0x8C 0x00 0x02 0x87 0x00 0x19 0x1E 0x25 0x29 0x04 0x1E 0x16 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x05 0x1E 0x16 0x05 0x41 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x06 0xAD 0x00 0x19 0x1E 0x04 0x41 0x16 0x06 0x8B 0x00 0x04 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x05 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x10 0xAD 0x00 0x8B 0x00 0x08 0x61 0x04 0x03 0x78 0x04 0x78 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0xAD 0x00 0x8B 0x00 0x09 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x0B 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0C 0x1A 0x03 0x25 0x10 0x80 0x6A 0x08 0x11 0x6E 0x00 0x8D 0x00 0x0C 0x1A 0x04 0x25 0x75 0x00 0x2D 0x00 0x04 0x00 0x20 0x00 0x27 0x00 0x30 0x00 0x21 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x40 0x00 0x1B 0x00 0x50 0x00 0x15 0x18 0x19 0x8C 0x00 0x0D 0x7A 0x18 0x19 0x8C 0x00 0x0E 0x7A 0x18 0x19 0x8C 0x00 0x0F 0x7A 0x18 0x19 0x8C 0x00 0x10 0x7A 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x0C 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x12 0x5B 0x29 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x63 0x08 0x11 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x41 0x11 0x7F 0xFF 0x6F 0x08 0x11 0x6A 0x84 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x41 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x00 0x12 0x5B 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x05 0x63 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x43 0x63 0x08 0x11 0x6A 0x85 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x43 0x89 0x01 0x7A 0x04 0x22 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0A 0x2D 0x19 0x8B 0x00 0x14 0x32 0x1F 0x05 0x6D 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x19 0x05 0x8B 0x00 0x15 0x1A 0x03 0xAF 0x01 0x10 0x08 0x4F 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0xAF 0x01 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x03 0x05 0x8B 0x00 0x16 0x7A 0x04 0x22 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x12 0x5B 0x32 0xAD 0x00 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x0E 0x08 0x1F 0x8B 0x00 0x17 0x61 0x08 0x11 0x63 0x00 0x8D 0x00 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x62 0x00 0x18 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x06 0x80 0x09 0x00 0x06 0x80 0x03 0x00 0x03 0x80 0x09 0x08 0x03 0x80 0x03 0x01 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x09 0x02 0x03 0x80 0x09 0x05 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x06 0x00 0x01 0x78 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x1F 0x06 0x00 0x00 0xC3 0x06 0x00 0x01 0xAD 0x03 0x80 0x09 0x04 0x03 0x80 0x0A 0x06 0x01 0x80 0x09 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x04 0x03 0x80 0x09 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x3C 0x00 0x0F 0x13 0x1F 0x20 0x0D 0x67 0x41 0x11 0x05 0x05 0x41 0x0E 0x05 0x20 0x09 0x1C 0x00 0x29 0x05 0x04 0x07 0x2A 0x04 0x06 0x07 0x09 0x0D 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x1F 0x05 0x10 0x0D 0x1D 0x06 0x06 0x06 0x07 0x08 0x08 0x04 0x09 0x12 0x15 0x10 0x10 0x08 0x04 0x09 0x12 0x15 0x0D 0x0F 0x05 0x0B 0x05 0x19 0x07 0x05 0x0A 0x08 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x34 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x20 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x34 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0x52 0x00 0x66 0x00 0xBF 0x00 0x0A 0x00 0x29 0x00 0x00 0x01 0x3F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x00 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x01 0x00 0x35 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x66 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x00 0x82 0x03 0x03 0x00 0x03 0x07 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x40 0x22 0x83 0x05 0x02 0x00 0x01 0x01 0x05 0x00 0x00 0x00 0x5A 0x00 0x72 0x00 0x95 0x00 0xB5 0x00 0xBA 0x81 0x00 0x00 0x00 0x0A 0x05 0x05 0x03 0x02 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x04 0x05 0x15 0x44 0x00 0x00 0x01 0x27 0x78 0x00 0x02 0x04 0x93 0x57 0x00 0x04 0x03 0xEC 0xA8 0x00 0x06 0x05 0xF1 0x0F 0x00 0x04 0x02 0x00 0x09 0x50 0x75 0x72 0x7F; -0x80 0xB4 0x06 0x00 0x09 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xBF 0x00 0x04 0x10 0x18 0x8C 0x00 0x10 0x18 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x09 0x87 0x00 0x18 0x8F 0x00 0x11 0x3D 0x04 0x8C 0x00 0x05 0x87 0x01 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8F 0x00 0x07 0x3D 0xAD 0x00 0x8C 0x00 0x08 0x87 0x02 0xAD 0x01 0xAD 0x02 0x05 0x8B 0x00 0x0A 0x18 0x8B 0x00 0x0B 0x7A 0x02 0x30 0x8F 0x00 0x0C 0x3D 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x3B 0x7A 0x02 0x20 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x7A 0x02 0x10 0x18 0x8C 0x00 0x0F 0x18 0x03 0x89 0x03 0x18 0x08 0x90 0x0B 0x87 0x04 0x7A 0x05 0x20 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x19 0x03 0xAD 0x04 0x03 0x08 0x8D 0x00 0x13 0x3B 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAF 0x03 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x41 0x89 0x03 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x12 0xAF 0x03 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x43 0x89 0x03 0x7A 0x01 0x10 0xAD 0x04 0x77 0x01 0x10 0xAF 0x7F; -0x80 0xB4 0x07 0x00 0x02 0x03 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x52 0x00 0x14 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x01 0x02 0x00 0x1F 0x01 0x02 0x00 0x1F 0x00 0x06 0x83 0x06 0x00 0x01 0x00 0x1F 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x04 0x00 0x06 0x83 0x04 0x00 0x06 0x00 0x00 0x49 0x03 0x83 0x06 0x01 0x03 0x82 0x03 0x01 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x03 0x83 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x15 0x04 0x06 0x83 0x05 0x00 0x06 0x82 0x03 0x00 0x01 0x83 0x06 0x00 0x06 0x82 0x0F 0x02 0x06 0x82 0x10 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x29 0x00 0x12 0x10 0x0B 0x07 0x05 0x02 0x02 0x18 0x0F 0x06 0x12 0x14 0x11 0x04 0x0E 0x0E 0x04 0x05 0x05 0x00 0x13 0x05 0x04 0x04 0x06 0x05 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x0C 0x0A 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x0D 0x0F 0x14 0x0C 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x3A 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x26 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x1D 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x53 0x65 0x63 0x75 0x72 0x65 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x3A 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0xBE 0x00 0xAF 0x03 0x3B 0x00 0x14 0x00 0x81 0x00 0x00 0x02 0x4B 0x00 0x00 0x00 0x04 0x00 0x02 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x04 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x01 0x02 0x0D 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0xAF 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x02 0x82 0x03 0x04 0x00 0x02 0x01 0x15 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x38 0x00 0xEC 0x01 0x5E 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xFF 0xFF 0xFF 0xFF 0x00 0x50 0x00 0x5D 0x01 0xA4 0x82 0x00 0x03 0x01 0x02 0x03 0x82 0x01 0x06 0x01 0x02 0x03 0x14 0x15 0x13 0x00 0x83 0x03 0x01 0x00 0x01 0x07 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x00 0x00 0x02 0x18 0x22 0x82 0x05 0x03 0x00 0x02 0x01 0x05 0x00 0x00 0x02 0x36 0x02 0x76 0x02 0xB9 0x02 0xDE 0x03 0x16 0x81 0x00 0x00 0x00 0x0A 0x05 0x03 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x02 0x04 0x05 0x05 0x15 0x44 0x00 0x00 0x04 0x27 0x78 0x00 0x02 0x05 0x93 0x57 0x00 0x04 0x01 0xEC 0xA8 0x00 0x06 0x03 0xF1 0x0F 0x00 0x04 0x02 0x00 0x0F 0x7F; -0x80 0xB4 0x06 0x00 0x12 0x53 0x65 0x63 0x75 0x72 0x65 0x50 0x75 0x72 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x3B 0x00 0x05 0x10 0x18 0x8C 0x00 0x22 0x18 0x01 0x87 0x00 0x18 0x8F 0x00 0x09 0x3D 0x05 0x05 0x8C 0x00 0x0A 0x87 0x01 0x18 0x8F 0x00 0x09 0x3D 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8C 0x00 0x0A 0x87 0x00 0xAD 0x01 0x7B 0x00 0x29 0x03 0x05 0x8B 0x00 0x2A 0xAD 0x00 0x7B 0x00 0x2B 0x03 0x05 0x8B 0x00 0x2A 0x7A 0x02 0x20 0x18 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x60 0x0C 0x18 0x03 0x88 0x02 0x18 0x03 0x88 0x03 0x03 0x78 0x18 0x19 0x8C 0x00 0x0B 0x78 0x02 0x20 0xAE 0x02 0x1D 0x53 0x60 0x05 0x04 0x70 0x03 0x03 0x78 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x20 0xAE 0x03 0x1D 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x03 0x20 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x18 0x19 0x8C 0x00 0x0D 0x60 0x0C 0x18 0x3D 0x84 0x02 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x55 0x88 0x02 0x70 0x0B 0x18 0x3D 0x84 0x02 0x10 0xFD 0x53 0x88 0x02 0x03 0x78 0x04 0x24 0x19 0x8B 0x00 0x0E 0x2D 0x19 0x8B 0x00 0x0F 0x61 0x04 0x03 0x78 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0E 0x03 0x3E 0x25 0x10 0xF3 0x53 0x38 0x1A 0x07 0x25 0x32 0x1F 0x05 0x6D 0x04 0x03 0x78 0x03 0x29 0x04 0x1A 0x07 0x3E 0x25 0x05 0x43 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x25 0x32 0x08 0x29 0x05 0x16 0x05 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x29 0x05 0x16 0x04 0x16 0x05 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x04 0x20 0x18 0x19 0x8C 0x00 0x11 0x60 0x69 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x07 0x25 0x05 0x6B 0x4F 0x18 0x03 0x88 0x03 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x06 0x88 0x03 0x18 0x19 0x03 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x35 0xAD 0x00 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x04 0x88 0x03 0x18 0x19 0x03 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x16 0x18 0x19 0x11 0x66 0x66 0x8B 0x00 0x15 0x3B 0x70 0x0B 0x18 0x19 0x11 0x65 0x65 0x8B 0x00 0x15 0x3B 0x04 0x78 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x04 0x24 0x18 0x8B 0x00 0x08 0x60 0x04 0x03 0x78 0x19 0x8B 0x00 0x0E 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x03 0x29 0x04 0x08 0x29 0x05 0x16 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x16 0x04 0x8D 0x00 0x16 0x3B 0x1A 0x07 0x3E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x05 0x41 0x5B 0x38 0x03 0x78 0x01 0x20 0x03 0x78 0x02 0x20 0x18 0x19 0x8B 0x00 0x17 0x10 0x80 0x6B 0x0E 0x18 0x19 0x8B 0x00 0x18 0x10 0x39 0x6B 0x05 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x03 0x03 0x78 0x04 0x13 0x18 0x8C 0x00 0x19 0x8F 0x00 0x1A 0x3D 0x8C 0x00 0x1B 0x2C 0x8F 0x00 0x1C 0x3D 0x19 0x8C 0x00 0x1D 0x2D 0x8F 0x00 0x1E 0x3D 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x1F 0x2E 0x18 0x8F 0x00 0x20 0x3D 0x07 0x8C 0x00 0x21 0x87 0x04 0xAD 0x04 0x19 0x04 0x8B 0x00 0x23 0xAD 0x04 0x19 0x05 0x8B 0x00 0x23 0xAD 0x04 0x1B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8B 0x00 0x23 0xAD 0x04 0x19 0x06 0x8B 0x00 0x23 0x18 0x8B 0x00 0x24 0x7A 0x02 0x30 0x8F 0x00 0x25 0x3D 0x8C 0x00 0x26 0x3B 0x7A 0x02 0x20 0xAD 0x04 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x27 0x7A 0x02 0x20 0x18 0x8C 0x00 0x28 0x18 0x03 0x89 0x05 0x18 0x19 0x87 0x06 0x18 0x08 0x90 0x0B 0x87 0x07 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x43 0x89 0x05 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x41 0x89 0x05 0x7A 0x02 0x10 0xAD 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAF 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x05 0x20 0xAD 0x06 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2D 0x19 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x2D 0x19 0x03 0xAD 0x07 0x03 0x08 0x8D 0x00 0x2E 0x3B 0x7A 0x02 0x10 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAD 0x07 0x77 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x17 0x08 0x00 0x14 0x00 0x04 0x00 0x02 0x00 0x02 0x03 0x00 0x02 0x12 0x34 0x03 0x00 0x02 0x43 0x21 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0xBE 0x00 0x2F 0x02 0x00 0x13 0x01 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x03 0x02 0x00 0x56 0x00 0x02 0x00 0x62 0x02 0x02 0x00 0x62 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x02 0x00 0x62 0x00 0x03 0x82 0x03 0x12 0x01 0x83 0x09 0x00 0x06 0x83 0x09 0x00 0x06 0x00 0x00 0x69 0x03 0x82 0x03 0x04 0x06 0x00 0x00 0x8D 0x03 0x83 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x03 0x83 0x0A 0x0D 0x06 0x83 0x10 0x04 0x06 0x00 0x01 0xA8 0x03 0x83 0x09 0x01 0x03 0x82 0x03 0x07 0x03 0x82 0x03 0x0C 0x03 0x82 0x03 0x0B 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x06 0x03 0x82 0x03 0x0E 0x03 0x82 0x03 0x0F 0x06 0x83 0x03 0x00 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x01 0x00 0x62 0x00 0x06 0x00 0x02 0x21 0x01 0x82 0x04 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x82 0x04 0x00 0x01 0x82 0x06 0x00 0x06 0x82 0x06 0x00 0x06 0x82 0x03 0x00 0x03 0x82 0x06 0x01 0x03 0x83 0x03 0x01 0x01 0x00 0x56 0x00 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xC1 0x03 0x82 0x06 0x04 0x06 0x82 0x05 0x00 0x05 0x00 0x00 0x00 0x03 0x83 0x09 0x08 0x05 0x00 0x00 0x02 0x01 0x82 0x01 0x00 0x06 0x83 0x0F 0x02 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x81 0x00 0x2E 0x0A 0x0C 0x0C 0x02 0x0A 0x15 0x04 0x0C 0x0D 0x1B 0x04 0x06 0x05 0x7D 0x02 0x0F 0x10 0x0F 0xB4 0x02 0x07 0x07 0x07 0x19 0x0F 0x04 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x10 0x19 0x0E 0x04 0x05 0x10 0x19 0x11 0x04 0x05 0x10 0x10 0x05 0x10 0x1D 0x0B 0x10 0x10 0x00 0x4F 0x05 0x08 0x06 0x06 0x06 0x07 0x05 0x05 0x05 0x07 0x11 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x21 0x06 0x1D 0x05 0x08 0x3F 0x14 0x07 0x05 0x0F 0x05 0x0C 0x05 0x09 0x05 0x0C 0x05 0x0B 0x0B 0x0B 0x08 0x2D 0x16 0x09 0x0F 0x03 0x04 0x04 0x05 0x04 0x05 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x09 0x07 0x07 0x07 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x07 0x09 0x09 0x0C 0x12 0x09 0x07 0x09 0x09 0x0F 0x12 0x09 0x07 0x09 0x0C 0x09 0x07 0x09 0x0B 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x04 0x0B 0x09 0x07 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x36 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x22 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x19 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x70 0x68 0x6F 0x74 0x6F 0x63 0x61 0x72 0x64 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x36 0x00 0x21 0x00 0x0E 0x00 0x34 0x00 0x7A 0x00 0x7C 0x02 0x50 0x00 0x0A 0x00 0x48 0x00 0x00 0x01 0x9F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x00 0x05 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x34 0x05 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x17 0x01 0x01 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x00 0x4D 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x7C 0x00 0x0E 0x02 0x41 0x02 0x44 0x04 0x44 0x4B 0x04 0x4B 0x44 0x06 0x4B 0x44 0x21 0xA1 0x81 0x00 0x09 0x50 0x68 0x6F 0x74 0x6F 0x43 0x61 0x72 0x64 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x82 0x03 0x03 0x00 0x03 0x07 0x01 0x00 0x00 0x00 0x58 0x22 0x83 0x05 0x03 0x00 0x03 0x01 0x06 0x00 0x00 0x00 0x8C 0x00 0xCF 0x01 0x1B 0x01 0x4E 0x01 0x71 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0xBB 0x81 0x00 0x00 0x00 0x10 0x06 0x01 0x02 0x03 0x04 0x05 0x06 0x06 0x2E 0x91 0x00 0x00 0x03 0x2F 0xCE 0x00 0x02 0x04 0x4E 0xF6 0x00 0x04 0x05 0x99 0x50 0x7F; -0x80 0xB4 0x06 0x00 0x1F 0x00 0x02 0x01 0xB1 0xE9 0x00 0x07 0x06 0xCF 0x30 0x00 0x0A 0x02 0x00 0x0D 0x50 0x68 0x6F 0x74 0x6F 0x43 0x61 0x72 0x64 0x49 0x6D 0x70 0x6C 0x01 0x00 0x10 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x02 0x50 0x03 0x01 0xF7 0x80 0x07 0x02 0x00 0x00 0x18 0x02 0x29 0x80 0x1C 0x02 0x4A 0x00 0x18 0x02 0x46 0x80 0x03 0x02 0x4A 0x00 0x18 0x04 0x10 0x18 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x11 0x18 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x09 0x87 0x00 0x18 0x8F 0x00 0x12 0x3D 0x04 0x8C 0x00 0x13 0x87 0x01 0x18 0x8F 0x00 0x07 0x3D 0xAD 0x00 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x87 0x02 0xAD 0x01 0xAD 0x02 0x05 0x8B 0x00 0x0A 0x18 0x8B 0x00 0x0B 0x7A 0x02 0x30 0x8F 0x00 0x0C 0x3D 0x8C 0x00 0x0D 0x3B 0x7A 0x02 0x20 0xAD 0x01 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0E 0x7A 0x03 0x11 0x18 0x8C 0x00 0x0F 0x18 0x07 0x91 0x00 0x10 0x87 0x03 0x18 0x07 0x90 0x0A 0x87 0x04 0x18 0x10 0x60 0x90 0x0B 0x87 0x05 0x03 0x30 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x07 0x6D 0x0C 0xAD 0x04 0x1D 0x03 0x38 0x59 0x01 0x01 0x70 0xF4 0x7A 0x03 0x22 0x03 0x8D 0x00 0x14 0x1D 0x10 0x10 0x41 0x6D 0x08 0x11 0x60 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x15 0x03 0x31 0x1E 0x07 0x6D 0x25 0xAD 0x03 0x1E 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2E 0xAD 0x03 0x1E 0x24 0x67 0x0D 0xAD 0x03 0x1E 0x1D 0x90 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x37 0x1E 0x04 0x41 0x78 0x59 0x02 0x01 0x70 0xDB 0x11 0x60 0x00 0x8D 0x00 0x15 0x02 0x78 0x05 0x61 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x06 0x15 0x06 0x67 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x16 0x04 0x1F 0x41 0x15 0x06 0x92 0x6F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x11 0x60 0x03 0x8D 0x00 0x15 0x1A 0x03 0x15 0x06 0x16 0x04 0x1F 0x8D 0x00 0x16 0x3B 0x16 0x05 0x61 0x09 0xAD 0x04 0x1D 0x04 0x43 0x04 0x38 0x7A 0x03 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2D 0x1A 0x66 0x10 0x01 0x2D 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0xAD 0x04 0x1D 0x04 0x43 0x03 0x38 0x70 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x7A 0x03 0x21 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2D 0x1A 0x66 0x05 0x1A 0x92 0x78 0x03 0x78 0x05 0x41 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x04 0x15 0x04 0x66 0x0A 0xAD 0x04 0x1D 0x04 0x43 0x25 0x61 0x08 0x11 0x60 0x01 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x15 0x1E 0x1F 0x41 0x15 0x04 0x92 0x6F 0x08 0x11 0x60 0x03 0x8D 0x00 0x15 0x15 0x04 0x1E 0xAD 0x05 0x03 0x1F 0x8D 0x00 0x16 0x3B 0xAD 0x05 0x77 0x06 0x44 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0x28 0x04 0x1F 0x1A 0x92 0x6F 0x08 0x11 0x70 0x00 0x8D 0x00 0x15 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x06 0x15 0x06 0x66 0x0A 0xAD 0x04 0x1D 0x04 0x43 0x25 0x61 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x07 0x03 0x8D 0x00 0x19 0x28 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x70 0x0A 0x28 0x07 0x11 0x71 0x10 0x8D 0x00 0x15 0x15 0x04 0x15 0x06 0x03 0x15 0x06 0x92 0xAD 0x05 0x03 0x8B 0x00 0x1A 0x29 0x07 0x18 0xAD 0x05 0x1A 0x1F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x07 0x8C 0x00 0x1B 0x29 0x05 0x16 0x05 0x78 0x05 0x51 0x16 0x04 0x10 0x20 0x6A 0x08 0x11 0x74 0x44 0x8D 0x00 0x1C 0x19 0x03 0x1A 0x1F 0x16 0x04 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x13 0x1D 0x29 0x05 0x16 0x05 0x61 0x04 0x03 0x78 0x11 0x71 0x11 0x78 0x28 0x05 0x11 0x73 0x33 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x7A 0x00 0x1E 0x02 0x00 0x1D 0x02 0x02 0x00 0x1D 0x00 0x02 0x00 0x1D 0x01 0x02 0x00 0x29 0x00 0x02 0x00 0x29 0x01 0x02 0x00 0x29 0x02 0x01 0x00 0x29 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x04 0x00 0x06 0x83 0x04 0x00 0x06 0x00 0x00 0x61 0x03 0x83 0x06 0x01 0x03 0x82 0x03 0x01 0x01 0x00 0x1D 0x00 0x06 0x00 0x00 0x19 0x03 0x83 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x04 0x06 0x83 0x05 0x00 0x01 0x80 0x00 0x00 0x06 0x82 0x03 0x00 0x01 0x83 0x06 0x00 0x06 0x83 0x06 0x00 0x06 0x82 0x08 0x10 0x06 0x82 0x0F 0x02 0x06 0x82 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x1D 0x01 0x06 0x82 0x08 0x12 0x01 0x84 0x0C 0x00 0x06 0x84 0x0B 0x00 0x03 0x84 0x0B 0x01 0x06 0x00 0x02 0x27 0x06 0x82 0x07 0x01 0x06 0x82 0x10 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x48 0x00 0x1B 0x28 0x0B 0x07 0x05 0x02 0x02 0x18 0x12 0x06 0x07 0x08 0x23 0x0D 0x06 0x24 0x38 0x14 0x17 0x1C 0x23 0x14 0x1F 0x08 0x1D 0x14 0x27 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x00 0x29 0x07 0x08 0x08 0x06 0x04 0x04 0x06 0x05 0x06 0x06 0x0A 0x04 0x06 0x04 0x0A 0x07 0x05 0x26 0x0C 0x2F 0x0E 0x1A 0x0F 0x0A 0x19 0x17 0x0F 0x0D 0x23 0x22 0x7F; -0x80 0xB4 0x09 0x00 0x0B 0x0E 0x0A 0x14 0x0A 0x22 0x05 0x0C 0x0E 0x0C 0x13 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -// create JavaPurse -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 2 0x01 0 0x7F; - -// create JavaLoyalty -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 5 0x01 0 0x7F; - -// create wallet applet -0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x08 0 0 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; - -// create RMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0x8 0x01 0x00 0x7F; - -// create SecureRMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0xa 0x01 0x00 0x7F; - -// create photocard applet -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x00 0x7F; - -///////////////////////////////////////////////////////////////////// -// Initialize JavaPurse -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1 -//For the second and consecutive runs it can be 69 82 - -// Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678 -0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00 -// For second and consecutive runs it can be 91 04 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2 - -// Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4 - -// Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7 - -// Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8 - -// Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = "0xa0,00,00,00,62,03,01,0c,05,01 " -0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -////////////////////////////////////////////////////////////////////// -// End of initialization session, all values are set up. -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// A session with various errors at CAD 33445566 -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN (User PIN 01030507) -0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00; -// 69 c4 = SW_PIN_FAILED, 4 tries remained - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00 = SW_NO_ERROR - -// Complete Transaction: Date 10/28/97; Time 18:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x2d 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:48 -0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F; -// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log - -// Complete Transaction: Date 10/28/97; Time 18:50; -0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE -// (Transaction with a wrong signature is in a way completed, -// We can't retry with another signature.) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19 - -// Initialize transaction: Debit $30.01 -0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00) - -// Initialize transaction: Credit $127.82 -0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00, -// this transaction would bring it to 320.01) - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19, Max Balance = $320.00, Max Transaction = $30; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -// Read the second record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x02 0x1c 0x00 0x7F; -// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00; -// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed), SW_WRONG_SIGNATURE (9105) -// Attempt of the transaction is recorded, but balance wasn't change, see next record. - -// Read the third record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x03 0x1c 0x00 0x7F; -// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00 -// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000) - -// Read the fifth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x05 0x1c 0x00 0x7F; -// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00; -// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688; -// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000) - -// Read the sixth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x06 0x1c 0x00 0x7F; -// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 -// Empty record - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62) - -// Select File: select EF under current DF (P1 = 0x02); FID = 0x9103 -0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00; -// 90 00; - -// Read the first record in the selected file -// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04 -0x00 0xb2 0x01 0x04 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -///////////////////////////////////////////////////////////// -// Additional JavaPurse tests to increase coverage -///////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Wrong INS for Java Purse CLA -0x80 0x34 0x00 0x00 0x00 0x00; -// 6d 00; - -// Wrong CLA -0x60 0x00 0x00 0x00 0x00 0x00; -// 6e 00; - -// Wrong INS for ISO CLA -0x00 0x74 0x00 0x00 0x00 0x00; -// 6d 00 - -// Initialize transaction: wrong transaction type -0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect P2 -0x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect LC -0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19 - -// Complete Transaction: incorrect LC -0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Complete Transaction: incorrect P1 -0x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Transaction: incorrect P2 -0x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -///////////////////////////////////////////////////////// -// Additional cases for Parameter Update -///////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 6a 86 == SW_INCORRECT_P1P2 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x11 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x11 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F; -// 91 05 == SW_WRONG_SIGNATURE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 81 == SW_FUNC_NOT_SUPPORTED - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize transaction: Debit $199.99 -0x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 02 == SW_NOT_ENOUGH_FUNDS - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -///////////////////////////////////////////////////////////////////// -// Select JavaLoyalty -///////////////////////////////////////////////////////////////////// - -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127; -// 90 00 = SW_NO_ERROR - -// Read Balance -0x80 0x20 0x00 0x00 0x00 0x00; -// 00 16 90 00 = Balance=22 points - -// Reset Balance -0x80 0x22 0x00 0x00 0x00 0x00; -// 90 00 = SW_NO_ERROR - -///////////////////////////////////////////////////////////////////// -// Initialize Wallet -///////////////////////////////////////////////////////////////////// - -//Select Wallet -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Verify user pin -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//90 00 = SW_NO_ERROR - -//Get wallet balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR - -//Attempt to debit from an empty account -0x80 0x40 0x00 0x00 0x01 0x64 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Credit $100 to the empty account -0x80 0x30 0x00 0x00 0x01 0x64 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR - -//Debit $50 from the account -0x80 0x40 0x00 0x00 0x01 0x32 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Credit $128 to the account -0x80 0x30 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $51 from the account -0x80 0x40 0x00 0x00 0x01 0x33 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $128 from the account -0x80 0x40 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Reselect Wallet applet so that userpin is reset -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Credit $127 to the account before pin verification -0x80 0x30 0x00 0x00 0x01 0x7F 0x7F; -//0x6301 = SW_PIN_VERIFICATION_REQUIRED - -//Verify User pin with wrong pin value -0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F; -//0x6300 = SW_VERIFICATION_FAILED - -//Verify user pin again with correct pin value -//0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F; -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//0x9000 = SW_NO_ERROR - -//Get balance with incorrect LE value -0x80 0x50 0x00 0x00 0x00 0x01; -//0x6700 = ISO7816.SW_WRONG_LENGTH - -//Get balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr.expected.out deleted file mode 100644 index 0dae2b4b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2.scr.expected.out +++ /dev/null @@ -1,121 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Applet creation and functional test section. -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 14, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, 08, 00, 00, 05, 01, 02, 03, 04, 05, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 08, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 08, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0a, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0a, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 01, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1a, 11, 22, 33, 44, 00, 00, 00, 00, c1, 08, 01, 02, 03, 04, 05, 06, 07, 08, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 02, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c2, 04, 01, 02, 03, 04, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 03, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 62, 00, 04, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c6, 04, 05, 05, 05, 05, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 05, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c7, 02, 7d, 00, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 06, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 0b, b8, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 07, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c9, 04, 02, 01, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 08, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1e, 11, 22, 33, 44, 00, 00, 00, 00, ca, 0c, 33, 55, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 61, a8, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 21, Le: 0a, 61, a8, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 09, c4, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 61, a8, 00, 02, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 23, Le: 0a, 57, e4, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 55, 77, 99, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 57, e4, 00, 03, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 11, 2d, Le: 0a, 4e, ed, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 03, 05, 07, Le: 00, SW1: 69, SW2: c4 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 2d, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 04, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 11, 11, 11, 11, 11, 11, 11, 11, 0a, 1c, 61, 12, 30, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 35, a9, 3b, 26, 50, 58, 97, 93, 0a, 1c, 61, 12, 32, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 05, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 4b, 13, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 03 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 31, ee, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 01 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 24, Lc: 00, Le: 06, 4b, 13, 7d, 00, 0b, b8, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 1c, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 02, P2: 1c, Lc: 00, Le: 12, 00, 04, 02, 08, f7, 33, 44, 55, 66, 0a, 1c, 61, 12, 30, 4e, ed, 91, 05, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 03, P2: 1c, Lc: 00, Le: 12, 00, 03, 02, 08, f7, 33, 55, 77, 99, 0a, 1b, 61, 11, 2d, 4e, ed, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 05, P2: 1c, Lc: 00, Le: 12, 00, 01, 01, 61, a8, 22, 44, 66, 88, 0a, 1b, 61, 0f, 21, 61, a8, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 06, P2: 1c, Lc: 00, Le: 12, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 05, c5, 03, 0c, 1f, 62, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 02, P2: 0c, Lc: 02, 91, 03, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 04, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 34, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 60, INS: 00, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 99 -CLA: 00, INS: 74, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 80, INS: 20, P1: 03, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0b, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 06, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0c, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 22, P1: 11, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 22, P1: 00, P2: 11, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 86, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 11, P2: 00, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 11, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 09, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 26, P1: 11, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 11, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 11, 00, 11, 00, 11, 00, 11, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, cf, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 81 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 0a, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 4e, 20, 00, 00, 00, 00, 00, 00, 00, 00, Le: 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4e, 1f, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 02 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4b, 13, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 06, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 16, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 64, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 32, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 33, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 7f, Le: 00, SW1: 63, SW2: 01 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 04, 01, 03, 02, 66, Le: 00, SW1: 63, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr deleted file mode 100644 index c32e86ed..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr +++ /dev/null @@ -1,1053 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x00 0x00 0x15 0x00 0x02 0x00 0x03 0x00 0x01 0x00 0x0A 0x00 0x04 0x00 0x05 0x00 0x1A 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x06 0x06 0x00 0x03 0xC1 0x81 0x02 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x04 0x07 0x00 0x01 0x00 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x08 0x0A 0x00 0x05 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x05 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x07 0x09 0x00 0x04 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x21 0x00 0x3A 0x00 0x1D 0x00 0xDB 0x00 0x0A 0x00 0x1E 0x00 0x00 0x00 0xAA 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x21 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x04 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x1D 0x42 0x80 0x03 0x01 0xFF 0x00 0x05 0x04 0x00 0x02 0x00 0x33 0xFF 0xFF 0x00 0x7F 0x00 0x3C 0x00 0xBE 0x00 0xD4 0x80 0x02 0x00 0x81 0x00 0x01 0x08 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xDB 0x00 0x05 0x30 0x8F 0x00 0x01 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x03 0x3B 0x7A 0x04 0x41 0x18 0x8C 0x00 0x02 0x18 0x03 0x89 0x00 0x19 0x1E 0x25 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x04 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x05 0x7A 0x01 0x30 0x1E 0x61 0x04 0x18 0x77 0x01 0x77 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x21 0x19 0x06 0x8D 0x00 0x06 0x31 0x1E 0x10 0x64 0x47 0x31 0x19 0x05 0x25 0x75 0x00 0x1D 0x00 0x02 0x00 0x01 0x00 0x16 0x00 0x02 0x00 0x0D 0x18 0xAF 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x89 0x00 0x70 0x09 0x18 0xAF 0x00 0x1E 0x43 0x89 0x00 0xAF 0x00 0x63 0x06 0x18 0x03 0x89 0x00 0xAF 0x00 0x11 0x75 0x30 0x6F 0x08 0x18 0x11 0x75 0x30 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7A 0x02 0x21 0x19 0x8B 0x00 0x07 0x2D 0x19 0x8B 0x00 0x08 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x09 0x1A 0x04 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x75 0x00 0x1A 0x00 0x02 0x00 0x20 0x00 0x0D 0x00 0x22 0x00 0x14 0x18 0x19 0x8B 0x00 0x0A 0x70 0x0E 0x18 0x8B 0x00 0x0B 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x7A 0x03 0x21 0x19 0x8B 0x00 0x07 0x2D 0x1A 0x03 0xAF 0x00 0x8D 0x00 0x0C 0x3B 0x19 0x03 0x05 0x8B 0x00 0x0D 0x7A 0x02 0x10 0x18 0x03 0x89 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x3A 0x00 0x0E 0x02 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x06 0x80 0x03 0x00 0x06 0x00 0x00 0x0F 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x1D 0x04 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x03 0x00 0x00 0x80 0x03 0x00 0x00 0x81 0x06 0x80 0x10 0x06 0x03 0x80 0x0A 0x08 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x1E 0x00 0x0B 0x18 0x43 0x04 0x05 0x04 0x02 0x06 0x02 0x0B 0x4B 0x11 0x00 0x0F 0x04 0x07 0x08 0x11 0x0C 0x11 0x42 0x05 0x10 0x15 0x06 0x08 0x07 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x01 0x07 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x2B 0x01 0x96 0x00 0x40 0x0B 0x7E 0x00 0x10 0x01 0xAD 0x00 0x00 0x03 0xCE 0x00 0x02 0x00 0x01 0x00 0x03 0x04 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2B 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0E 0x03 0x01 0x0C 0x04 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x01 0x00 0xCA 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x40 0x00 0x80 0x00 0x04 0x00 0x01 0x01 0x00 0x00 0x04 0x00 0x37 0x00 0x63 0x00 0x95 0x00 0xA1 0x00 0x81 0x03 0x14 0x00 0x11 0x04 0x04 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xEE 0xFF 0xFF 0xFF 0xFF 0x01 0xFB 0x00 0x80 0x00 0x02 0x00 0x01 0x01 0x04 0x00 0x00 0x0A 0xF7 0x0A 0xFC 0x0B 0x22 0x0B 0x37 0x00 0x80 0x00 0x01 0x00 0x01 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x0B 0x7E 0x00 0x05 0x31 0x18 0x8C 0x00 0x1D 0x18 0x02 0x88 0x00 0x18 0x1D 0x04 0x41 0x5B 0x30 0x1D 0x88 0x01 0x18 0xAE 0x01 0x91 0x00 0x63 0x87 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x32 0x1F 0xAE 0x01 0x6D 0x15 0xAD 0x02 0x1F 0x8F 0x00 0x63 0x3D 0x1E 0x8C 0x00 0x27 0x37 0x1F 0x04 0x41 0x5B 0x32 0x70 0xEA 0x7A 0x03 0x20 0x1D 0x04 0x6C 0x0A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAE 0x01 0x04 0x43 0x5B 0x6F 0x08 0x11 0x6A 0x83 0x8D 0x00 0x2D 0xAE 0x00 0x1D 0x43 0x04 0x41 0x5B 0x3D 0x30 0x63 0x08 0x1D 0xAE 0x01 0x41 0x5B 0x30 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x1D 0x24 0x83 0x03 0x77 0x04 0x23 0x18 0x3D 0x84 0x01 0x3F 0x12 0x04 0x43 0x5B 0x88 0x01 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x1C 0x28 0x04 0x1D 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x11 0xAD 0x02 0xAE 0x04 0x24 0x83 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x2C 0x19 0x77 0x03 0x10 0x18 0x3D 0x84 0x00 0x04 0x41 0x5B 0x3F 0x12 0x88 0x00 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x00 0x18 0x3D 0x84 0x04 0x04 0x41 0x5B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3F 0x12 0x88 0x04 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x21 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x23 0x3B 0x7A 0x05 0x41 0x18 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x18 0x10 0x08 0x90 0x0B 0x3D 0x03 0x10 0x11 0x38 0x3D 0x04 0x10 0x33 0x38 0x3D 0x05 0x10 0x22 0x38 0x3D 0x06 0x08 0x38 0x3D 0x07 0x10 0x44 0x38 0x3D 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x77 0x38 0x3D 0x10 0x06 0x10 0x06 0x38 0x3D 0x10 0x07 0x10 0x08 0x38 0x87 0x05 0x18 0x07 0x90 0x0B 0x87 0x06 0x18 0x06 0x90 0x0B 0x87 0x07 0xAD 0x07 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0C 0x38 0xAD 0x07 0x04 0x10 0x1F 0x38 0xAD 0x07 0x05 0x10 0x63 0x38 0x18 0x10 0x06 0x90 0x0B 0x87 0x08 0x18 0x07 0x90 0x0C 0x87 0x09 0x18 0x07 0x91 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x20 0x87 0x0A 0x18 0x03 0x89 0x0B 0x18 0x03 0x89 0x0C 0x18 0x03 0x88 0x0D 0x18 0x10 0x06 0x05 0x8D 0x00 0x2A 0x87 0x0E 0x18 0x05 0x05 0x8D 0x00 0x62 0x87 0x0F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x07 0x05 0x8D 0x00 0x1B 0x87 0x10 0x18 0x10 0x08 0x05 0x8D 0x00 0x1B 0x87 0x11 0x18 0x05 0x10 0x40 0x03 0x8D 0x00 0x1E 0x94 0x00 0x00 0x1F 0x87 0x12 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x1E 0x05 0x8D 0x00 0x1B 0x87 0x13 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0x18 0x10 0x06 0x03 0x8D 0x00 0x22 0x87 0x14 0x18 0x8F 0x00 0x24 0x3D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x10 0x08 0x8C 0x00 0x25 0x87 0x15 0x18 0x8F 0x00 0x24 0x3D 0x08 0x10 0x08 0x8C 0x00 0x25 0x87 0x16 0x18 0x8F 0x00 0x28 0x3D 0x10 0x0B 0x8C 0x00 0x29 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0x18 0x8F 0x00 0x2B 0x3D 0x10 0x0A 0x10 0x12 0x8C 0x00 0x2C 0x87 0x18 0xAD 0x08 0x03 0x03 0x8D 0x00 0x2E 0x3B 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x8B 0x00 0x2F 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x30 0x7A 0x01 0x10 0xAD 0x16 0x8B 0x00 0x31 0xAD 0x15 0x8B 0x00 0x31 0x7A 0x02 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2D 0x19 0x8B 0x00 0x33 0x61 0x3E 0x1A 0x04 0x25 0x73 0x00 0x31 0x00 0x20 0x00 0x26 0x00 0x15 0x00 0x31 0x00 0x1C 0x00 0x31 0x00 0x23 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x31 0x00 0x2A 0x18 0x19 0x8C 0x00 0x34 0x70 0x5C 0x18 0x19 0x8C 0x00 0x35 0x70 0x55 0x18 0x19 0x8C 0x00 0x36 0x70 0x4E 0x18 0x19 0x8C 0x00 0x37 0x70 0x47 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x2D 0x70 0x3F 0x1A 0x04 0x25 0x10 0x20 0x6B 0x09 0x18 0x19 0x8C 0x00 0x38 0x70 0x31 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x16 0x18 0x8B 0x00 0x39 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x60 0x09 0x18 0x19 0x8C 0x00 0x3A 0x70 0x1D 0x18 0x19 0x8C 0x00 0x3B 0x70 0x16 0x1A 0x04 0x25 0x10 0xB2 0x6B 0x09 0x18 0x19 0x8C 0x00 0x3C 0x70 0x08 0x11 0x6D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x8D 0x00 0x2D 0x7A 0x05 0x22 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x03 0x10 0x6F 0x38 0x1A 0x05 0x10 0x84 0x38 0x1A 0x06 0x8D 0x00 0x3D 0x1A 0x07 0x8B 0x00 0x3E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x38 0x06 0x1A 0x06 0x25 0x41 0x32 0x1A 0x1F 0x59 0x03 0x01 0x7B 0x00 0x3F 0x92 0x5B 0x38 0x7B 0x00 0x3F 0x03 0x1A 0x1F 0x7B 0x00 0x3F 0x92 0x8D 0x00 0x40 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x04 0x1F 0x05 0x43 0x5B 0x38 0x19 0x03 0x1F 0x8B 0x00 0x41 0x7A 0x06 0x27 0xAD 0x0F 0x03 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0xAD 0x16 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x42 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x10 0x0A 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x06 0x25 0x60 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x43 0x3B 0x1A 0x05 0x25 0x32 0xAD 0x0E 0x07 0x1F 0x39 0x1A 0x08 0x8D 0x00 0x44 0x29 0x04 0xAD 0x0E 0x06 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x39 0x18 0x1F 0x16 0x04 0x8C 0x00 0x45 0x29 0x05 0xAF 0x0B 0x04 0x41 0x29 0x06 0xAD 0x0E 0x03 0x16 0x06 0x39 0x1A 0x10 0x07 0xAD 0x10 0x03 0x07 0x8D 0x00 0x40 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3B 0xAD 0x06 0x03 0x1A 0x03 0x07 0x8D 0x00 0x40 0x29 0x07 0xAD 0x07 0x03 0x1A 0x16 0x07 0x06 0x8D 0x00 0x40 0x29 0x07 0x1A 0x16 0x07 0x16 0x05 0x8D 0x00 0x2E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x07 0x1A 0x16 0x07 0x16 0x06 0x8D 0x00 0x2E 0x29 0x07 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x46 0xAD 0x14 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x03 0x16 0x07 0x03 0x43 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x08 0xAD 0x11 0x03 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x40 0x29 0x07 0x19 0x03 0x16 0x07 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x03 0x04 0x38 0x7A 0x07 0x29 0xAD 0x0F 0x03 0x25 0x61 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0D 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x43 0x3B 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0E 0x03 0x26 0x32 0xAD 0x0E 0x06 0x26 0x29 0x04 0xAD 0x0E 0x04 0x26 0x29 0x05 0x1A 0x03 0xAD 0x13 0x03 0x08 0x8D 0x00 0x40 0x29 0x06 0x1A 0x16 0x06 0xAD 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x10 0x08 0x8D 0x00 0x40 0x3B 0x1A 0x16 0x06 0x10 0x08 0x41 0xAD 0x13 0x08 0x08 0x8D 0x00 0x40 0x3B 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x14 0xAD 0x12 0x05 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x13 0x03 0x10 0x0A 0xAD 0x11 0x03 0x10 0x08 0x8B 0x00 0x48 0x29 0x07 0x1A 0x03 0x1F 0x8D 0x00 0x2E 0x29 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x06 0xAD 0x0E 0x07 0x26 0x5B 0x38 0x59 0x06 0x01 0x1A 0x16 0x06 0x16 0x04 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x10 0x03 0x1A 0x16 0x06 0x07 0x8D 0x00 0x40 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x06 0x1A 0x10 0x0D 0x1A 0x16 0x06 0x08 0x8D 0x00 0x40 0x3D 0x29 0x06 0x29 0x08 0x16 0x07 0x61 0x46 0x1A 0x16 0x06 0xAD 0x0E 0x05 0x26 0x8D 0x00 0x2E 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x1A 0x16 0x06 0x11 0x91 0x05 0x8D 0x00 0x2E 0x3B 0xAD 0x18 0x8B 0x00 0x49 0x28 0x09 0x8D 0x00 0x4A 0x18 0x1F 0x89 0x0B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x4B 0x3B 0xAD 0x18 0x8B 0x00 0x4C 0x8D 0x00 0x4D 0xAD 0x0F 0x03 0x03 0x38 0x11 0x91 0x05 0x8D 0x00 0x2D 0x70 0x45 0x1A 0x16 0x06 0xAD 0x0E 0x04 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2E 0x29 0x06 0x1A 0x16 0x06 0x11 0x90 0x00 0x8D 0x00 0x2E 0x3B 0xAD 0x18 0x8B 0x00 0x49 0x28 0x09 0x8D 0x00 0x4A 0x18 0xAD 0x0E 0x03 0x26 0x89 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x08 0x03 0x16 0x05 0x8D 0x00 0x2E 0x3B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x4B 0x3B 0xAD 0x18 0x8B 0x00 0x4C 0x8D 0x00 0x4D 0x1A 0x03 0x03 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2E 0x3B 0x1A 0x16 0x08 0x03 0x8D 0x00 0x2E 0x3B 0xAD 0x10 0x03 0x8D 0x00 0x44 0x29 0x09 0x03 0x29 0x0A 0x16 0x0A 0x07 0x6D 0x21 0xAD 0x09 0x16 0x0A 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x09 0x6B 0x0F 0xAD 0x0A 0x16 0x0A 0x24 0x1A 0x8E 0x02 0x00 0x20 0x00 0x70 0x0B 0x16 0x0A 0x04 0x41 0x5B 0x29 0x0A 0x70 0xDE 0xAD 0x13 0x03 0x16 0x05 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2E 0x29 0x06 0xAD 0x13 0x16 0x06 0x11 0x90 0x00 0x8D 0x00 0x2E 0x3B 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x46 0xAD 0x14 0xAD 0x13 0x03 0x07 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x0A 0x1A 0x03 0x16 0x05 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x11 0x03 0x1A 0x16 0x06 0x10 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x40 0x29 0x06 0x19 0x03 0x16 0x06 0x03 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x03 0x03 0x38 0x7A 0x05 0x22 0xAD 0x0F 0x04 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0xAD 0x15 0x8B 0x00 0x42 0x61 0x0C 0xAE 0x0D 0x60 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x0C 0x04 0x41 0x89 0x0C 0xAD 0x06 0x03 0x1A 0x03 0x07 0x8D 0x00 0x40 0x32 0xAD 0x07 0x03 0x1A 0x1F 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x40 0x32 0x1A 0x1F 0xAF 0x0C 0x8D 0x00 0x2E 0x32 0x19 0x03 0x1F 0x03 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x04 0x04 0x38 0x7A 0x07 0x27 0xAD 0x0F 0x04 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x61 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x32 0x1A 0x07 0x25 0x29 0x04 0x16 0x04 0x10 0x08 0x43 0x08 0x41 0x29 0x05 0x1A 0x03 0xAD 0x13 0x03 0x16 0x05 0x8D 0x00 0x40 0x29 0x06 0x1A 0x16 0x06 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x03 0x10 0x08 0x8D 0x00 0x40 0x29 0x06 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x05 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x13 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0xAD 0x11 0x03 0x10 0x08 0x8B 0x00 0x48 0x29 0x07 0x16 0x07 0x61 0x08 0x11 0x91 0x05 0x8D 0x00 0x2D 0x1A 0x10 0x0D 0x25 0x73 0x00 0x80 0xFF 0xC1 0xFF 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xCD 0x00 0x21 0x00 0x2E 0x00 0x80 0x00 0x80 0x00 0x37 0x00 0x40 0x00 0x49 0x00 0x51 0x00 0x59 0x00 0x60 0x00 0x68 0x00 0x70 0x00 0x78 0x18 0x19 0xAD 0x15 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x4E 0x18 0x8C 0x00 0x4F 0x70 0x5A 0x18 0x19 0xAD 0x16 0x8C 0x00 0x4E 0x70 0x51 0x18 0x19 0xAD 0x07 0x8C 0x00 0x50 0x70 0x48 0x18 0x19 0xAD 0x06 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x50 0x70 0x3F 0x18 0x19 0x05 0x8C 0x00 0x51 0x70 0x37 0x18 0x19 0x07 0x8C 0x00 0x51 0x70 0x2F 0x18 0x19 0x8C 0x00 0x52 0x70 0x28 0x18 0x19 0x03 0x8C 0x00 0x53 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x20 0x18 0x19 0x04 0x8C 0x00 0x53 0x70 0x18 0x18 0x19 0x05 0x8C 0x00 0x53 0x70 0x10 0x18 0x19 0x06 0x8C 0x00 0x53 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x13 0x03 0x11 0x90 0x00 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x03 0x05 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x08 0xAD 0x11 0x03 0x1A 0x03 0x10 0x08 0x8D 0x00 0x40 0x3B 0x19 0x03 0x10 0x08 0x8B 0x00 0x41 0xAD 0x0F 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x38 0x7A 0x04 0x25 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x32 0x03 0x29 0x04 0x19 0x8B 0x00 0x43 0x29 0x05 0x16 0x05 0x1F 0x6D 0x08 0x11 0x67 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0x1A 0x06 0x25 0x29 0x06 0x16 0x06 0x75 0x00 0x45 0x00 0x02 0xFF 0x81 0x00 0x0D 0xFF 0x82 0x00 0x29 0xAD 0x15 0x1A 0x08 0x1F 0x8B 0x00 0x54 0x61 0x36 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x15 0x8B 0x00 0x55 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x2D 0x70 0x24 0xAD 0x16 0x1A 0x08 0x1F 0x8B 0x00 0x54 0x61 0x1A 0xAD 0x16 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x55 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x2D 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x7A 0x03 0x34 0xAD 0x08 0x03 0x8D 0x00 0x44 0x29 0x04 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x05 0x8D 0x00 0x44 0x29 0x05 0xAD 0x08 0x07 0x8D 0x00 0x44 0x29 0x06 0x1D 0x75 0x00 0x47 0x00 0x02 0x00 0x01 0x00 0x0D 0x00 0x02 0x00 0x27 0x16 0x04 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x32 0xAD 0x0E 0x04 0x1F 0x39 0x1F 0x16 0x05 0x6E 0x05 0x1F 0x63 0x30 0x11 0x91 0x01 0x8D 0x00 0x2D 0x70 0x28 0x1E 0x16 0x06 0x6F 0x08 0x11 0x91 0x03 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0x16 0x04 0x1E 0x43 0x32 0xAD 0x0E 0x04 0x1F 0x39 0x1F 0x63 0x10 0x11 0x91 0x02 0x8D 0x00 0x2D 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0xAD 0x0E 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x04 0x39 0x16 0x04 0x78 0x05 0x31 0x19 0x8B 0x00 0x32 0x2E 0x1A 0x1B 0x10 0x0F 0x1B 0x10 0x0E 0x25 0x8B 0x00 0x56 0x7A 0x02 0x10 0xAE 0x0D 0x61 0x06 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x88 0x0D 0x7A 0x06 0x31 0x19 0x8B 0x00 0x32 0x2E 0x1B 0x10 0x0F 0x1A 0x03 0x1B 0x10 0x0E 0x25 0x8D 0x00 0x40 0x3B 0x18 0x19 0x8C 0x00 0x52 0x7A 0x05 0x31 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2E 0x1B 0x10 0x0F 0xAD 0x08 0x1E 0x05 0x8D 0x00 0x40 0x3B 0x7A 0x06 0x23 0x19 0x8B 0x00 0x32 0x2D 0xAD 0x17 0x1A 0x10 0x0D 0x25 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x57 0x32 0x1F 0x61 0x25 0x1A 0x10 0x0E 0x25 0x05 0x41 0x90 0x0B 0x28 0x04 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x40 0x3B 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0x15 0x04 0x8B 0x00 0x58 0x70 0x1A 0xAD 0x17 0x1F 0x8B 0x00 0x59 0x28 0x04 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x40 0x3B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x03 0x22 0x19 0x8B 0x00 0x32 0x2D 0x19 0x8B 0x00 0x43 0x3B 0x1A 0x05 0x25 0x05 0x6B 0x31 0x1A 0x07 0x25 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x8D 0x00 0x44 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0E 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x7A 0x04 0x26 0x01 0x2D 0x03 0x32 0x19 0x8B 0x00 0x32 0x28 0x04 0x15 0x04 0x05 0x25 0x29 0x05 0x15 0x04 0x06 0x25 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x16 0x06 0x06 0x4F 0x61 0x17 0xAD 0x0E 0x08 0x26 0x61 0x0A 0x11 0x69 0x86 0x8D 0x00 0x2D 0x70 0x35 0xAD 0x0E 0x08 0x26 0x32 0x70 0x2E 0x16 0x06 0x06 0x4F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x1F 0x53 0x29 0x07 0x10 0x91 0x16 0x07 0x8D 0x00 0x5A 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0E 0x08 0x1F 0x39 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x1F 0x73 0x00 0x29 0x91 0x02 0x91 0x04 0x00 0x1C 0x00 0x0D 0x00 0x0D 0xAD 0x16 0x8B 0x00 0x42 0x61 0x17 0x11 0x69 0x82 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2D 0x70 0x0F 0xAD 0x15 0x8B 0x00 0x42 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x16 0x06 0x10 0x07 0x53 0x29 0x06 0x16 0x06 0x07 0x53 0x60 0x57 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x07 0x6B 0x4A 0x16 0x05 0x61 0x08 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x1F 0x73 0x00 0x31 0x91 0x02 0x91 0x04 0x00 0x29 0x00 0x1F 0x00 0x0D 0x16 0x05 0x04 0x6B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0xAD 0x08 0x2D 0x70 0x1C 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x14 0xAD 0x18 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x0A 0xAD 0x17 0x16 0x05 0x8B 0x00 0x59 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x9F 0x00 0x7E 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x70 0x75 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x70 0x6D 0x16 0x06 0x61 0x63 0x1F 0x73 0x00 0x5E 0x91 0x02 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x41 0x00 0x22 0x00 0x0D 0xAD 0x08 0x03 0x25 0x16 0x05 0x6B 0x07 0xAD 0x08 0x2D 0x70 0x46 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x3E 0xAD 0x18 0x16 0x05 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x5B 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x29 0xAD 0x18 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x1F 0xAD 0x17 0x16 0x05 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x57 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x0A 0xAD 0x17 0x16 0x05 0x8B 0x00 0x59 0x2D 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x5C 0x29 0x07 0x1A 0x92 0x16 0x07 0x6D 0x06 0x1A 0x92 0x29 0x07 0x19 0x16 0x07 0x8B 0x00 0x5D 0x19 0x1A 0x03 0x16 0x07 0x8B 0x00 0x5E 0x7A 0x04 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2E 0xAD 0x09 0x1E 0x1B 0x10 0x0F 0x8D 0x00 0x44 0x39 0xAD 0x09 0x1E 0x26 0x60 0x35 0x1B 0x10 0x11 0x1B 0x10 0x0E 0x25 0x05 0x43 0x5B 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x5F 0x28 0x04 0x15 0x04 0x66 0x1D 0xAD 0x0A 0x1E 0x15 0x04 0x03 0x8D 0x00 0x60 0x94 0x00 0x00 0x20 0x37 0xAD 0x0A 0x1E 0x24 0x67 0x0E 0xAD 0x09 0x1E 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x39 0x70 0x07 0xAD 0x09 0x1E 0x03 0x39 0xAD 0x09 0x1E 0x26 0x61 0x16 0x1B 0x10 0x0E 0x05 0x38 0x1B 0x10 0x0F 0x1B 0x92 0x10 0x0D 0x43 0x05 0x43 0x03 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x61 0x3B 0x18 0x19 0x8C 0x00 0x52 0x7A 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x1D 0x91 0x00 0x63 0x87 0x19 0x18 0x03 0x88 0x1A 0x7A 0x01 0x10 0xAE 0x1A 0x78 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x20 0xAD 0x19 0x92 0xAE 0x1A 0x6B 0x08 0x11 0x6A 0x84 0x8D 0x00 0x2D 0xAD 0x19 0x18 0x3D 0x84 0x1A 0x3F 0x12 0x04 0x41 0x5B 0x88 0x1A 0x8F 0x00 0x63 0x3D 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x64 0x37 0x7A 0x03 0x20 0x1D 0x65 0x07 0x1D 0xAE 0x1A 0x6F 0x04 0x01 0x77 0xAD 0x19 0x1D 0x04 0x43 0x24 0x83 0x03 0x77 0x02 0x23 0xAE 0x1A 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x78 0xAE 0x1A 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x59 0x28 0x04 0x1D 0x61 0x04 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x19 0x87 0x03 0x7A 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x1D 0x90 0x0B 0x87 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x01 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x13 0x08 0x00 0x10 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x03 0xA5 0x01 0x42 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x96 0x00 0x65 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x02 0x00 0x36 0x00 0x02 0x00 0x00 0x03 0x02 0x00 0x12 0x04 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x09 0x02 0x00 0x12 0x0A 0x02 0x00 0x12 0x0B 0x02 0x00 0x12 0x0D 0x02 0x00 0x12 0x0E 0x02 0x00 0x12 0x11 0x02 0x00 0x12 0x12 0x02 0x00 0x12 0x13 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x07 0x02 0x00 0x12 0x08 0x02 0x00 0x12 0x05 0x02 0x00 0x12 0x06 0x02 0x00 0x12 0x0F 0x02 0x00 0x12 0x0C 0x02 0x00 0x12 0x10 0x02 0x00 0x12 0x02 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x02 0x00 0x12 0x00 0x02 0x00 0x12 0x01 0x02 0x00 0x24 0x00 0x02 0x00 0x24 0x01 0x06 0x81 0x08 0x0D 0x03 0x00 0x00 0x80 0x06 0x80 0x00 0x00 0x06 0x83 0x0D 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x0A 0x00 0x01 0x82 0x00 0x00 0x01 0x00 0x12 0x00 0x06 0x83 0x0F 0x00 0x06 0x00 0x00 0xD8 0x01 0x81 0x09 0x00 0x06 0x81 0x09 0x00 0x06 0x81 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x0B 0x71 0x01 0x00 0x24 0x00 0x06 0x00 0x0A 0xE5 0x06 0x81 0x08 0x0F 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x06 0x81 0x07 0x01 0x06 0x81 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x06 0x03 0x81 0x03 0x01 0x03 0x81 0x03 0x02 0x03 0x81 0x09 0x05 0x03 0x81 0x0A 0x01 0x03 0x81 0x0A 0x0E 0x06 0x00 0x02 0xCB 0x06 0x00 0x03 0xA7 0x06 0x00 0x05 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x91 0x06 0x00 0x05 0xF7 0x06 0x00 0x07 0x40 0x03 0x81 0x03 0x03 0x06 0x00 0x02 0x82 0x06 0x00 0x08 0xBE 0x06 0x00 0x09 0x06 0x06 0x81 0x08 0x03 0x03 0x81 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x05 0x00 0x00 0x00 0x06 0x81 0x10 0x02 0x03 0x81 0x0A 0x08 0x03 0x81 0x09 0x04 0x03 0x81 0x0A 0x06 0x06 0x81 0x10 0x04 0x06 0x00 0x07 0xB2 0x03 0x83 0x0F 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x03 0x83 0x0F 0x05 0x03 0x83 0x0F 0x07 0x03 0x00 0x00 0x82 0x06 0x81 0x08 0x01 0x06 0x81 0x10 0x01 0x03 0x00 0x00 0x83 0x06 0x81 0x08 0x02 0x06 0x00 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x23 0x06 0x00 0x08 0x36 0x06 0x00 0x08 0x41 0x06 0x00 0x08 0x5B 0x06 0x00 0x08 0x6E 0x06 0x00 0x0A 0x7B 0x03 0x81 0x09 0x01 0x03 0x81 0x09 0x02 0x03 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x08 0x03 0x00 0x24 0x04 0x03 0x00 0x24 0x02 0x03 0x00 0x24 0x03 0x06 0x81 0x10 0x05 0x03 0x00 0x00 0x81 0x03 0x81 0x0A 0x07 0x03 0x81 0x0A 0x09 0x03 0x81 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x05 0x06 0x81 0x08 0x0B 0x06 0x81 0x08 0x04 0x06 0x81 0x10 0x03 0x06 0x81 0x08 0x0C 0x01 0x00 0x36 0x00 0x06 0x00 0x0B 0x66 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x01 0xAD 0x00 0xC4 0x0A 0x09 0x03 0x05 0x05 0x04 0x1B 0x0D 0x0C 0x05 0x04 0x07 0x07 0x29 0x02 0x03 0x09 0x07 0x02 0x06 0x04 0x07 0x02 0x06 0x45 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x06 0x06 0x0B 0x06 0x07 0x04 0x04 0x04 0x09 0x08 0x08 0x09 0x0E 0x09 0x02 0x02 0x0F 0x0D 0x0D 0x0C 0x0E 0x02 0x24 0x05 0xD8 0x0C 0x33 0x0C 0x0F 0x06 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x0B 0x20 0x02 0x08 0x02 0x06 0x08 0x08 0x16 0x08 0x33 0x05 0x06 0x08 0x0C 0x0F 0x08 0x02 0x08 0x02 0x06 0x02 0x05 0x15 0x13 0x22 0x13 0x0C 0x0D 0x08 0x10 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x13 0x0B 0x04 0x02 0x14 0x17 0x10 0x09 0x16 0x0A 0x0B 0x02 0x08 0x02 0x06 0x02 0x04 0x11 0x16 0x08 0x0C 0x07 0x21 0x04 0x02 0x0A 0x0C 0x0E 0x08 0x36 0x0D 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x08 0x02 0x06 0x02 0x05 0x3B 0x0D 0x09 0x09 0x44 0x0B 0x02 0x08 0x02 0x06 0x02 0x04 0x08 0x12 0x39 0x0A 0x12 0x0A 0x1B 0x08 0x08 0x1B 0x25 0x16 0x1E 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x27 0x10 0x27 0x09 0x4B 0x34 0x0E 0x26 0x1B 0x0F 0x3C 0x0D 0x0A 0x2E 0x08 0x0D 0x15 0x0A 0x15 0x36 0x0A 0x19 0x0E 0x06 0x07 0x05 0x2B 0x04 0x05 0x05 0x03 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x04 0x07 0x12 0x06 0x06 0x05 0x06 0x2F 0x0D 0x00 0xE5 0x05 0x13 0x0F 0x05 0x1D 0x2D 0x57 0x07 0x08 0x60 0x15 0x08 0x08 0x09 0x0A 0x04 0x09 0x0B 0x08 0x06 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x07 0x06 0x06 0x06 0x08 0x09 0x0E 0x0C 0x08 0x05 0x07 0x05 0x1F 0x07 0x07 0x07 0x08 0x0E 0x0D 0x07 0x07 0x0E 0x08 0x07 0x10 0x05 0x0F 0x06 0x06 0x04 0x0E 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0F 0x05 0x08 0x04 0x0E 0x0B 0x04 0x0F 0x0F 0x18 0x0A 0x0C 0x0A 0x0A 0x0B 0x09 0x0E 0x0D 0x0B 0x14 0x04 0x0E 0x10 0x04 0x1B 0x0D 0x0E 0x0A 0x09 0x0F 0x08 0x16 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0C 0x0C 0x13 0x0B 0x06 0x05 0x0E 0x06 0x03 0x0B 0x0C 0x0B 0x06 0x05 0x0F 0x0B 0x06 0x03 0x06 0x08 0x07 0x1D 0x14 0x0C 0x0A 0x09 0x0C 0x09 0x0D 0x0B 0x14 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0C 0x04 0x11 0x11 0x0A 0x08 0x09 0x14 0x04 0x11 0x04 0x19 0x0D 0x0B 0x09 0x0F 0x0C 0x2C 0x04 0x09 0x09 0x09 0x08 0x08 0x07 0x08 0x08 0x08 0x08 0x08 0x09 0x0B 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x0C 0x0C 0x08 0x0C 0x0C 0x0D 0x1C 0x07 0x0B 0x0A 0x07 0x0B 0x08 0x09 0x08 0x08 0x28 0x0D 0x13 0x08 0x0F 0x0C 0x12 0x0D 0x06 0x07 0x0B 0x08 0x0A 0x1D 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x11 0x08 0x05 0x13 0x05 0x1C 0x08 0x0B 0x20 0x19 0x1C 0x13 0x08 0x07 0x08 0x1C 0x1E 0x09 0x0A 0x0B 0x08 0x27 0x09 0x0C 0x09 0x0A 0x0C 0x09 0x09 0x04 0x12 0x7F; -0x80 0xB4 0x09 0x00 0x10 0x08 0x07 0x0A 0x14 0x0F 0x04 0x2C 0x06 0x07 0x05 0x1B 0x10 0x05 0x29 0x23 0x0B 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x15 0x00 0x62 0x00 0x12 0x01 0xCB 0x00 0x0A 0x00 0x3C 0x00 0x00 0x00 0xD6 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x01 0x00 0x41 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x15 0x06 0x00 0x12 0x00 0x80 0x03 0x02 0x00 0x01 0x04 0x04 0x00 0x00 0x00 0x5C 0xFF 0xFF 0x00 0x4F 0x00 0x64 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x01 0xCB 0x00 0x05 0x43 0x18 0x8C 0x00 0x03 0x18 0x8F 0x00 0x13 0x3D 0x06 0x10 0x08 0x8C 0x00 0x02 0x87 0x00 0x19 0x1E 0x25 0x29 0x04 0x1E 0x16 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x05 0x1E 0x16 0x05 0x41 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x06 0xAD 0x00 0x19 0x1E 0x04 0x41 0x16 0x06 0x8B 0x00 0x04 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x05 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x10 0xAD 0x00 0x8B 0x00 0x08 0x61 0x04 0x03 0x78 0x04 0x78 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0xAD 0x00 0x8B 0x00 0x09 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x0B 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0C 0x1A 0x03 0x25 0x10 0x80 0x6A 0x08 0x11 0x6E 0x00 0x8D 0x00 0x0C 0x1A 0x04 0x25 0x75 0x00 0x2D 0x00 0x04 0x00 0x20 0x00 0x27 0x00 0x30 0x00 0x21 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x40 0x00 0x1B 0x00 0x50 0x00 0x15 0x18 0x19 0x8C 0x00 0x0D 0x7A 0x18 0x19 0x8C 0x00 0x0E 0x7A 0x18 0x19 0x8C 0x00 0x0F 0x7A 0x18 0x19 0x8C 0x00 0x10 0x7A 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x0C 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x12 0x5B 0x29 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x63 0x08 0x11 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x41 0x11 0x7F 0xFF 0x6F 0x08 0x11 0x6A 0x84 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x41 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x00 0x12 0x5B 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x05 0x63 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x43 0x63 0x08 0x11 0x6A 0x85 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x43 0x89 0x01 0x7A 0x04 0x22 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0A 0x2D 0x19 0x8B 0x00 0x14 0x32 0x1F 0x05 0x6D 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x19 0x05 0x8B 0x00 0x15 0x1A 0x03 0xAF 0x01 0x10 0x08 0x4F 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0xAF 0x01 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x03 0x05 0x8B 0x00 0x16 0x7A 0x04 0x22 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x12 0x5B 0x32 0xAD 0x00 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x0E 0x08 0x1F 0x8B 0x00 0x17 0x61 0x08 0x11 0x63 0x00 0x8D 0x00 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x62 0x00 0x18 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x06 0x80 0x09 0x00 0x06 0x80 0x03 0x00 0x03 0x80 0x09 0x08 0x03 0x80 0x03 0x01 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x09 0x02 0x03 0x80 0x09 0x05 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x06 0x00 0x01 0x78 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x1F 0x06 0x00 0x00 0xC3 0x06 0x00 0x01 0xAD 0x03 0x80 0x09 0x04 0x03 0x80 0x0A 0x06 0x01 0x80 0x09 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x04 0x03 0x80 0x09 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x3C 0x00 0x0F 0x13 0x1F 0x20 0x0D 0x67 0x41 0x11 0x05 0x05 0x41 0x0E 0x05 0x20 0x09 0x1C 0x00 0x29 0x05 0x04 0x07 0x2A 0x04 0x06 0x07 0x09 0x0D 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x1F 0x05 0x10 0x0D 0x1D 0x06 0x06 0x06 0x07 0x08 0x08 0x04 0x09 0x12 0x15 0x10 0x10 0x08 0x04 0x09 0x12 0x15 0x0D 0x0F 0x05 0x0B 0x05 0x19 0x07 0x05 0x0A 0x08 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x34 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x20 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x34 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0x52 0x00 0x66 0x00 0xBF 0x00 0x0A 0x00 0x29 0x00 0x00 0x01 0x3F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x00 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x01 0x00 0x35 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x66 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x00 0x82 0x03 0x03 0x00 0x03 0x07 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x40 0x22 0x83 0x05 0x02 0x00 0x01 0x01 0x05 0x00 0x00 0x00 0x5A 0x00 0x72 0x00 0x95 0x00 0xB5 0x00 0xBA 0x81 0x00 0x00 0x00 0x0A 0x05 0x05 0x03 0x02 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x04 0x05 0x15 0x44 0x00 0x00 0x01 0x27 0x78 0x00 0x02 0x04 0x93 0x57 0x00 0x04 0x03 0xEC 0xA8 0x00 0x06 0x05 0xF1 0x0F 0x00 0x04 0x02 0x00 0x09 0x50 0x75 0x72 0x7F; -0x80 0xB4 0x06 0x00 0x09 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xBF 0x00 0x04 0x10 0x18 0x8C 0x00 0x10 0x18 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x09 0x87 0x00 0x18 0x8F 0x00 0x11 0x3D 0x04 0x8C 0x00 0x05 0x87 0x01 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8F 0x00 0x07 0x3D 0xAD 0x00 0x8C 0x00 0x08 0x87 0x02 0xAD 0x01 0xAD 0x02 0x05 0x8B 0x00 0x0A 0x18 0x8B 0x00 0x0B 0x7A 0x02 0x30 0x8F 0x00 0x0C 0x3D 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x3B 0x7A 0x02 0x20 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x7A 0x02 0x10 0x18 0x8C 0x00 0x0F 0x18 0x03 0x89 0x03 0x18 0x08 0x90 0x0B 0x87 0x04 0x7A 0x05 0x20 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x19 0x03 0xAD 0x04 0x03 0x08 0x8D 0x00 0x13 0x3B 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAF 0x03 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x41 0x89 0x03 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x12 0xAF 0x03 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x43 0x89 0x03 0x7A 0x01 0x10 0xAD 0x04 0x77 0x01 0x10 0xAF 0x7F; -0x80 0xB4 0x07 0x00 0x02 0x03 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x52 0x00 0x14 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x01 0x02 0x00 0x1F 0x01 0x02 0x00 0x1F 0x00 0x06 0x83 0x06 0x00 0x01 0x00 0x1F 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x04 0x00 0x06 0x83 0x04 0x00 0x06 0x00 0x00 0x49 0x03 0x83 0x06 0x01 0x03 0x82 0x03 0x01 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x03 0x83 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x15 0x04 0x06 0x83 0x05 0x00 0x06 0x82 0x03 0x00 0x01 0x83 0x06 0x00 0x06 0x82 0x0F 0x02 0x06 0x82 0x10 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x29 0x00 0x12 0x10 0x0B 0x07 0x05 0x02 0x02 0x18 0x0F 0x06 0x12 0x14 0x11 0x04 0x0E 0x0E 0x04 0x05 0x05 0x00 0x13 0x05 0x04 0x04 0x06 0x05 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x0C 0x0A 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x0D 0x0F 0x14 0x0C 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x3A 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x26 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x1D 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x53 0x65 0x63 0x75 0x72 0x65 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x3A 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0xBE 0x00 0xAF 0x03 0x3B 0x00 0x14 0x00 0x81 0x00 0x00 0x02 0x4B 0x00 0x00 0x00 0x04 0x00 0x02 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x04 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x01 0x02 0x0D 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0xAF 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x02 0x82 0x03 0x04 0x00 0x02 0x01 0x15 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x38 0x00 0xEC 0x01 0x5E 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xFF 0xFF 0xFF 0xFF 0x00 0x50 0x00 0x5D 0x01 0xA4 0x82 0x00 0x03 0x01 0x02 0x03 0x82 0x01 0x06 0x01 0x02 0x03 0x14 0x15 0x13 0x00 0x83 0x03 0x01 0x00 0x01 0x07 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x00 0x00 0x02 0x18 0x22 0x82 0x05 0x03 0x00 0x02 0x01 0x05 0x00 0x00 0x02 0x36 0x02 0x76 0x02 0xB9 0x02 0xDE 0x03 0x16 0x81 0x00 0x00 0x00 0x0A 0x05 0x03 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x02 0x04 0x05 0x05 0x15 0x44 0x00 0x00 0x04 0x27 0x78 0x00 0x02 0x05 0x93 0x57 0x00 0x04 0x01 0xEC 0xA8 0x00 0x06 0x03 0xF1 0x0F 0x00 0x04 0x02 0x00 0x0F 0x7F; -0x80 0xB4 0x06 0x00 0x12 0x53 0x65 0x63 0x75 0x72 0x65 0x50 0x75 0x72 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x3B 0x00 0x05 0x10 0x18 0x8C 0x00 0x22 0x18 0x01 0x87 0x00 0x18 0x8F 0x00 0x09 0x3D 0x05 0x05 0x8C 0x00 0x0A 0x87 0x01 0x18 0x8F 0x00 0x09 0x3D 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8C 0x00 0x0A 0x87 0x00 0xAD 0x01 0x7B 0x00 0x29 0x03 0x05 0x8B 0x00 0x2A 0xAD 0x00 0x7B 0x00 0x2B 0x03 0x05 0x8B 0x00 0x2A 0x7A 0x02 0x20 0x18 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x60 0x0C 0x18 0x03 0x88 0x02 0x18 0x03 0x88 0x03 0x03 0x78 0x18 0x19 0x8C 0x00 0x0B 0x78 0x02 0x20 0xAE 0x02 0x1D 0x53 0x60 0x05 0x04 0x70 0x03 0x03 0x78 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x20 0xAE 0x03 0x1D 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x03 0x20 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x18 0x19 0x8C 0x00 0x0D 0x60 0x0C 0x18 0x3D 0x84 0x02 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x55 0x88 0x02 0x70 0x0B 0x18 0x3D 0x84 0x02 0x10 0xFD 0x53 0x88 0x02 0x03 0x78 0x04 0x24 0x19 0x8B 0x00 0x0E 0x2D 0x19 0x8B 0x00 0x0F 0x61 0x04 0x03 0x78 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0E 0x03 0x3E 0x25 0x10 0xF3 0x53 0x38 0x1A 0x07 0x25 0x32 0x1F 0x05 0x6D 0x04 0x03 0x78 0x03 0x29 0x04 0x1A 0x07 0x3E 0x25 0x05 0x43 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x25 0x32 0x08 0x29 0x05 0x16 0x05 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x29 0x05 0x16 0x04 0x16 0x05 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x04 0x20 0x18 0x19 0x8C 0x00 0x11 0x60 0x69 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x07 0x25 0x05 0x6B 0x4F 0x18 0x03 0x88 0x03 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x06 0x88 0x03 0x18 0x19 0x03 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x35 0xAD 0x00 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x04 0x88 0x03 0x18 0x19 0x03 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x16 0x18 0x19 0x11 0x66 0x66 0x8B 0x00 0x15 0x3B 0x70 0x0B 0x18 0x19 0x11 0x65 0x65 0x8B 0x00 0x15 0x3B 0x04 0x78 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x04 0x24 0x18 0x8B 0x00 0x08 0x60 0x04 0x03 0x78 0x19 0x8B 0x00 0x0E 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x03 0x29 0x04 0x08 0x29 0x05 0x16 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x16 0x04 0x8D 0x00 0x16 0x3B 0x1A 0x07 0x3E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x05 0x41 0x5B 0x38 0x03 0x78 0x01 0x20 0x03 0x78 0x02 0x20 0x18 0x19 0x8B 0x00 0x17 0x10 0x80 0x6B 0x0E 0x18 0x19 0x8B 0x00 0x18 0x10 0x39 0x6B 0x05 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x03 0x03 0x78 0x04 0x13 0x18 0x8C 0x00 0x19 0x8F 0x00 0x1A 0x3D 0x8C 0x00 0x1B 0x2C 0x8F 0x00 0x1C 0x3D 0x19 0x8C 0x00 0x1D 0x2D 0x8F 0x00 0x1E 0x3D 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x1F 0x2E 0x18 0x8F 0x00 0x20 0x3D 0x07 0x8C 0x00 0x21 0x87 0x04 0xAD 0x04 0x19 0x04 0x8B 0x00 0x23 0xAD 0x04 0x19 0x05 0x8B 0x00 0x23 0xAD 0x04 0x1B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8B 0x00 0x23 0xAD 0x04 0x19 0x06 0x8B 0x00 0x23 0x18 0x8B 0x00 0x24 0x7A 0x02 0x30 0x8F 0x00 0x25 0x3D 0x8C 0x00 0x26 0x3B 0x7A 0x02 0x20 0xAD 0x04 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x27 0x7A 0x02 0x20 0x18 0x8C 0x00 0x28 0x18 0x03 0x89 0x05 0x18 0x19 0x87 0x06 0x18 0x08 0x90 0x0B 0x87 0x07 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x43 0x89 0x05 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x41 0x89 0x05 0x7A 0x02 0x10 0xAD 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAF 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x05 0x20 0xAD 0x06 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2D 0x19 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x2D 0x19 0x03 0xAD 0x07 0x03 0x08 0x8D 0x00 0x2E 0x3B 0x7A 0x02 0x10 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAD 0x07 0x77 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x17 0x08 0x00 0x14 0x00 0x04 0x00 0x02 0x00 0x02 0x03 0x00 0x02 0x12 0x34 0x03 0x00 0x02 0x43 0x21 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0xBE 0x00 0x2F 0x02 0x00 0x13 0x01 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x03 0x02 0x00 0x56 0x00 0x02 0x00 0x62 0x02 0x02 0x00 0x62 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x02 0x00 0x62 0x00 0x03 0x82 0x03 0x12 0x01 0x83 0x09 0x00 0x06 0x83 0x09 0x00 0x06 0x00 0x00 0x69 0x03 0x82 0x03 0x04 0x06 0x00 0x00 0x8D 0x03 0x83 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x03 0x83 0x0A 0x0D 0x06 0x83 0x10 0x04 0x06 0x00 0x01 0xA8 0x03 0x83 0x09 0x01 0x03 0x82 0x03 0x07 0x03 0x82 0x03 0x0C 0x03 0x82 0x03 0x0B 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x06 0x03 0x82 0x03 0x0E 0x03 0x82 0x03 0x0F 0x06 0x83 0x03 0x00 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x01 0x00 0x62 0x00 0x06 0x00 0x02 0x21 0x01 0x82 0x04 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x82 0x04 0x00 0x01 0x82 0x06 0x00 0x06 0x82 0x06 0x00 0x06 0x82 0x03 0x00 0x03 0x82 0x06 0x01 0x03 0x83 0x03 0x01 0x01 0x00 0x56 0x00 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xC1 0x03 0x82 0x06 0x04 0x06 0x82 0x05 0x00 0x05 0x00 0x00 0x00 0x03 0x83 0x09 0x08 0x05 0x00 0x00 0x02 0x01 0x82 0x01 0x00 0x06 0x83 0x0F 0x02 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x81 0x00 0x2E 0x0A 0x0C 0x0C 0x02 0x0A 0x15 0x04 0x0C 0x0D 0x1B 0x04 0x06 0x05 0x7D 0x02 0x0F 0x10 0x0F 0xB4 0x02 0x07 0x07 0x07 0x19 0x0F 0x04 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x10 0x19 0x0E 0x04 0x05 0x10 0x19 0x11 0x04 0x05 0x10 0x10 0x05 0x10 0x1D 0x0B 0x10 0x10 0x00 0x4F 0x05 0x08 0x06 0x06 0x06 0x07 0x05 0x05 0x05 0x07 0x11 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x21 0x06 0x1D 0x05 0x08 0x3F 0x14 0x07 0x05 0x0F 0x05 0x0C 0x05 0x09 0x05 0x0C 0x05 0x0B 0x0B 0x0B 0x08 0x2D 0x16 0x09 0x0F 0x03 0x04 0x04 0x05 0x04 0x05 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x09 0x07 0x07 0x07 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x07 0x09 0x09 0x0C 0x12 0x09 0x07 0x09 0x09 0x0F 0x12 0x09 0x07 0x09 0x0C 0x09 0x07 0x09 0x0B 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x04 0x0B 0x09 0x07 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -// create JavaPurseCrypto -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 0xb 0x01 0 0x7F; - -// create JavaLoyalty -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 5 0x01 0 0x7F; - -// create wallet applet -0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x08 0 0 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; - -// create RMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0x8 0x01 0x00 0x7F; - -// create SecureRMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0xa 0x01 0x00 0x7F; - - -///////////////////////////////////////////////////////////////////// -// Initialize JavaPurse -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1 -//For the second and consecutive runs it can be 69 82 - -// Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678 -0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x19 0x82 0xd1 0x8e 0x8d 0xe8 0x18 0xdc 0x7F; -// 00 00 00 00 00 00 00 00 90 00 -// For second and consecutive runs it can be 91 04 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2 - -// Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x86 0x39 0x91 0x2c 0x5a 0x10 0x59 0x47 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x95 0xc9 0x3b 0x6f 0x1f 0xdd 0xa1 0x1a 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4 - -// Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x7c 0x17 0xb3 0x12 0x45 0x4a 0x64 0xf7 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0xd7 0xde 0x72 0x80 0x4f 0xa5 0x95 0xb8 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0xa0 0x93 0x8d 0xa0 0x4c 0xb0 0xb4 0x47 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7 - -// Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0xe8 0xe5 0xac 0x09 0xec 0xea 0x5f 0xfe 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8 - -// Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = "0xa0,00,00,00,62,03,01,0c,05,01 " -0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0xb1 0x5d 0x5a 0x4b 0xc1 0x3f 0x62 0x0b 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -////////////////////////////////////////////////////////////////////// -// End of initialization session, all values are set up. -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0xf5 0x4f 0x26 0xeb 0x31 0x8e 0x0e 0x7c 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x3b 0x5d 0x5a 0x80 0xba 0x47 0x08 0xd5 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x5d 0x41 0xe2 0xac 0xa2 0x3d 0xff 0x15 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// A session with various errors at CAD 33445566 -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN (User PIN 01030507) -0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00; -// 69 c4 = SW_PIN_FAILED, 4 tries remained - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00 = SW_NO_ERROR - -// Complete Transaction: Date 10/28/97; Time 18:45 -0x80 0x22 0x00 0x00 0x0d 0x85 0x1f 0x35 0x96 0x53 0xda 0x25 0xa2 0x0a 0x1c 0x61 0x12 0x2d 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:48 -0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F; -// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log - -// Complete Transaction: Date 10/28/97; Time 18:50; -0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE -// (Transaction with a wrong signature is in a way completed, -// We can't retry with another signature.) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x65 0x79 0x7a 0x49 0x24 0x35 0xf5 0x14 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19 - -// Initialize transaction: Debit $30.01 -0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00) - -// Initialize transaction: Credit $127.82 -0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00, -// this transaction would bring it to 320.01) - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19, Max Balance = $320.00, Max Transaction = $30; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -// Read the second record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x02 0x1c 0x00 0x7F; -// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00; -// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed), SW_WRONG_SIGNATURE (9105) -// Attempt of the transaction is recorded, but balance wasn't change, see next record. - -// Read the third record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x03 0x1c 0x00 0x7F; -// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00 -// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000) - -// Read the fifth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x05 0x1c 0x00 0x7F; -// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00; -// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688; -// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000) - -// Read the sixth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x06 0x1c 0x00 0x7F; -// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 -// Empty record - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62) - -// Select File: select EF under current DF (P1 = 0x02); FID = 0x9103 -0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00; -// 90 00; - -// Read the first record in the selected file -// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04 -0x00 0xb2 0x01 0x04 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -///////////////////////////////////////////////////////////// -// Additional JavaPurse tests to increase coverage -///////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Wrong INS for Java Purse CLA -0x80 0x34 0x00 0x00 0x00 0x00; -// 6d 00; - -// Wrong CLA -0x60 0x00 0x00 0x00 0x00 0x00; -// 6e 00; - -// Wrong INS for ISO CLA -0x00 0x74 0x00 0x00 0x00 0x00; -// 6d 00 - -// Initialize transaction: wrong transaction type -0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect P2 -0x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect LC -0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19 - -// Complete Transaction: incorrect LC -0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Complete Transaction: incorrect P1 -0x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Transaction: incorrect P2 -0x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -///////////////////////////////////////////////////////// -// Additional cases for Parameter Update -///////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 6a 86 == SW_INCORRECT_P1P2 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x11 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x11 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F; -// 91 05 == SW_WRONG_SIGNATURE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 81 == SW_FUNC_NOT_SUPPORTED - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x95 0xc9 0x3b 0x6f 0x1f 0xdd 0xa1 0x1a 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize transaction: Debit $199.99 -0x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 02 == SW_NOT_ENOUGH_FUNDS - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -///////////////////////////////////////////////////////////////////// -// Select JavaLoyalty -///////////////////////////////////////////////////////////////////// - -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127; -// 90 00 = SW_NO_ERROR - -// Read Balance -0x80 0x20 0x00 0x00 0x00 0x00; -// 00 16 90 00 = Balance=22 points - -// Reset Balance -0x80 0x22 0x00 0x00 0x00 0x00; -// 90 00 = SW_NO_ERROR - -///////////////////////////////////////////////////////////////////// -// Initialize Wallet -///////////////////////////////////////////////////////////////////// - -//Select Wallet -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Verify user pin -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//90 00 = SW_NO_ERROR - -//Get wallet balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR - -//Attempt to debit from an empty account -0x80 0x40 0x00 0x00 0x01 0x64 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Credit $100 to the empty account -0x80 0x30 0x00 0x00 0x01 0x64 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR - -//Debit $50 from the account -0x80 0x40 0x00 0x00 0x01 0x32 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Credit $128 to the account -0x80 0x30 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $51 from the account -0x80 0x40 0x00 0x00 0x01 0x33 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $128 from the account -0x80 0x40 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Reselect Wallet applet so that userpin is reset -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Credit $127 to the account before pin verification -0x80 0x30 0x00 0x00 0x01 0x7F 0x7F; -//0x6301 = SW_PIN_VERIFICATION_REQUIRED - -//Verify User pin with wrong pin value -0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F; -//0x6300 = SW_VERIFICATION_FAILED - -//Verify user pin again with correct pin value -//0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F; -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//0x9000 = SW_NO_ERROR - -//Get balance with incorrect LE value -0x80 0x50 0x00 0x00 0x00 0x01; -//0x6700 = ISO7816.SW_WRONG_LENGTH - -//Get balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr.expected.out deleted file mode 100644 index 27aace95..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/demo2crypto.scr.expected.out +++ /dev/null @@ -1,120 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Applet creation and functional test section. -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 14, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, 08, 00, 00, 05, 01, 02, 03, 04, 05, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 08, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 08, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0a, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0a, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 01, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1a, 11, 22, 33, 44, 00, 00, 00, 00, c1, 08, 01, 02, 03, 04, 05, 06, 07, 08, 19, 82, d1, 8e, 8d, e8, 18, dc, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 02, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c2, 04, 01, 02, 03, 04, 86, 39, 91, 2c, 5a, 10, 59, 47, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 63, 00, 03, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 95, c9, 3b, 6f, 1f, dd, a1, 1a, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 00, 00, 00, 00, 0c, 1f, 62, 00, 04, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c6, 04, 05, 05, 05, 05, 7c, 17, b3, 12, 45, 4a, 64, f7, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 05, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c7, 02, 7d, 00, d7, de, 72, 80, 4f, a5, 95, b8, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 06, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 0b, b8, a0, 93, 8d, a0, 4c, b0, b4, 47, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 07, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 16, 11, 22, 33, 44, 00, 00, 00, 00, c9, 04, 02, 01, 00, 01, e8, e5, ac, 09, ec, ea, 5f, fe, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 08, SW1: 90, SW2: 00 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 1e, 11, 22, 33, 44, 00, 00, 00, 00, ca, 0c, 33, 55, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, b1, 5d, 5a, 4b, c1, 3f, 62, 0b, Le: 08, 3f, a5, 47, f9, a6, 91, 40, 2f, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 61, a8, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 00, 00, 00, 01, 5b, 3c, 1c, 47, 45, d6, 55, cc, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, f5, 4f, 26, eb, 31, 8e, 0e, 7c, 0a, 1b, 61, 0f, 21, Le: 0a, 61, a8, cb, ee, 4b, 04, c6, 08, f2, 5f, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 09, c4, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 61, a8, 00, 02, 05, 2b, bc, 50, 7a, 67, 84, 59, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 3b, 5d, 5a, 80, ba, 47, 08, d5, 0a, 1b, 61, 0f, 23, Le: 0a, 57, e4, 64, ba, b1, 4d, 4e, d5, 72, ec, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 55, 77, 99, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 57, e4, 00, 03, 7c, 4a, d6, e6, 69, a3, 03, f2, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 5d, 41, e2, ac, a2, 3d, ff, 15, 0a, 1b, 61, 11, 2d, Le: 0a, 4e, ed, 14, 1f, 31, a3, 23, 29, d9, 61, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 03, 05, 07, Le: 00, SW1: 69, SW2: c4 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 85, 1f, 35, 96, 53, da, 25, a2, 0a, 1c, 61, 12, 2d, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 04, 6e, d4, 74, cd, ba, 0c, 60, a9, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 11, 11, 11, 11, 11, 11, 11, 11, 0a, 1c, 61, 12, 30, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 35, a9, 3b, 26, 50, 58, 97, 93, 0a, 1c, 61, 12, 32, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 05, ec, 31, 15, 0d, 78, a0, 16, c7, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 65, 79, 7a, 49, 24, 35, f5, 14, 0a, 1c, 61, 12, 35, Le: 0a, 4b, 13, 53, b9, 82, c7, 70, 4c, 78, 70, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 03 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 31, ee, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 01 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 24, Lc: 00, Le: 06, 4b, 13, 7d, 00, 0b, b8, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 1c, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 02, P2: 1c, Lc: 00, Le: 12, 00, 04, 02, 08, f7, 33, 44, 55, 66, 0a, 1c, 61, 12, 30, 4e, ed, 91, 05, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 03, P2: 1c, Lc: 00, Le: 12, 00, 03, 02, 08, f7, 33, 55, 77, 99, 0a, 1b, 61, 11, 2d, 4e, ed, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 05, P2: 1c, Lc: 00, Le: 12, 00, 01, 01, 61, a8, 22, 44, 66, 88, 0a, 1b, 61, 0f, 21, 61, a8, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 06, P2: 1c, Lc: 00, Le: 12, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: c5, P2: 10, Lc: 00, Le: 05, c5, 03, 0c, 1f, 62, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 02, P2: 0c, Lc: 02, 91, 03, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 04, Lc: 00, Le: 12, 00, 05, 02, 03, da, 33, 44, 55, 66, 0a, 1c, 61, 12, 35, 4b, 13, 90, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 34, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 60, INS: 00, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 99 -CLA: 00, INS: 74, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 6d, SW2: 00 -CLA: 80, INS: 20, P1: 03, P2: 00, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0a, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 20, P1: 02, P2: 11, Lc: 0b, 0b, b9, 33, 44, 55, 66, 00, 00, 00, 00, 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 06, 31, 70, 75, f2, 64, 42, 23, 6c, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0c, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 22, P1: 11, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 22, P1: 00, P2: 11, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 69, SW2: 82 -CLA: 00, INS: 20, P1: 00, P2: 86, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 6a, SW2: 86 -CLA: 00, INS: 20, P1: 00, P2: 81, Lc: 08, 01, 02, 03, 04, 05, 06, 07, 08, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 11, P2: 00, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 11, Lc: 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 09, 05, 05, 05, 05, 0c, 1f, 62, 00, 09, SW1: 90, SW2: 00 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 26, P1: 11, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 11, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 6a, SW2: 86 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 11, 00, 11, 00, 11, 00, 11, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, cf, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 15, 11, 22, 33, 44, 00, 00, 00, 00, c5, 03, 0c, 1f, 62, 00, 00, 00, 00, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 05 -CLA: 80, INS: 24, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 91, SW2: 04 -CLA: 80, INS: 26, P1: 00, P2: 00, Lc: 14, 11, 22, 33, 44, 00, 00, 00, 00, c8, 02, 4e, 20, 95, c9, 3b, 6f, 1f, dd, a1, 1a, Le: 00, SW1: 91, SW2: 05 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4e, 1f, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 03 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4b, 13, 33, 44, 55, 66, 00, 00, 00, 00, Le: 00, SW1: 91, SW2: 03 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 00, SW1: 91, SW2: 04 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 16, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 64, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 64, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 32, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 33, Le: 00, SW1: 6a, SW2: 85 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 01, 80, Le: 00, SW1: 6a, SW2: 83 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 06, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 01, 7f, Le: 00, SW1: 63, SW2: 01 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 04, 01, 03, 02, 66, Le: 00, SW1: 63, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 05, 01, 02, 03, 04, 05, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 67, SW2: 00 -CLA: 80, INS: 50, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 32, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTest.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTest.scr deleted file mode 100644 index 40cdea10..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTest.scr +++ /dev/null @@ -1,532 +0,0 @@ - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -// create JavaPurse -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 2 0x01 0 0x7F; - -// create JavaLoyalty -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 5 0x01 0 0x7F; - -// create wallet applet -0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x08 0 0 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; - -// create RMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0x8 0x01 0x00 0x7F; - -// create SecureRMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0xa 0x01 0x00 0x7F; - -// create photocard applet -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x00 0x7F; - -///////////////////////////////////////////////////////////////////// -// Initialize JavaPurse -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1 -//For the second and consecutive runs it can be 69 82 - -// Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678 -0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00 -// For second and consecutive runs it can be 91 04 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2 - -// Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4 - -// Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7 - -// Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8 - -// Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = "0xa0,00,00,00,62,03,01,0c,05,01 " -0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -////////////////////////////////////////////////////////////////////// -// End of initialization session, all values are set up. -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// A session with various errors at CAD 33445566 -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN (User PIN 01030507) -0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00; -// 69 c4 = SW_PIN_FAILED, 4 tries remained - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00 = SW_NO_ERROR - -// Complete Transaction: Date 10/28/97; Time 18:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x2d 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:48 -0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F; -// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log - -// Complete Transaction: Date 10/28/97; Time 18:50; -0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE -// (Transaction with a wrong signature is in a way completed, -// We can't retry with another signature.) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19 - -// Initialize transaction: Debit $30.01 -0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00) - -// Initialize transaction: Credit $127.82 -0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00, -// this transaction would bring it to 320.01) - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19, Max Balance = $320.00, Max Transaction = $30; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -// Read the second record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x02 0x1c 0x00 0x7F; -// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00; -// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed), SW_WRONG_SIGNATURE (9105) -// Attempt of the transaction is recorded, but balance wasn't change, see next record. - -// Read the third record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x03 0x1c 0x00 0x7F; -// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00 -// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000) - -// Read the fifth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x05 0x1c 0x00 0x7F; -// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00; -// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688; -// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000) - -// Read the sixth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x06 0x1c 0x00 0x7F; -// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 -// Empty record - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62) - -// Select File: select EF under current DF (P1 = 0x02); FID = 0x9103 -0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00; -// 90 00; - -// Read the first record in the selected file -// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04 -0x00 0xb2 0x01 0x04 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -///////////////////////////////////////////////////////////// -// Additional JavaPurse tests to increase coverage -///////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Wrong INS for Java Purse CLA -0x80 0x34 0x00 0x00 0x00 0x00; -// 6d 00; - -// Wrong CLA -0x60 0x00 0x00 0x00 0x00 0x00; -// 6e 00; - -// Wrong INS for ISO CLA -0x00 0x74 0x00 0x00 0x00 0x00; -// 6d 00 - -// Initialize transaction: wrong transaction type -0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect P2 -0x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect LC -0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19 - -// Complete Transaction: incorrect LC -0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Complete Transaction: incorrect P1 -0x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Transaction: incorrect P2 -0x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -///////////////////////////////////////////////////////// -// Additional cases for Parameter Update -///////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 6a 86 == SW_INCORRECT_P1P2 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x11 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x11 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F; -// 91 05 == SW_WRONG_SIGNATURE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 81 == SW_FUNC_NOT_SUPPORTED - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize transaction: Debit $199.99 -0x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 02 == SW_NOT_ENOUGH_FUNDS - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -///////////////////////////////////////////////////////////////////// -// Select JavaLoyalty -///////////////////////////////////////////////////////////////////// - -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127; -// 90 00 = SW_NO_ERROR - -// Read Balance -0x80 0x20 0x00 0x00 0x00 0x00; -// 00 16 90 00 = Balance=22 points - -// Reset Balance -0x80 0x22 0x00 0x00 0x00 0x00; -// 90 00 = SW_NO_ERROR - -///////////////////////////////////////////////////////////////////// -// Initialize Wallet -///////////////////////////////////////////////////////////////////// - -//Select Wallet -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Verify user pin -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//90 00 = SW_NO_ERROR - -//Get wallet balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR - -//Attempt to debit from an empty account -0x80 0x40 0x00 0x00 0x01 0x64 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Credit $100 to the empty account -0x80 0x30 0x00 0x00 0x01 0x64 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR - -//Debit $50 from the account -0x80 0x40 0x00 0x00 0x01 0x32 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Credit $128 to the account -0x80 0x30 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $51 from the account -0x80 0x40 0x00 0x00 0x01 0x33 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $128 from the account -0x80 0x40 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Reselect Wallet applet so that userpin is reset -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Credit $127 to the account before pin verification -0x80 0x30 0x00 0x00 0x01 0x7F 0x7F; -//0x6301 = SW_PIN_VERIFICATION_REQUIRED - -//Verify User pin with wrong pin value -0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F; -//0x6300 = SW_VERIFICATION_FAILED - -//Verify user pin again with correct pin value -//0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F; -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//0x9000 = SW_NO_ERROR - -//Get balance with incorrect LE value -0x80 0x50 0x00 0x00 0x00 0x01; -//0x6700 = ISO7816.SW_WRONG_LENGTH - -//Get balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTestCrypto.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTestCrypto.scr deleted file mode 100644 index 82998d6b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/AppletTestCrypto.scr +++ /dev/null @@ -1,530 +0,0 @@ - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -// create JavaPurseCrypto -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 0xb 0x01 0 0x7F; - -// create JavaLoyalty -0x80 0xB8 0 0 0x0c 0x0a 0xa0 0 0 0 0x62 0x03 0x01 0x0c 5 0x01 0 0x7F; - -// create wallet applet -0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x08 0 0 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; - -// create RMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0x8 0x01 0x00 0x7F; - -// create SecureRMIDemo -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0xc 0xa 0x01 0x00 0x7F; - - -///////////////////////////////////////////////////////////////////// -// Initialize JavaPurse -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1 -//For the second and consecutive runs it can be 69 82 - -// Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678 -0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x19 0x82 0xd1 0x8e 0x8d 0xe8 0x18 0xdc 0x7F; -// 00 00 00 00 00 00 00 00 90 00 -// For second and consecutive runs it can be 91 04 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2 - -// Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x86 0x39 0x91 0x2c 0x5a 0x10 0x59 0x47 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x95 0xc9 0x3b 0x6f 0x1f 0xdd 0xa1 0x1a 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4 - -// Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x7c 0x17 0xb3 0x12 0x45 0x4a 0x64 0xf7 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0xd7 0xde 0x72 0x80 0x4f 0xa5 0x95 0xb8 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0xa0 0x93 0x8d 0xa0 0x4c 0xb0 0xb4 0x47 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7 - -// Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1 -0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0xe8 0xe5 0xac 0x09 0xec 0xea 0x5f 0xfe 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8 - -// Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = "0xa0,00,00,00,62,03,01,0c,05,01 " -0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0xb1 0x5d 0x5a 0x4b 0xc1 0x3f 0x62 0x0b 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -////////////////////////////////////////////////////////////////////// -// End of initialization session, all values are set up. -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0xf5 0x4f 0x26 0xeb 0x31 0x8e 0x0e 0x7c 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x3b 0x5d 0x5a 0x80 0xba 0x47 0x08 0xd5 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x5d 0x41 0xe2 0xac 0xa2 0x3d 0xff 0x15 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// A session with various errors at CAD 33445566 -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN (User PIN 01030507) -0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00; -// 69 c4 = SW_PIN_FAILED, 4 tries remained - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00 = SW_NO_ERROR - -// Complete Transaction: Date 10/28/97; Time 18:45 -0x80 0x22 0x00 0x00 0x0d 0x85 0x1f 0x35 0x96 0x53 0xda 0x25 0xa2 0x0a 0x1c 0x61 0x12 0x2d 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:48 -0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F; -// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log - -// Complete Transaction: Date 10/28/97; Time 18:50; -0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE -// (Transaction with a wrong signature is in a way completed, -// We can't retry with another signature.) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05 - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x65 0x79 0x7a 0x49 0x24 0x35 0xf5 0x14 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19 - -// Initialize transaction: Debit $30.01 -0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00) - -// Initialize transaction: Credit $127.82 -0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00, -// this transaction would bring it to 320.01) - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19, Max Balance = $320.00, Max Transaction = $30; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -// Read the second record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x02 0x1c 0x00 0x7F; -// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00; -// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed), SW_WRONG_SIGNATURE (9105) -// Attempt of the transaction is recorded, but balance wasn't change, see next record. - -// Read the third record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x03 0x1c 0x00 0x7F; -// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00 -// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000) - -// Read the fifth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x05 0x1c 0x00 0x7F; -// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00; -// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688; -// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000) - -// Read the sixth record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x06 0x1c 0x00 0x7F; -// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 -// Empty record - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Read Expiration Date from Parameters file -// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10; -0x00 0xb2 0xc5 0x10 0x00 0x7F; -// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62) - -// Select File: select EF under current DF (P1 = 0x02); FID = 0x9103 -0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00; -// 90 00; - -// Read the first record in the selected file -// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04 -0x00 0xb2 0x01 0x04 0x00 0x7F; -// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 -// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566; -// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000) - -///////////////////////////////////////////////////////////// -// Additional JavaPurse tests to increase coverage -///////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Wrong INS for Java Purse CLA -0x80 0x34 0x00 0x00 0x00 0x00; -// 6d 00; - -// Wrong CLA -0x60 0x00 0x00 0x00 0x00 0x00; -// 6e 00; - -// Wrong INS for ISO CLA -0x00 0x74 0x00 0x00 0x00 0x00; -// 6d 00 - -// Initialize transaction: wrong transaction type -0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect P2 -0x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize transaction: incorrect LC -0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19 - -// Complete Transaction: incorrect LC -0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 67 00 == SW_WRONG_LENGTH - -// Complete Transaction: incorrect P1 -0x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Transaction: incorrect P2 -0x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -///////////////////////////////////////////////////////// -// Additional cases for Parameter Update -///////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 69 82 = SW "Security Status Not Satisfied" : must present PIN first - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 6a 86 == SW_INCORRECT_P1P2 - -// Verify PIN : Master PIN -0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00; -// 90 00; - -// Initialize Parameter Update -0x80 0x24 0x11 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x11 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 86 == SW_INCORRECT_P1P2 - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F; -// 91 05 == SW_WRONG_SIGNATURE - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 6a 81 == SW_FUNC_NOT_SUPPORTED - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98 -0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE - -// Initialize Parameter Update -0x80 0x24 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10 - -// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00; -0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x95 0xc9 0x3b 0x6f 0x1f 0xdd 0xa1 0x1a 0x7F; -// 00 00 00 00 00 00 00 00 90 00; - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize transaction: Debit $199.99 -0x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 91 02 == SW_NOT_ENOUGH_FUNDS - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -///////////////////////////////////////////////////////////////////// -// Select JavaLoyalty -///////////////////////////////////////////////////////////////////// - -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127; -// 90 00 = SW_NO_ERROR - -// Read Balance -0x80 0x20 0x00 0x00 0x00 0x00; -// 00 16 90 00 = Balance=22 points - -// Reset Balance -0x80 0x22 0x00 0x00 0x00 0x00; -// 90 00 = SW_NO_ERROR - -///////////////////////////////////////////////////////////////////// -// Initialize Wallet -///////////////////////////////////////////////////////////////////// - -//Select Wallet -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Verify user pin -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//90 00 = SW_NO_ERROR - -//Get wallet balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR - -//Attempt to debit from an empty account -0x80 0x40 0x00 0x00 0x01 0x64 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Credit $100 to the empty account -0x80 0x30 0x00 0x00 0x01 0x64 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR - -//Debit $50 from the account -0x80 0x40 0x00 0x00 0x01 0x32 0x7F; -//0x9000 = SW_NO_ERROR - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Credit $128 to the account -0x80 0x30 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $51 from the account -0x80 0x40 0x00 0x00 0x01 0x33 0x7F; -//0x6A85 = SW_NEGATIVE_BALANCE - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Debit $128 from the account -0x80 0x40 0x00 0x00 0x01 0x80 0x7F; -//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT - -//Get Balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR - -//Reselect Wallet applet so that userpin is reset -0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F; -// 90 00 = SW_NO_ERROR - -//Credit $127 to the account before pin verification -0x80 0x30 0x00 0x00 0x01 0x7F 0x7F; -//0x6301 = SW_PIN_VERIFICATION_REQUIRED - -//Verify User pin with wrong pin value -0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F; -//0x6300 = SW_VERIFICATION_FAILED - -//Verify user pin again with correct pin value -//0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F; -0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F; -//0x9000 = SW_NO_ERROR - -//Get balance with incorrect LE value -0x80 0x50 0x00 0x00 0x00 0x01; -//0x6700 = ISO7816.SW_WRONG_LENGTH - -//Get balance -0x80 0x50 0x00 0x00 0x00 0x02; -//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaLoyalty.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaLoyalty.scr deleted file mode 100644 index 05be4a8b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaLoyalty.scr +++ /dev/null @@ -1,58 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x21 0x00 0x3A 0x00 0x1D 0x00 0xDB 0x00 0x0A 0x00 0x1E 0x00 0x00 0x00 0xAA 0x00 0x00 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x21 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x04 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x1D 0x42 0x80 0x03 0x01 0xFF 0x00 0x05 0x04 0x00 0x02 0x00 0x33 0xFF 0xFF 0x00 0x7F 0x00 0x3C 0x00 0xBE 0x00 0xD4 0x80 0x02 0x00 0x81 0x00 0x01 0x08 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xDB 0x00 0x05 0x30 0x8F 0x00 0x01 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x03 0x3B 0x7A 0x04 0x41 0x18 0x8C 0x00 0x02 0x18 0x03 0x89 0x00 0x19 0x1E 0x25 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x04 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x05 0x7A 0x01 0x30 0x1E 0x61 0x04 0x18 0x77 0x01 0x77 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x21 0x19 0x06 0x8D 0x00 0x06 0x31 0x1E 0x10 0x64 0x47 0x31 0x19 0x05 0x25 0x75 0x00 0x1D 0x00 0x02 0x00 0x01 0x00 0x16 0x00 0x02 0x00 0x0D 0x18 0xAF 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x89 0x00 0x70 0x09 0x18 0xAF 0x00 0x1E 0x43 0x89 0x00 0xAF 0x00 0x63 0x06 0x18 0x03 0x89 0x00 0xAF 0x00 0x11 0x75 0x30 0x6F 0x08 0x18 0x11 0x75 0x30 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7A 0x02 0x21 0x19 0x8B 0x00 0x07 0x2D 0x19 0x8B 0x00 0x08 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x09 0x1A 0x04 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x75 0x00 0x1A 0x00 0x02 0x00 0x20 0x00 0x0D 0x00 0x22 0x00 0x14 0x18 0x19 0x8B 0x00 0x0A 0x70 0x0E 0x18 0x8B 0x00 0x0B 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x7A 0x03 0x21 0x19 0x8B 0x00 0x07 0x2D 0x1A 0x03 0xAF 0x00 0x8D 0x00 0x0C 0x3B 0x19 0x03 0x05 0x8B 0x00 0x0D 0x7A 0x02 0x10 0x18 0x03 0x89 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x3A 0x00 0x0E 0x02 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x06 0x80 0x03 0x00 0x06 0x00 0x00 0x0F 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x02 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x1D 0x04 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x03 0x00 0x00 0x80 0x03 0x00 0x00 0x81 0x06 0x80 0x10 0x06 0x03 0x80 0x0A 0x08 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaLoyalty/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x1E 0x00 0x0B 0x18 0x43 0x04 0x05 0x04 0x02 0x06 0x02 0x0B 0x4B 0x11 0x00 0x0F 0x04 0x07 0x08 0x11 0x0C 0x11 0x42 0x05 0x10 0x15 0x06 0x08 0x07 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x01 0x07 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurse.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurse.scr deleted file mode 100644 index 9e5b99d0..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurse.scr +++ /dev/null @@ -1,157 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x21 0x01 0x72 0x00 0x40 0x0A 0x6E 0x00 0x10 0x01 0x74 0x00 0x00 0x03 0x84 0x00 0x02 0x00 0x01 0x00 0x03 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x21 0x03 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x04 0x03 0x01 0x0C 0x04 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x02 0x01 0x00 0xCA 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x40 0x00 0x80 0x00 0x04 0x00 0x01 0x01 0x00 0x00 0x04 0x00 0x37 0x00 0x63 0x00 0x95 0x00 0xA1 0x00 0x81 0x03 0x10 0x00 0x0D 0x04 0x04 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x94 0xFF 0xFF 0xFF 0xFF 0x01 0xA1 0x00 0x80 0x00 0x02 0x00 0x01 0x01 0x04 0x00 0x00 0x09 0xE7 0x09 0xEC 0x0A 0x12 0x0A 0x27 0x00 0x80 0x00 0x01 0x00 0x01 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x0A 0x6E 0x00 0x05 0x31 0x18 0x8C 0x00 0x20 0x18 0x02 0x88 0x00 0x18 0x1D 0x04 0x41 0x5B 0x30 0x1D 0x88 0x01 0x18 0xAE 0x01 0x91 0x00 0x1B 0x87 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x32 0x1F 0xAE 0x01 0x6D 0x15 0xAD 0x02 0x1F 0x8F 0x00 0x1B 0x3D 0x1E 0x8C 0x00 0x17 0x37 0x1F 0x04 0x41 0x5B 0x32 0x70 0xEA 0x7A 0x03 0x20 0x1D 0x04 0x6C 0x0A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAE 0x01 0x04 0x43 0x5B 0x6F 0x08 0x11 0x6A 0x83 0x8D 0x00 0x19 0xAE 0x00 0x1D 0x43 0x04 0x41 0x5B 0x3D 0x30 0x63 0x08 0x1D 0xAE 0x01 0x41 0x5B 0x30 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x1D 0x24 0x83 0x03 0x77 0x04 0x23 0x18 0x3D 0x84 0x01 0x3F 0x12 0x04 0x43 0x5B 0x88 0x01 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x1C 0x28 0x04 0x1D 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x11 0xAD 0x02 0xAE 0x04 0x24 0x83 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x2C 0x19 0x77 0x03 0x10 0x18 0x3D 0x84 0x00 0x04 0x41 0x5B 0x3F 0x12 0x88 0x00 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x00 0x18 0x3D 0x84 0x04 0x04 0x41 0x5B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3F 0x12 0x88 0x04 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x23 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x26 0x3B 0x7A 0x05 0x41 0x18 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x59 0x18 0x07 0x90 0x0B 0x87 0x05 0x18 0x06 0x90 0x0B 0x87 0x06 0xAD 0x06 0x03 0x10 0x0C 0x38 0xAD 0x06 0x04 0x10 0x1F 0x38 0xAD 0x06 0x05 0x10 0x63 0x38 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x06 0x90 0x0B 0x87 0x07 0x18 0x07 0x90 0x0C 0x87 0x08 0x18 0x07 0x91 0x00 0x1F 0x87 0x09 0x18 0x03 0x89 0x0A 0x18 0x03 0x89 0x0B 0x18 0x03 0x88 0x0C 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x06 0x05 0x8D 0x00 0x5A 0x87 0x0D 0x18 0x05 0x05 0x8D 0x00 0x18 0x87 0x0E 0x18 0x07 0x05 0x8D 0x00 0x1A 0x87 0x0F 0x18 0x10 0x08 0x05 0x8D 0x00 0x1A 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x18 0x8F 0x00 0x1D 0x3D 0x04 0x10 0x08 0x8C 0x00 0x1E 0x87 0x11 0x18 0x8F 0x00 0x1D 0x3D 0x08 0x10 0x08 0x8C 0x00 0x1E 0x87 0x12 0x18 0x8F 0x00 0x21 0x3D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0B 0x8C 0x00 0x22 0x87 0x13 0x18 0x8F 0x00 0x24 0x3D 0x10 0x0A 0x10 0x12 0x8C 0x00 0x25 0x87 0x14 0xAD 0x07 0x03 0x03 0x8D 0x00 0x27 0x3B 0x19 0x1E 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x28 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x29 0x7A 0x01 0x10 0xAD 0x12 0x8B 0x00 0x2A 0xAD 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x2A 0x7A 0x02 0x21 0x19 0x8B 0x00 0x2B 0x2D 0x19 0x8B 0x00 0x2C 0x61 0x3E 0x1A 0x04 0x25 0x73 0x00 0x31 0x00 0x20 0x00 0x26 0x00 0x15 0x00 0x31 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1C 0x00 0x31 0x00 0x23 0x00 0x31 0x00 0x2A 0x18 0x19 0x8C 0x00 0x2D 0x70 0x5C 0x18 0x19 0x8C 0x00 0x2E 0x70 0x55 0x18 0x19 0x8C 0x00 0x2F 0x70 0x4E 0x18 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x30 0x70 0x47 0x11 0x6D 0x00 0x8D 0x00 0x19 0x70 0x3F 0x1A 0x04 0x25 0x10 0x20 0x6B 0x09 0x18 0x19 0x8C 0x00 0x31 0x70 0x31 0x1A 0x04 0x25 0x10 0xA4 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6B 0x16 0x18 0x8B 0x00 0x32 0x60 0x09 0x18 0x19 0x8C 0x00 0x33 0x70 0x1D 0x18 0x19 0x8C 0x00 0x34 0x70 0x16 0x1A 0x04 0x25 0x10 0xB2 0x6B 0x09 0x18 0x19 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x35 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x19 0x7A 0x05 0x22 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x03 0x10 0x6F 0x38 0x1A 0x05 0x10 0x84 0x38 0x1A 0x06 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x36 0x1A 0x07 0x8B 0x00 0x37 0x38 0x06 0x1A 0x06 0x25 0x41 0x32 0x1A 0x1F 0x59 0x03 0x01 0x7B 0x00 0x38 0x92 0x5B 0x38 0x7B 0x00 0x38 0x03 0x1A 0x1F 0x7B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x38 0x92 0x8D 0x00 0x39 0x32 0x1A 0x04 0x1F 0x05 0x43 0x5B 0x38 0x19 0x03 0x1F 0x8B 0x00 0x3A 0x7A 0x05 0x26 0xAD 0x0E 0x03 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0xAD 0x12 0x8B 0x00 0x3B 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x10 0x0A 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x3B 0x1A 0x05 0x25 0x32 0xAD 0x0D 0x07 0x1F 0x39 0x1A 0x08 0x8D 0x00 0x3D 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0xAD 0x0D 0x06 0x16 0x04 0x39 0x18 0x1F 0x16 0x04 0x8C 0x00 0x3E 0x29 0x05 0xAF 0x0A 0x04 0x41 0x29 0x06 0xAD 0x0D 0x03 0x16 0x06 0x39 0x1A 0x10 0x07 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0F 0x03 0x07 0x8D 0x00 0x39 0x3B 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0xAD 0x05 0x03 0x1A 0x03 0x07 0x8D 0x00 0x39 0x29 0x07 0xAD 0x06 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x07 0x06 0x8D 0x00 0x39 0x29 0x07 0x1A 0x16 0x07 0x16 0x05 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x16 0x06 0x8D 0x00 0x27 0x29 0x07 0xAD 0x10 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x39 0x29 0x07 0x19 0x03 0x16 0x07 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x03 0x04 0x38 0x7A 0x06 0x29 0xAD 0x0E 0x03 0x25 0x61 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x11 0x91 0x04 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x10 0x0D 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x3B 0xAD 0x0D 0x03 0x26 0x32 0xAD 0x0D 0x06 0x26 0x29 0x04 0xAD 0x0D 0x04 0x26 0x29 0x05 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x03 0x1A 0x08 0xAD 0x10 0x03 0x10 0x08 0x8D 0x00 0x40 0x6B 0x05 0x04 0x70 0x03 0x03 0x29 0x06 0x1A 0x03 0x1F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0xAD 0x0D 0x07 0x26 0x5B 0x38 0x59 0x07 0x01 0x1A 0x16 0x07 0x16 0x04 0x8D 0x00 0x27 0x29 0x07 0xAD 0x0F 0x03 0x1A 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x07 0x8D 0x00 0x39 0x29 0x07 0x1A 0x10 0x0D 0x1A 0x16 0x07 0x08 0x8D 0x00 0x39 0x3D 0x29 0x07 0x29 0x08 0x16 0x06 0x61 0x46 0x1A 0x16 0x07 0xAD 0x0D 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x11 0x91 0x05 0x8D 0x00 0x27 0x3B 0xAD 0x14 0x8B 0x00 0x41 0x28 0x09 0x8D 0x00 0x42 0x18 0x1F 0x89 0x0A 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x43 0x3B 0xAD 0x14 0x8B 0x00 0x44 0x8D 0x00 0x45 0xAD 0x0E 0x03 0x03 0x38 0x11 0x91 0x05 0x8D 0x00 0x19 0x70 0x45 0x1A 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0xAD 0x0D 0x04 0x26 0x8D 0x00 0x27 0x29 0x07 0x1A 0x16 0x07 0x11 0x90 0x00 0x8D 0x00 0x27 0x3B 0xAD 0x14 0x8B 0x00 0x41 0x28 0x09 0x8D 0x00 0x42 0x18 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x03 0x26 0x89 0x0A 0xAD 0x07 0x03 0x16 0x05 0x8D 0x00 0x27 0x3B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x43 0x3B 0xAD 0x14 0x8B 0x00 0x44 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x45 0x1A 0x03 0x03 0x8D 0x00 0x27 0x3B 0x1A 0x16 0x08 0x03 0x8D 0x00 0x27 0x3B 0xAD 0x0F 0x03 0x8D 0x00 0x3D 0x29 0x09 0x03 0x29 0x0A 0x16 0x0A 0x07 0x6D 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x08 0x16 0x0A 0x26 0x16 0x09 0x6B 0x0F 0xAD 0x09 0x16 0x0A 0x24 0x1A 0x8E 0x02 0x00 0x1F 0x00 0x70 0x0B 0x16 0x0A 0x04 0x41 0x5B 0x29 0x0A 0x70 0xDE 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x1A 0x03 0x16 0x05 0x8D 0x00 0x27 0x29 0x07 0xAD 0x10 0x03 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x39 0x29 0x07 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x03 0x16 0x07 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x03 0x03 0x38 0x7A 0x05 0x22 0xAD 0x0E 0x04 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x00 0x19 0xAD 0x11 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x3B 0x61 0x0C 0xAE 0x0C 0x60 0x08 0x11 0x69 0x82 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x18 0x3D 0x85 0x0B 0x04 0x41 0x89 0x0B 0xAD 0x05 0x03 0x1A 0x03 0x07 0x8D 0x00 0x39 0x32 0xAD 0x06 0x03 0x1A 0x1F 0x06 0x8D 0x00 0x39 0x32 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0xAF 0x0B 0x8D 0x00 0x27 0x32 0x19 0x03 0x1F 0x03 0x43 0x8B 0x00 0x3A 0xAD 0x0E 0x04 0x04 0x38 0x7A 0x06 0x23 0xAD 0x0E 0x04 0x25 0x61 0x08 0x11 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0x19 0x8B 0x00 0x3C 0x32 0x1A 0x07 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x04 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0x03 0xAD 0x10 0x03 0x1A 0x08 0x16 0x04 0x41 0x10 0x08 0x43 0x10 0x08 0x8D 0x00 0x40 0x6A 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x91 0x05 0x8D 0x00 0x19 0x1A 0x10 0x0D 0x25 0x73 0x00 0x80 0xFF 0xC1 0xFF 0xCD 0x00 0x21 0x00 0x2E 0x00 0x80 0x00 0x80 0x00 0x37 0x00 0x40 0x00 0x49 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x00 0x59 0x00 0x60 0x00 0x68 0x00 0x70 0x00 0x78 0x18 0x19 0xAD 0x11 0x8C 0x00 0x46 0x18 0x8C 0x00 0x47 0x70 0x5A 0x18 0x19 0xAD 0x12 0x8C 0x00 0x46 0x70 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x18 0x19 0xAD 0x06 0x8C 0x00 0x48 0x70 0x48 0x18 0x19 0xAD 0x05 0x8C 0x00 0x48 0x70 0x3F 0x18 0x19 0x05 0x8C 0x00 0x49 0x70 0x37 0x18 0x19 0x07 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x49 0x70 0x2F 0x18 0x19 0x8C 0x00 0x4A 0x70 0x28 0x18 0x19 0x03 0x8C 0x00 0x4B 0x70 0x20 0x18 0x19 0x04 0x8C 0x00 0x4B 0x70 0x18 0x18 0x19 0x05 0x8C 0x00 0x4B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x10 0x18 0x19 0x06 0x8C 0x00 0x4B 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0xAD 0x10 0x03 0xAD 0x10 0x92 0x03 0x8D 0x00 0x3F 0x3B 0xAD 0x10 0x03 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x08 0x8D 0x00 0x39 0x3B 0x19 0x03 0x10 0x08 0x8B 0x00 0x3A 0xAD 0x0E 0x04 0x03 0x38 0x7A 0x04 0x25 0x19 0x8B 0x00 0x2B 0x2D 0x1A 0x07 0x25 0x32 0x03 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x19 0x8B 0x00 0x3C 0x29 0x05 0x16 0x05 0x1F 0x6D 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x06 0x25 0x29 0x06 0x16 0x06 0x75 0x00 0x45 0x00 0x02 0xFF 0x81 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0D 0xFF 0x82 0x00 0x29 0xAD 0x11 0x1A 0x08 0x1F 0x8B 0x00 0x4C 0x61 0x36 0xAD 0x11 0x8B 0x00 0x4D 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x24 0xAD 0x12 0x1A 0x08 0x1F 0x8B 0x00 0x4C 0x61 0x1A 0xAD 0x12 0x8B 0x00 0x4D 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x86 0x8D 0x00 0x19 0x7A 0x03 0x34 0xAD 0x07 0x03 0x8D 0x00 0x3D 0x29 0x04 0xAD 0x07 0x05 0x8D 0x00 0x3D 0x29 0x05 0xAD 0x07 0x07 0x8D 0x00 0x3D 0x29 0x06 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x75 0x00 0x47 0x00 0x02 0x00 0x01 0x00 0x0D 0x00 0x02 0x00 0x27 0x16 0x04 0x1E 0x41 0x32 0xAD 0x0D 0x04 0x1F 0x39 0x1F 0x16 0x05 0x6E 0x05 0x1F 0x63 0x30 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x01 0x8D 0x00 0x19 0x70 0x28 0x1E 0x16 0x06 0x6F 0x08 0x11 0x91 0x03 0x8D 0x00 0x19 0x16 0x04 0x1E 0x43 0x32 0xAD 0x0D 0x04 0x1F 0x39 0x1F 0x63 0x10 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x02 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x19 0xAD 0x0D 0x05 0x16 0x04 0x39 0x16 0x04 0x78 0x05 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1A 0x1B 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0F 0x1B 0x10 0x0E 0x25 0x8B 0x00 0x4E 0x7A 0x02 0x10 0xAE 0x0C 0x61 0x06 0x18 0x04 0x88 0x0C 0x7A 0x06 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1B 0x10 0x0F 0x1A 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1B 0x10 0x0E 0x25 0x8D 0x00 0x39 0x3B 0x18 0x19 0x8C 0x00 0x4A 0x7A 0x05 0x31 0x19 0x8B 0x00 0x2B 0x2E 0x1B 0x10 0x0F 0xAD 0x07 0x1E 0x05 0x8D 0x00 0x39 0x3B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x06 0x23 0x19 0x8B 0x00 0x2B 0x2D 0xAD 0x13 0x1A 0x10 0x0D 0x25 0x8B 0x00 0x4F 0x32 0x1F 0x61 0x25 0x1A 0x10 0x0E 0x25 0x05 0x41 0x90 0x0B 0x28 0x04 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x39 0x3B 0xAD 0x13 0x15 0x04 0x8B 0x00 0x50 0x70 0x1A 0xAD 0x13 0x1F 0x8B 0x00 0x51 0x28 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x39 0x3B 0x7A 0x03 0x22 0x19 0x8B 0x00 0x2B 0x2D 0x19 0x8B 0x00 0x3C 0x3B 0x1A 0x05 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x6B 0x31 0x1A 0x07 0x25 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x19 0x1A 0x08 0x8D 0x00 0x3D 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x00 0x0D 0xAD 0x0D 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x19 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0x7A 0x04 0x26 0x01 0x2D 0x03 0x32 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x2B 0x28 0x04 0x15 0x04 0x05 0x25 0x29 0x05 0x15 0x04 0x06 0x25 0x29 0x06 0x16 0x06 0x06 0x4F 0x61 0x17 0xAD 0x0D 0x08 0x26 0x61 0x0A 0x11 0x69 0x86 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x19 0x70 0x35 0xAD 0x0D 0x08 0x26 0x32 0x70 0x2E 0x16 0x06 0x06 0x4F 0x10 0x1F 0x53 0x29 0x07 0x10 0x91 0x16 0x07 0x8D 0x00 0x52 0x32 0x1F 0x73 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0D 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x19 0x1F 0x73 0x00 0x29 0x91 0x02 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x1C 0x00 0x0D 0x00 0x0D 0xAD 0x12 0x8B 0x00 0x3B 0x61 0x17 0x11 0x69 0x82 0x8D 0x00 0x19 0x70 0x0F 0xAD 0x11 0x8B 0x00 0x3B 0x61 0x08 0x11 0x69 0x82 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0x16 0x06 0x10 0x07 0x53 0x29 0x06 0x16 0x06 0x07 0x53 0x60 0x57 0x16 0x06 0x07 0x6B 0x4A 0x16 0x05 0x61 0x08 0x11 0x6A 0x83 0x8D 0x00 0x19 0x1F 0x73 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x31 0x91 0x02 0x91 0x04 0x00 0x29 0x00 0x1F 0x00 0x0D 0x16 0x05 0x04 0x6B 0x07 0xAD 0x07 0x2D 0x70 0x1C 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x14 0xAD 0x14 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x0A 0xAD 0x13 0x16 0x05 0x8B 0x00 0x51 0x2D 0x1A 0x9F 0x00 0x7E 0x11 0x6A 0x82 0x8D 0x00 0x19 0x70 0x75 0x11 0x6A 0x81 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x19 0x70 0x6D 0x16 0x06 0x61 0x63 0x1F 0x73 0x00 0x5E 0x91 0x02 0x91 0x04 0x00 0x41 0x00 0x22 0x00 0x0D 0xAD 0x07 0x03 0x25 0x16 0x05 0x6B 0x07 0xAD 0x07 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x2D 0x70 0x46 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x3E 0xAD 0x14 0x16 0x05 0x8B 0x00 0x53 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x14 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x1F 0xAD 0x13 0x16 0x05 0x8B 0x00 0x4F 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x19 0x70 0x0A 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x16 0x05 0x8B 0x00 0x51 0x2D 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x19 0x19 0x8B 0x00 0x54 0x29 0x07 0x1A 0x92 0x16 0x07 0x6D 0x06 0x1A 0x92 0x29 0x07 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x07 0x8B 0x00 0x55 0x19 0x1A 0x03 0x16 0x07 0x8B 0x00 0x56 0x7A 0x04 0x32 0x19 0x8B 0x00 0x2B 0x2E 0xAD 0x08 0x1E 0x1B 0x10 0x0F 0x8D 0x00 0x3D 0x39 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x1E 0x26 0x60 0x35 0x1B 0x10 0x11 0x1B 0x10 0x0E 0x25 0x05 0x43 0x5B 0x8D 0x00 0x57 0x28 0x04 0x15 0x04 0x66 0x1D 0xAD 0x09 0x1E 0x15 0x04 0x03 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x58 0x94 0x00 0x00 0x1F 0x37 0xAD 0x09 0x1E 0x24 0x67 0x0E 0xAD 0x08 0x1E 0x03 0x39 0x70 0x07 0xAD 0x08 0x1E 0x03 0x39 0xAD 0x08 0x1E 0x26 0x61 0x16 0x1B 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0E 0x05 0x38 0x1B 0x10 0x0F 0x1B 0x92 0x10 0x0D 0x43 0x05 0x43 0x03 0x8D 0x00 0x3F 0x3B 0x18 0x19 0x8C 0x00 0x4A 0x7A 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x91 0x00 0x1B 0x87 0x15 0x18 0x03 0x88 0x16 0x7A 0x01 0x10 0xAE 0x16 0x78 0x05 0x20 0xAD 0x15 0x92 0xAE 0x16 0x6B 0x08 0x11 0x6A 0x84 0x8D 0x00 0x19 0xAD 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x3D 0x84 0x16 0x3F 0x12 0x04 0x41 0x5B 0x88 0x16 0x8F 0x00 0x1B 0x3D 0x19 0x8C 0x00 0x5B 0x37 0x7A 0x03 0x20 0x1D 0x65 0x07 0x1D 0xAE 0x16 0x6F 0x04 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x77 0xAD 0x15 0x1D 0x04 0x43 0x24 0x83 0x03 0x77 0x02 0x23 0xAE 0x16 0x61 0x04 0x03 0x78 0xAE 0x16 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x51 0x28 0x04 0x1D 0x61 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x11 0x19 0x87 0x03 0x7A 0x02 0x20 0x18 0x8C 0x00 0x20 0x18 0x1D 0x90 0x0B 0x87 0x03 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x13 0x08 0x00 0x10 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x03 0xA5 0x01 0x42 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x72 0x00 0x5C 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x02 0x00 0x36 0x00 0x02 0x00 0x00 0x03 0x02 0x00 0x12 0x08 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x09 0x02 0x00 0x12 0x0A 0x02 0x00 0x12 0x0B 0x02 0x00 0x12 0x0C 0x02 0x00 0x12 0x0D 0x02 0x00 0x12 0x0E 0x02 0x00 0x12 0x0F 0x02 0x00 0x12 0x06 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x07 0x02 0x00 0x12 0x04 0x02 0x00 0x12 0x05 0x02 0x00 0x12 0x02 0x02 0x00 0x12 0x03 0x02 0x00 0x12 0x00 0x02 0x00 0x12 0x01 0x02 0x00 0x24 0x00 0x02 0x00 0x24 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x06 0x00 0x0A 0x61 0x06 0x81 0x08 0x0C 0x06 0x81 0x07 0x01 0x06 0x81 0x08 0x0D 0x01 0x00 0x36 0x00 0x03 0x00 0x00 0x80 0x01 0x81 0x09 0x00 0x06 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x82 0x00 0x00 0x06 0x80 0x00 0x00 0x01 0x00 0x24 0x00 0x06 0x00 0x09 0xD5 0x01 0x00 0x12 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xD8 0x06 0x81 0x10 0x06 0x03 0x81 0x03 0x01 0x03 0x81 0x03 0x02 0x03 0x81 0x09 0x05 0x03 0x81 0x0A 0x01 0x03 0x81 0x0A 0x0E 0x06 0x00 0x02 0x71 0x06 0x00 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x36 0x06 0x00 0x04 0xCC 0x06 0x00 0x05 0x32 0x06 0x00 0x06 0x30 0x03 0x81 0x03 0x03 0x06 0x00 0x02 0x28 0x06 0x00 0x07 0xAE 0x06 0x00 0x07 0xF6 0x06 0x81 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x03 0x81 0x06 0x03 0x05 0x00 0x00 0x00 0x06 0x81 0x10 0x02 0x03 0x81 0x0A 0x08 0x03 0x81 0x09 0x04 0x03 0x81 0x0A 0x06 0x06 0x81 0x10 0x04 0x06 0x00 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xA2 0x06 0x81 0x10 0x03 0x06 0x81 0x10 0x00 0x03 0x00 0x00 0x82 0x06 0x81 0x08 0x01 0x06 0x81 0x10 0x01 0x03 0x00 0x00 0x83 0x06 0x81 0x08 0x02 0x06 0x00 0x07 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x13 0x06 0x00 0x07 0x26 0x06 0x00 0x07 0x31 0x06 0x00 0x07 0x4B 0x06 0x00 0x07 0x5E 0x06 0x00 0x09 0x6B 0x03 0x81 0x09 0x01 0x03 0x81 0x09 0x02 0x03 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x08 0x03 0x00 0x24 0x04 0x03 0x00 0x24 0x02 0x03 0x00 0x24 0x03 0x06 0x81 0x10 0x05 0x03 0x00 0x00 0x81 0x03 0x81 0x0A 0x07 0x03 0x81 0x0A 0x09 0x03 0x81 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x15 0x05 0x06 0x81 0x08 0x0B 0x06 0x81 0x08 0x04 0x06 0x81 0x03 0x00 0x06 0x81 0x08 0x0F 0x06 0x00 0x0A 0x56 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurse/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x01 0x74 0x00 0xA0 0x0A 0x09 0x03 0x05 0x05 0x04 0x1B 0x0D 0x0C 0x05 0x04 0x07 0x07 0x29 0x02 0x03 0x09 0x07 0x02 0x06 0x04 0x07 0x02 0x06 0x1B 0x06 0x02 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x06 0x0B 0x06 0x07 0x04 0x04 0x04 0x09 0x08 0x08 0x09 0x0D 0x0D 0x0C 0x0E 0x02 0x24 0x05 0xD8 0x0C 0x33 0x0C 0x0F 0x06 0x09 0x08 0x03 0x08 0x0B 0x20 0x16 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x33 0x05 0x06 0x06 0x03 0x0B 0x1B 0x13 0x22 0x13 0x0C 0x0D 0x08 0x10 0x13 0x0B 0x04 0x02 0x14 0x17 0x10 0x09 0x16 0x03 0x11 0x16 0x08 0x0C 0x07 0x21 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x0A 0x0C 0x0E 0x08 0x2B 0x03 0x09 0x3F 0x0D 0x09 0x09 0x44 0x03 0x08 0x12 0x39 0x0A 0x12 0x0A 0x1B 0x08 0x08 0x1B 0x25 0x16 0x1E 0x06 0x27 0x10 0x27 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x4B 0x34 0x0E 0x26 0x1B 0x0F 0x3C 0x0D 0x0A 0x2E 0x08 0x0D 0x15 0x0A 0x15 0x36 0x0A 0x19 0x0E 0x06 0x07 0x05 0x2B 0x04 0x05 0x05 0x03 0x0A 0x04 0x07 0x12 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x05 0x06 0x2F 0x0D 0x00 0xD0 0x05 0x13 0x0F 0x05 0x1D 0x2D 0x57 0x07 0x08 0x30 0x15 0x08 0x08 0x09 0x06 0x07 0x06 0x07 0x06 0x06 0x06 0x08 0x09 0x0E 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x05 0x07 0x05 0x1F 0x07 0x07 0x07 0x08 0x0E 0x0D 0x07 0x07 0x0E 0x08 0x07 0x10 0x05 0x0F 0x06 0x06 0x04 0x0E 0x0F 0x05 0x08 0x04 0x0E 0x0B 0x04 0x0F 0x0F 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x18 0x0B 0x0A 0x0C 0x0A 0x0A 0x0D 0x0B 0x14 0x04 0x0E 0x10 0x04 0x1C 0x0C 0x0E 0x16 0x0C 0x0C 0x13 0x0B 0x06 0x05 0x0E 0x06 0x03 0x0B 0x0C 0x0B 0x06 0x05 0x0F 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0B 0x06 0x03 0x06 0x08 0x07 0x1D 0x16 0x08 0x0D 0x0B 0x14 0x05 0x0C 0x04 0x11 0x11 0x0A 0x08 0x09 0x14 0x04 0x11 0x04 0x10 0x12 0x08 0x2C 0x04 0x09 0x09 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x08 0x07 0x08 0x08 0x08 0x08 0x08 0x0A 0x0B 0x08 0x0C 0x0C 0x0D 0x1C 0x07 0x0B 0x0A 0x07 0x0B 0x08 0x09 0x08 0x08 0x28 0x0D 0x13 0x08 0x0F 0x0C 0x12 0x0D 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x07 0x0B 0x08 0x0A 0x1D 0x08 0x08 0x11 0x08 0x05 0x13 0x05 0x1C 0x08 0x0B 0x20 0x19 0x1C 0x13 0x08 0x07 0x08 0x1C 0x1E 0x09 0x0A 0x0B 0x08 0x27 0x09 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x17 0x09 0x0A 0x0C 0x09 0x09 0x04 0x12 0x08 0x07 0x0A 0x14 0x0F 0x04 0x2C 0x06 0x07 0x05 0x1B 0x10 0x05 0x29 0x23 0x0B 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurseCrypto.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurseCrypto.scr deleted file mode 100644 index 5a615fde..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/JavaPurseCrypto.scr +++ /dev/null @@ -1,169 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x2B 0x01 0x96 0x00 0x40 0x0B 0x7E 0x00 0x10 0x01 0xAD 0x00 0x00 0x03 0xCE 0x00 0x02 0x00 0x01 0x00 0x03 0x04 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2B 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0E 0x03 0x01 0x0C 0x04 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x01 0x00 0xCA 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x40 0x00 0x80 0x00 0x04 0x00 0x01 0x01 0x00 0x00 0x04 0x00 0x37 0x00 0x63 0x00 0x95 0x00 0xA1 0x00 0x81 0x03 0x14 0x00 0x11 0x04 0x04 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xEE 0xFF 0xFF 0xFF 0xFF 0x01 0xFB 0x00 0x80 0x00 0x02 0x00 0x01 0x01 0x04 0x00 0x00 0x0A 0xF7 0x0A 0xFC 0x0B 0x22 0x0B 0x37 0x00 0x80 0x00 0x01 0x00 0x01 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x0B 0x7E 0x00 0x05 0x31 0x18 0x8C 0x00 0x1D 0x18 0x02 0x88 0x00 0x18 0x1D 0x04 0x41 0x5B 0x30 0x1D 0x88 0x01 0x18 0xAE 0x01 0x91 0x00 0x63 0x87 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x32 0x1F 0xAE 0x01 0x6D 0x15 0xAD 0x02 0x1F 0x8F 0x00 0x63 0x3D 0x1E 0x8C 0x00 0x27 0x37 0x1F 0x04 0x41 0x5B 0x32 0x70 0xEA 0x7A 0x03 0x20 0x1D 0x04 0x6C 0x0A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAE 0x01 0x04 0x43 0x5B 0x6F 0x08 0x11 0x6A 0x83 0x8D 0x00 0x2D 0xAE 0x00 0x1D 0x43 0x04 0x41 0x5B 0x3D 0x30 0x63 0x08 0x1D 0xAE 0x01 0x41 0x5B 0x30 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x1D 0x24 0x83 0x03 0x77 0x04 0x23 0x18 0x3D 0x84 0x01 0x3F 0x12 0x04 0x43 0x5B 0x88 0x01 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x1C 0x28 0x04 0x1D 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x11 0xAD 0x02 0xAE 0x04 0x24 0x83 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x2C 0x19 0x77 0x03 0x10 0x18 0x3D 0x84 0x00 0x04 0x41 0x5B 0x3F 0x12 0x88 0x00 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x00 0x18 0x3D 0x84 0x04 0x04 0x41 0x5B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3F 0x12 0x88 0x04 0xAE 0x01 0x6B 0x06 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x21 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x23 0x3B 0x7A 0x05 0x41 0x18 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x18 0x10 0x08 0x90 0x0B 0x3D 0x03 0x10 0x11 0x38 0x3D 0x04 0x10 0x33 0x38 0x3D 0x05 0x10 0x22 0x38 0x3D 0x06 0x08 0x38 0x3D 0x07 0x10 0x44 0x38 0x3D 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x77 0x38 0x3D 0x10 0x06 0x10 0x06 0x38 0x3D 0x10 0x07 0x10 0x08 0x38 0x87 0x05 0x18 0x07 0x90 0x0B 0x87 0x06 0x18 0x06 0x90 0x0B 0x87 0x07 0xAD 0x07 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0C 0x38 0xAD 0x07 0x04 0x10 0x1F 0x38 0xAD 0x07 0x05 0x10 0x63 0x38 0x18 0x10 0x06 0x90 0x0B 0x87 0x08 0x18 0x07 0x90 0x0C 0x87 0x09 0x18 0x07 0x91 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x20 0x87 0x0A 0x18 0x03 0x89 0x0B 0x18 0x03 0x89 0x0C 0x18 0x03 0x88 0x0D 0x18 0x10 0x06 0x05 0x8D 0x00 0x2A 0x87 0x0E 0x18 0x05 0x05 0x8D 0x00 0x62 0x87 0x0F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x07 0x05 0x8D 0x00 0x1B 0x87 0x10 0x18 0x10 0x08 0x05 0x8D 0x00 0x1B 0x87 0x11 0x18 0x05 0x10 0x40 0x03 0x8D 0x00 0x1E 0x94 0x00 0x00 0x1F 0x87 0x12 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x1E 0x05 0x8D 0x00 0x1B 0x87 0x13 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0x18 0x10 0x06 0x03 0x8D 0x00 0x22 0x87 0x14 0x18 0x8F 0x00 0x24 0x3D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x10 0x08 0x8C 0x00 0x25 0x87 0x15 0x18 0x8F 0x00 0x24 0x3D 0x08 0x10 0x08 0x8C 0x00 0x25 0x87 0x16 0x18 0x8F 0x00 0x28 0x3D 0x10 0x0B 0x8C 0x00 0x29 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0x18 0x8F 0x00 0x2B 0x3D 0x10 0x0A 0x10 0x12 0x8C 0x00 0x2C 0x87 0x18 0xAD 0x08 0x03 0x03 0x8D 0x00 0x2E 0x3B 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x8B 0x00 0x2F 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x8B 0x00 0x30 0x7A 0x01 0x10 0xAD 0x16 0x8B 0x00 0x31 0xAD 0x15 0x8B 0x00 0x31 0x7A 0x02 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2D 0x19 0x8B 0x00 0x33 0x61 0x3E 0x1A 0x04 0x25 0x73 0x00 0x31 0x00 0x20 0x00 0x26 0x00 0x15 0x00 0x31 0x00 0x1C 0x00 0x31 0x00 0x23 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x31 0x00 0x2A 0x18 0x19 0x8C 0x00 0x34 0x70 0x5C 0x18 0x19 0x8C 0x00 0x35 0x70 0x55 0x18 0x19 0x8C 0x00 0x36 0x70 0x4E 0x18 0x19 0x8C 0x00 0x37 0x70 0x47 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x2D 0x70 0x3F 0x1A 0x04 0x25 0x10 0x20 0x6B 0x09 0x18 0x19 0x8C 0x00 0x38 0x70 0x31 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x16 0x18 0x8B 0x00 0x39 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x60 0x09 0x18 0x19 0x8C 0x00 0x3A 0x70 0x1D 0x18 0x19 0x8C 0x00 0x3B 0x70 0x16 0x1A 0x04 0x25 0x10 0xB2 0x6B 0x09 0x18 0x19 0x8C 0x00 0x3C 0x70 0x08 0x11 0x6D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x8D 0x00 0x2D 0x7A 0x05 0x22 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x03 0x10 0x6F 0x38 0x1A 0x05 0x10 0x84 0x38 0x1A 0x06 0x8D 0x00 0x3D 0x1A 0x07 0x8B 0x00 0x3E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x38 0x06 0x1A 0x06 0x25 0x41 0x32 0x1A 0x1F 0x59 0x03 0x01 0x7B 0x00 0x3F 0x92 0x5B 0x38 0x7B 0x00 0x3F 0x03 0x1A 0x1F 0x7B 0x00 0x3F 0x92 0x8D 0x00 0x40 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x04 0x1F 0x05 0x43 0x5B 0x38 0x19 0x03 0x1F 0x8B 0x00 0x41 0x7A 0x06 0x27 0xAD 0x0F 0x03 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0xAD 0x16 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x42 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x10 0x0A 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x06 0x25 0x60 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x43 0x3B 0x1A 0x05 0x25 0x32 0xAD 0x0E 0x07 0x1F 0x39 0x1A 0x08 0x8D 0x00 0x44 0x29 0x04 0xAD 0x0E 0x06 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x39 0x18 0x1F 0x16 0x04 0x8C 0x00 0x45 0x29 0x05 0xAF 0x0B 0x04 0x41 0x29 0x06 0xAD 0x0E 0x03 0x16 0x06 0x39 0x1A 0x10 0x07 0xAD 0x10 0x03 0x07 0x8D 0x00 0x40 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3B 0xAD 0x06 0x03 0x1A 0x03 0x07 0x8D 0x00 0x40 0x29 0x07 0xAD 0x07 0x03 0x1A 0x16 0x07 0x06 0x8D 0x00 0x40 0x29 0x07 0x1A 0x16 0x07 0x16 0x05 0x8D 0x00 0x2E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x07 0x1A 0x16 0x07 0x16 0x06 0x8D 0x00 0x2E 0x29 0x07 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x46 0xAD 0x14 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x03 0x16 0x07 0x03 0x43 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x08 0xAD 0x11 0x03 0x1A 0x16 0x07 0x10 0x08 0x8D 0x00 0x40 0x29 0x07 0x19 0x03 0x16 0x07 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x03 0x04 0x38 0x7A 0x07 0x29 0xAD 0x0F 0x03 0x25 0x61 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x0D 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x43 0x3B 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0E 0x03 0x26 0x32 0xAD 0x0E 0x06 0x26 0x29 0x04 0xAD 0x0E 0x04 0x26 0x29 0x05 0x1A 0x03 0xAD 0x13 0x03 0x08 0x8D 0x00 0x40 0x29 0x06 0x1A 0x16 0x06 0xAD 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x10 0x08 0x8D 0x00 0x40 0x3B 0x1A 0x16 0x06 0x10 0x08 0x41 0xAD 0x13 0x08 0x08 0x8D 0x00 0x40 0x3B 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x14 0xAD 0x12 0x05 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x13 0x03 0x10 0x0A 0xAD 0x11 0x03 0x10 0x08 0x8B 0x00 0x48 0x29 0x07 0x1A 0x03 0x1F 0x8D 0x00 0x2E 0x29 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x16 0x06 0xAD 0x0E 0x07 0x26 0x5B 0x38 0x59 0x06 0x01 0x1A 0x16 0x06 0x16 0x04 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x10 0x03 0x1A 0x16 0x06 0x07 0x8D 0x00 0x40 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x29 0x06 0x1A 0x10 0x0D 0x1A 0x16 0x06 0x08 0x8D 0x00 0x40 0x3D 0x29 0x06 0x29 0x08 0x16 0x07 0x61 0x46 0x1A 0x16 0x06 0xAD 0x0E 0x05 0x26 0x8D 0x00 0x2E 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x1A 0x16 0x06 0x11 0x91 0x05 0x8D 0x00 0x2E 0x3B 0xAD 0x18 0x8B 0x00 0x49 0x28 0x09 0x8D 0x00 0x4A 0x18 0x1F 0x89 0x0B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x4B 0x3B 0xAD 0x18 0x8B 0x00 0x4C 0x8D 0x00 0x4D 0xAD 0x0F 0x03 0x03 0x38 0x11 0x91 0x05 0x8D 0x00 0x2D 0x70 0x45 0x1A 0x16 0x06 0xAD 0x0E 0x04 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2E 0x29 0x06 0x1A 0x16 0x06 0x11 0x90 0x00 0x8D 0x00 0x2E 0x3B 0xAD 0x18 0x8B 0x00 0x49 0x28 0x09 0x8D 0x00 0x4A 0x18 0xAD 0x0E 0x03 0x26 0x89 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x08 0x03 0x16 0x05 0x8D 0x00 0x2E 0x3B 0x1A 0x03 0x15 0x09 0x03 0x10 0x12 0x8D 0x00 0x4B 0x3B 0xAD 0x18 0x8B 0x00 0x4C 0x8D 0x00 0x4D 0x1A 0x03 0x03 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2E 0x3B 0x1A 0x16 0x08 0x03 0x8D 0x00 0x2E 0x3B 0xAD 0x10 0x03 0x8D 0x00 0x44 0x29 0x09 0x03 0x29 0x0A 0x16 0x0A 0x07 0x6D 0x21 0xAD 0x09 0x16 0x0A 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x09 0x6B 0x0F 0xAD 0x0A 0x16 0x0A 0x24 0x1A 0x8E 0x02 0x00 0x20 0x00 0x70 0x0B 0x16 0x0A 0x04 0x41 0x5B 0x29 0x0A 0x70 0xDE 0xAD 0x13 0x03 0x16 0x05 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2E 0x29 0x06 0xAD 0x13 0x16 0x06 0x11 0x90 0x00 0x8D 0x00 0x2E 0x3B 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x46 0xAD 0x14 0xAD 0x13 0x03 0x07 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x0A 0x1A 0x03 0x16 0x05 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x11 0x03 0x1A 0x16 0x06 0x10 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x40 0x29 0x06 0x19 0x03 0x16 0x06 0x03 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x03 0x03 0x38 0x7A 0x05 0x22 0xAD 0x0F 0x04 0x25 0x60 0x08 0x11 0x91 0x04 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0xAD 0x15 0x8B 0x00 0x42 0x61 0x0C 0xAE 0x0D 0x60 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x0C 0x04 0x41 0x89 0x0C 0xAD 0x06 0x03 0x1A 0x03 0x07 0x8D 0x00 0x40 0x32 0xAD 0x07 0x03 0x1A 0x1F 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x40 0x32 0x1A 0x1F 0xAF 0x0C 0x8D 0x00 0x2E 0x32 0x19 0x03 0x1F 0x03 0x43 0x8B 0x00 0x41 0xAD 0x0F 0x04 0x04 0x38 0x7A 0x07 0x27 0xAD 0x0F 0x04 0x25 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x61 0x08 0x11 0x91 0x04 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x05 0x25 0x61 0x07 0x1A 0x06 0x25 0x60 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x32 0x1A 0x07 0x25 0x29 0x04 0x16 0x04 0x10 0x08 0x43 0x08 0x41 0x29 0x05 0x1A 0x03 0xAD 0x13 0x03 0x16 0x05 0x8D 0x00 0x40 0x29 0x06 0x1A 0x16 0x06 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x03 0x10 0x08 0x8D 0x00 0x40 0x29 0x06 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x05 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x13 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0xAD 0x11 0x03 0x10 0x08 0x8B 0x00 0x48 0x29 0x07 0x16 0x07 0x61 0x08 0x11 0x91 0x05 0x8D 0x00 0x2D 0x1A 0x10 0x0D 0x25 0x73 0x00 0x80 0xFF 0xC1 0xFF 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xCD 0x00 0x21 0x00 0x2E 0x00 0x80 0x00 0x80 0x00 0x37 0x00 0x40 0x00 0x49 0x00 0x51 0x00 0x59 0x00 0x60 0x00 0x68 0x00 0x70 0x00 0x78 0x18 0x19 0xAD 0x15 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x4E 0x18 0x8C 0x00 0x4F 0x70 0x5A 0x18 0x19 0xAD 0x16 0x8C 0x00 0x4E 0x70 0x51 0x18 0x19 0xAD 0x07 0x8C 0x00 0x50 0x70 0x48 0x18 0x19 0xAD 0x06 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x50 0x70 0x3F 0x18 0x19 0x05 0x8C 0x00 0x51 0x70 0x37 0x18 0x19 0x07 0x8C 0x00 0x51 0x70 0x2F 0x18 0x19 0x8C 0x00 0x52 0x70 0x28 0x18 0x19 0x03 0x8C 0x00 0x53 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x20 0x18 0x19 0x04 0x8C 0x00 0x53 0x70 0x18 0x18 0x19 0x05 0x8C 0x00 0x53 0x70 0x10 0x18 0x19 0x06 0x8C 0x00 0x53 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x13 0x03 0x11 0x90 0x00 0x8D 0x00 0x2E 0x29 0x06 0xAD 0x12 0xAD 0x05 0x03 0x8E 0x03 0x00 0x1F 0x05 0xAD 0x14 0xAD 0x12 0x04 0x8B 0x00 0x46 0xAD 0x14 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x03 0x05 0xAD 0x11 0x03 0x8B 0x00 0x47 0x29 0x08 0xAD 0x11 0x03 0x1A 0x03 0x10 0x08 0x8D 0x00 0x40 0x3B 0x19 0x03 0x10 0x08 0x8B 0x00 0x41 0xAD 0x0F 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x38 0x7A 0x04 0x25 0x19 0x8B 0x00 0x32 0x2D 0x1A 0x07 0x25 0x32 0x03 0x29 0x04 0x19 0x8B 0x00 0x43 0x29 0x05 0x16 0x05 0x1F 0x6D 0x08 0x11 0x67 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0x1A 0x06 0x25 0x29 0x06 0x16 0x06 0x75 0x00 0x45 0x00 0x02 0xFF 0x81 0x00 0x0D 0xFF 0x82 0x00 0x29 0xAD 0x15 0x1A 0x08 0x1F 0x8B 0x00 0x54 0x61 0x36 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x15 0x8B 0x00 0x55 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x2D 0x70 0x24 0xAD 0x16 0x1A 0x08 0x1F 0x8B 0x00 0x54 0x61 0x1A 0xAD 0x16 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x55 0x29 0x04 0x11 0x69 0xC0 0x16 0x04 0x41 0x8D 0x00 0x2D 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0x7A 0x03 0x34 0xAD 0x08 0x03 0x8D 0x00 0x44 0x29 0x04 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x05 0x8D 0x00 0x44 0x29 0x05 0xAD 0x08 0x07 0x8D 0x00 0x44 0x29 0x06 0x1D 0x75 0x00 0x47 0x00 0x02 0x00 0x01 0x00 0x0D 0x00 0x02 0x00 0x27 0x16 0x04 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x32 0xAD 0x0E 0x04 0x1F 0x39 0x1F 0x16 0x05 0x6E 0x05 0x1F 0x63 0x30 0x11 0x91 0x01 0x8D 0x00 0x2D 0x70 0x28 0x1E 0x16 0x06 0x6F 0x08 0x11 0x91 0x03 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2D 0x16 0x04 0x1E 0x43 0x32 0xAD 0x0E 0x04 0x1F 0x39 0x1F 0x63 0x10 0x11 0x91 0x02 0x8D 0x00 0x2D 0x70 0x08 0x11 0x6A 0x86 0x8D 0x00 0x2D 0xAD 0x0E 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x04 0x39 0x16 0x04 0x78 0x05 0x31 0x19 0x8B 0x00 0x32 0x2E 0x1A 0x1B 0x10 0x0F 0x1B 0x10 0x0E 0x25 0x8B 0x00 0x56 0x7A 0x02 0x10 0xAE 0x0D 0x61 0x06 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x88 0x0D 0x7A 0x06 0x31 0x19 0x8B 0x00 0x32 0x2E 0x1B 0x10 0x0F 0x1A 0x03 0x1B 0x10 0x0E 0x25 0x8D 0x00 0x40 0x3B 0x18 0x19 0x8C 0x00 0x52 0x7A 0x05 0x31 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2E 0x1B 0x10 0x0F 0xAD 0x08 0x1E 0x05 0x8D 0x00 0x40 0x3B 0x7A 0x06 0x23 0x19 0x8B 0x00 0x32 0x2D 0xAD 0x17 0x1A 0x10 0x0D 0x25 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x57 0x32 0x1F 0x61 0x25 0x1A 0x10 0x0E 0x25 0x05 0x41 0x90 0x0B 0x28 0x04 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x40 0x3B 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0x15 0x04 0x8B 0x00 0x58 0x70 0x1A 0xAD 0x17 0x1F 0x8B 0x00 0x59 0x28 0x04 0x1A 0x10 0x0D 0x15 0x04 0x03 0x1A 0x10 0x0E 0x25 0x05 0x41 0x8D 0x00 0x40 0x3B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x03 0x22 0x19 0x8B 0x00 0x32 0x2D 0x19 0x8B 0x00 0x43 0x3B 0x1A 0x05 0x25 0x05 0x6B 0x31 0x1A 0x07 0x25 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x2D 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x8D 0x00 0x44 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0E 0x08 0x1F 0x39 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x7A 0x04 0x26 0x01 0x2D 0x03 0x32 0x19 0x8B 0x00 0x32 0x28 0x04 0x15 0x04 0x05 0x25 0x29 0x05 0x15 0x04 0x06 0x25 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x16 0x06 0x06 0x4F 0x61 0x17 0xAD 0x0E 0x08 0x26 0x61 0x0A 0x11 0x69 0x86 0x8D 0x00 0x2D 0x70 0x35 0xAD 0x0E 0x08 0x26 0x32 0x70 0x2E 0x16 0x06 0x06 0x4F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0x1F 0x53 0x29 0x07 0x10 0x91 0x16 0x07 0x8D 0x00 0x5A 0x32 0x1F 0x73 0x00 0x14 0x91 0x02 0x91 0x04 0x00 0x0D 0x00 0x0D 0x00 0x0D 0xAD 0x0E 0x08 0x1F 0x39 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x08 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x1F 0x73 0x00 0x29 0x91 0x02 0x91 0x04 0x00 0x1C 0x00 0x0D 0x00 0x0D 0xAD 0x16 0x8B 0x00 0x42 0x61 0x17 0x11 0x69 0x82 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2D 0x70 0x0F 0xAD 0x15 0x8B 0x00 0x42 0x61 0x08 0x11 0x69 0x82 0x8D 0x00 0x2D 0x16 0x06 0x10 0x07 0x53 0x29 0x06 0x16 0x06 0x07 0x53 0x60 0x57 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x07 0x6B 0x4A 0x16 0x05 0x61 0x08 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x1F 0x73 0x00 0x31 0x91 0x02 0x91 0x04 0x00 0x29 0x00 0x1F 0x00 0x0D 0x16 0x05 0x04 0x6B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0xAD 0x08 0x2D 0x70 0x1C 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x14 0xAD 0x18 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x0A 0xAD 0x17 0x16 0x05 0x8B 0x00 0x59 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x9F 0x00 0x7E 0x11 0x6A 0x82 0x8D 0x00 0x2D 0x70 0x75 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x70 0x6D 0x16 0x06 0x61 0x63 0x1F 0x73 0x00 0x5E 0x91 0x02 0x91 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x41 0x00 0x22 0x00 0x0D 0xAD 0x08 0x03 0x25 0x16 0x05 0x6B 0x07 0xAD 0x08 0x2D 0x70 0x46 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x3E 0xAD 0x18 0x16 0x05 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x5B 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x29 0xAD 0x18 0x16 0x05 0x8B 0x00 0x1C 0x2D 0x70 0x1F 0xAD 0x17 0x16 0x05 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x57 0x29 0x05 0x16 0x05 0x61 0x0A 0x11 0x6A 0x83 0x8D 0x00 0x2D 0x70 0x0A 0xAD 0x17 0x16 0x05 0x8B 0x00 0x59 0x2D 0x70 0x08 0x11 0x6A 0x81 0x8D 0x00 0x2D 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x5C 0x29 0x07 0x1A 0x92 0x16 0x07 0x6D 0x06 0x1A 0x92 0x29 0x07 0x19 0x16 0x07 0x8B 0x00 0x5D 0x19 0x1A 0x03 0x16 0x07 0x8B 0x00 0x5E 0x7A 0x04 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x8B 0x00 0x32 0x2E 0xAD 0x09 0x1E 0x1B 0x10 0x0F 0x8D 0x00 0x44 0x39 0xAD 0x09 0x1E 0x26 0x60 0x35 0x1B 0x10 0x11 0x1B 0x10 0x0E 0x25 0x05 0x43 0x5B 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x5F 0x28 0x04 0x15 0x04 0x66 0x1D 0xAD 0x0A 0x1E 0x15 0x04 0x03 0x8D 0x00 0x60 0x94 0x00 0x00 0x20 0x37 0xAD 0x0A 0x1E 0x24 0x67 0x0E 0xAD 0x09 0x1E 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x39 0x70 0x07 0xAD 0x09 0x1E 0x03 0x39 0xAD 0x09 0x1E 0x26 0x61 0x16 0x1B 0x10 0x0E 0x05 0x38 0x1B 0x10 0x0F 0x1B 0x92 0x10 0x0D 0x43 0x05 0x43 0x03 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x61 0x3B 0x18 0x19 0x8C 0x00 0x52 0x7A 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x1D 0x91 0x00 0x63 0x87 0x19 0x18 0x03 0x88 0x1A 0x7A 0x01 0x10 0xAE 0x1A 0x78 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x20 0xAD 0x19 0x92 0xAE 0x1A 0x6B 0x08 0x11 0x6A 0x84 0x8D 0x00 0x2D 0xAD 0x19 0x18 0x3D 0x84 0x1A 0x3F 0x12 0x04 0x41 0x5B 0x88 0x1A 0x8F 0x00 0x63 0x3D 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x64 0x37 0x7A 0x03 0x20 0x1D 0x65 0x07 0x1D 0xAE 0x1A 0x6F 0x04 0x01 0x77 0xAD 0x19 0x1D 0x04 0x43 0x24 0x83 0x03 0x77 0x02 0x23 0xAE 0x1A 0x61 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x78 0xAE 0x1A 0x31 0x04 0x32 0x18 0x1F 0x8B 0x00 0x59 0x28 0x04 0x1D 0x61 0x04 0x1F 0x78 0x15 0x04 0x03 0x25 0x1D 0x6B 0x04 0x1F 0x78 0x1F 0x1E 0x6B 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x78 0x1F 0x04 0x41 0x5B 0x32 0x70 0xE0 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x19 0x87 0x03 0x7A 0x02 0x20 0x18 0x8C 0x00 0x1D 0x18 0x1D 0x90 0x0B 0x87 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x01 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x13 0x08 0x00 0x10 0x00 0x02 0x00 0x01 0x00 0x01 0x03 0x00 0x03 0xA5 0x01 0x42 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x96 0x00 0x65 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x02 0x00 0x36 0x00 0x02 0x00 0x00 0x03 0x02 0x00 0x12 0x04 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x09 0x02 0x00 0x12 0x0A 0x02 0x00 0x12 0x0B 0x02 0x00 0x12 0x0D 0x02 0x00 0x12 0x0E 0x02 0x00 0x12 0x11 0x02 0x00 0x12 0x12 0x02 0x00 0x12 0x13 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x07 0x02 0x00 0x12 0x08 0x02 0x00 0x12 0x05 0x02 0x00 0x12 0x06 0x02 0x00 0x12 0x0F 0x02 0x00 0x12 0x0C 0x02 0x00 0x12 0x10 0x02 0x00 0x12 0x02 0x02 0x00 0x12 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x02 0x00 0x12 0x00 0x02 0x00 0x12 0x01 0x02 0x00 0x24 0x00 0x02 0x00 0x24 0x01 0x06 0x81 0x08 0x0D 0x03 0x00 0x00 0x80 0x06 0x80 0x00 0x00 0x06 0x83 0x0D 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x0A 0x00 0x01 0x82 0x00 0x00 0x01 0x00 0x12 0x00 0x06 0x83 0x0F 0x00 0x06 0x00 0x00 0xD8 0x01 0x81 0x09 0x00 0x06 0x81 0x09 0x00 0x06 0x81 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x0B 0x71 0x01 0x00 0x24 0x00 0x06 0x00 0x0A 0xE5 0x06 0x81 0x08 0x0F 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x06 0x81 0x07 0x01 0x06 0x81 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x06 0x03 0x81 0x03 0x01 0x03 0x81 0x03 0x02 0x03 0x81 0x09 0x05 0x03 0x81 0x0A 0x01 0x03 0x81 0x0A 0x0E 0x06 0x00 0x02 0xCB 0x06 0x00 0x03 0xA7 0x06 0x00 0x05 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x91 0x06 0x00 0x05 0xF7 0x06 0x00 0x07 0x40 0x03 0x81 0x03 0x03 0x06 0x00 0x02 0x82 0x06 0x00 0x08 0xBE 0x06 0x00 0x09 0x06 0x06 0x81 0x08 0x03 0x03 0x81 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x05 0x00 0x00 0x00 0x06 0x81 0x10 0x02 0x03 0x81 0x0A 0x08 0x03 0x81 0x09 0x04 0x03 0x81 0x0A 0x06 0x06 0x81 0x10 0x04 0x06 0x00 0x07 0xB2 0x03 0x83 0x0F 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x03 0x03 0x83 0x0F 0x05 0x03 0x83 0x0F 0x07 0x03 0x00 0x00 0x82 0x06 0x81 0x08 0x01 0x06 0x81 0x10 0x01 0x03 0x00 0x00 0x83 0x06 0x81 0x08 0x02 0x06 0x00 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x23 0x06 0x00 0x08 0x36 0x06 0x00 0x08 0x41 0x06 0x00 0x08 0x5B 0x06 0x00 0x08 0x6E 0x06 0x00 0x0A 0x7B 0x03 0x81 0x09 0x01 0x03 0x81 0x09 0x02 0x03 0x81 0x09 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x08 0x03 0x00 0x24 0x04 0x03 0x00 0x24 0x02 0x03 0x00 0x24 0x03 0x06 0x81 0x10 0x05 0x03 0x00 0x00 0x81 0x03 0x81 0x0A 0x07 0x03 0x81 0x0A 0x09 0x03 0x81 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x05 0x06 0x81 0x08 0x0B 0x06 0x81 0x08 0x04 0x06 0x81 0x10 0x03 0x06 0x81 0x08 0x0C 0x01 0x00 0x36 0x00 0x06 0x00 0x0B 0x66 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/JavaPurseCrypto/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x01 0xAD 0x00 0xC4 0x0A 0x09 0x03 0x05 0x05 0x04 0x1B 0x0D 0x0C 0x05 0x04 0x07 0x07 0x29 0x02 0x03 0x09 0x07 0x02 0x06 0x04 0x07 0x02 0x06 0x45 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x06 0x06 0x0B 0x06 0x07 0x04 0x04 0x04 0x09 0x08 0x08 0x09 0x0E 0x09 0x02 0x02 0x0F 0x0D 0x0D 0x0C 0x0E 0x02 0x24 0x05 0xD8 0x0C 0x33 0x0C 0x0F 0x06 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x0B 0x20 0x02 0x08 0x02 0x06 0x08 0x08 0x16 0x08 0x33 0x05 0x06 0x08 0x0C 0x0F 0x08 0x02 0x08 0x02 0x06 0x02 0x05 0x15 0x13 0x22 0x13 0x0C 0x0D 0x08 0x10 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x13 0x0B 0x04 0x02 0x14 0x17 0x10 0x09 0x16 0x0A 0x0B 0x02 0x08 0x02 0x06 0x02 0x04 0x11 0x16 0x08 0x0C 0x07 0x21 0x04 0x02 0x0A 0x0C 0x0E 0x08 0x36 0x0D 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x08 0x02 0x06 0x02 0x05 0x3B 0x0D 0x09 0x09 0x44 0x0B 0x02 0x08 0x02 0x06 0x02 0x04 0x08 0x12 0x39 0x0A 0x12 0x0A 0x1B 0x08 0x08 0x1B 0x25 0x16 0x1E 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x27 0x10 0x27 0x09 0x4B 0x34 0x0E 0x26 0x1B 0x0F 0x3C 0x0D 0x0A 0x2E 0x08 0x0D 0x15 0x0A 0x15 0x36 0x0A 0x19 0x0E 0x06 0x07 0x05 0x2B 0x04 0x05 0x05 0x03 0x0A 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x04 0x07 0x12 0x06 0x06 0x05 0x06 0x2F 0x0D 0x00 0xE5 0x05 0x13 0x0F 0x05 0x1D 0x2D 0x57 0x07 0x08 0x60 0x15 0x08 0x08 0x09 0x0A 0x04 0x09 0x0B 0x08 0x06 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x07 0x06 0x06 0x06 0x08 0x09 0x0E 0x0C 0x08 0x05 0x07 0x05 0x1F 0x07 0x07 0x07 0x08 0x0E 0x0D 0x07 0x07 0x0E 0x08 0x07 0x10 0x05 0x0F 0x06 0x06 0x04 0x0E 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0F 0x05 0x08 0x04 0x0E 0x0B 0x04 0x0F 0x0F 0x18 0x0A 0x0C 0x0A 0x0A 0x0B 0x09 0x0E 0x0D 0x0B 0x14 0x04 0x0E 0x10 0x04 0x1B 0x0D 0x0E 0x0A 0x09 0x0F 0x08 0x16 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0C 0x0C 0x13 0x0B 0x06 0x05 0x0E 0x06 0x03 0x0B 0x0C 0x0B 0x06 0x05 0x0F 0x0B 0x06 0x03 0x06 0x08 0x07 0x1D 0x14 0x0C 0x0A 0x09 0x0C 0x09 0x0D 0x0B 0x14 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x0C 0x04 0x11 0x11 0x0A 0x08 0x09 0x14 0x04 0x11 0x04 0x19 0x0D 0x0B 0x09 0x0F 0x0C 0x2C 0x04 0x09 0x09 0x09 0x08 0x08 0x07 0x08 0x08 0x08 0x08 0x08 0x09 0x0B 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x0C 0x0C 0x08 0x0C 0x0C 0x0D 0x1C 0x07 0x0B 0x0A 0x07 0x0B 0x08 0x09 0x08 0x08 0x28 0x0D 0x13 0x08 0x0F 0x0C 0x12 0x0D 0x06 0x07 0x0B 0x08 0x0A 0x1D 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x11 0x08 0x05 0x13 0x05 0x1C 0x08 0x0B 0x20 0x19 0x1C 0x13 0x08 0x07 0x08 0x1C 0x1E 0x09 0x0A 0x0B 0x08 0x27 0x09 0x0C 0x09 0x0A 0x0C 0x09 0x09 0x04 0x12 0x7F; -0x80 0xB4 0x09 0x00 0x10 0x08 0x07 0x0A 0x14 0x0F 0x04 0x2C 0x06 0x07 0x05 0x1B 0x10 0x05 0x29 0x23 0x0B 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/SampleLibrary.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/SampleLibrary.scr deleted file mode 100644 index cd500d78..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/javapurse/_tmp/SampleLibrary.scr +++ /dev/null @@ -1,49 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x04 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x00 0x00 0x15 0x00 0x02 0x00 0x03 0x00 0x01 0x00 0x0A 0x00 0x04 0x00 0x05 0x00 0x1A 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x06 0x06 0x00 0x03 0xC1 0x81 0x02 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x04 0x07 0x00 0x01 0x00 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x08 0x0A 0x00 0x05 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x05 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SampleLibrary/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x07 0x09 0x00 0x04 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/_tmp/photocard.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/_tmp/photocard.scr deleted file mode 100644 index 5c8355d6..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/_tmp/photocard.scr +++ /dev/null @@ -1,77 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x36 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x22 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x19 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x70 0x68 0x6F 0x74 0x6F 0x63 0x61 0x72 0x64 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x36 0x00 0x21 0x00 0x0E 0x00 0x34 0x00 0x7A 0x00 0x7C 0x02 0x50 0x00 0x0A 0x00 0x48 0x00 0x00 0x01 0x9F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x00 0x05 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x34 0x05 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x17 0x01 0x01 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x00 0x4D 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x7C 0x00 0x0E 0x02 0x41 0x02 0x44 0x04 0x44 0x4B 0x04 0x4B 0x44 0x06 0x4B 0x44 0x21 0xA1 0x81 0x00 0x09 0x50 0x68 0x6F 0x74 0x6F 0x43 0x61 0x72 0x64 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x82 0x03 0x03 0x00 0x03 0x07 0x01 0x00 0x00 0x00 0x58 0x22 0x83 0x05 0x03 0x00 0x03 0x01 0x06 0x00 0x00 0x00 0x8C 0x00 0xCF 0x01 0x1B 0x01 0x4E 0x01 0x71 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0xBB 0x81 0x00 0x00 0x00 0x10 0x06 0x01 0x02 0x03 0x04 0x05 0x06 0x06 0x2E 0x91 0x00 0x00 0x03 0x2F 0xCE 0x00 0x02 0x04 0x4E 0xF6 0x00 0x04 0x05 0x99 0x50 0x7F; -0x80 0xB4 0x06 0x00 0x1F 0x00 0x02 0x01 0xB1 0xE9 0x00 0x07 0x06 0xCF 0x30 0x00 0x0A 0x02 0x00 0x0D 0x50 0x68 0x6F 0x74 0x6F 0x43 0x61 0x72 0x64 0x49 0x6D 0x70 0x6C 0x01 0x00 0x10 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x02 0x50 0x03 0x01 0xF7 0x80 0x07 0x02 0x00 0x00 0x18 0x02 0x29 0x80 0x1C 0x02 0x4A 0x00 0x18 0x02 0x46 0x80 0x03 0x02 0x4A 0x00 0x18 0x04 0x10 0x18 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x11 0x18 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x09 0x87 0x00 0x18 0x8F 0x00 0x12 0x3D 0x04 0x8C 0x00 0x13 0x87 0x01 0x18 0x8F 0x00 0x07 0x3D 0xAD 0x00 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x87 0x02 0xAD 0x01 0xAD 0x02 0x05 0x8B 0x00 0x0A 0x18 0x8B 0x00 0x0B 0x7A 0x02 0x30 0x8F 0x00 0x0C 0x3D 0x8C 0x00 0x0D 0x3B 0x7A 0x02 0x20 0xAD 0x01 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0E 0x7A 0x03 0x11 0x18 0x8C 0x00 0x0F 0x18 0x07 0x91 0x00 0x10 0x87 0x03 0x18 0x07 0x90 0x0A 0x87 0x04 0x18 0x10 0x60 0x90 0x0B 0x87 0x05 0x03 0x30 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x07 0x6D 0x0C 0xAD 0x04 0x1D 0x03 0x38 0x59 0x01 0x01 0x70 0xF4 0x7A 0x03 0x22 0x03 0x8D 0x00 0x14 0x1D 0x10 0x10 0x41 0x6D 0x08 0x11 0x60 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x15 0x03 0x31 0x1E 0x07 0x6D 0x25 0xAD 0x03 0x1E 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2E 0xAD 0x03 0x1E 0x24 0x67 0x0D 0xAD 0x03 0x1E 0x1D 0x90 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x37 0x1E 0x04 0x41 0x78 0x59 0x02 0x01 0x70 0xDB 0x11 0x60 0x00 0x8D 0x00 0x15 0x02 0x78 0x05 0x61 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x06 0x15 0x06 0x67 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x16 0x04 0x1F 0x41 0x15 0x06 0x92 0x6F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x11 0x60 0x03 0x8D 0x00 0x15 0x1A 0x03 0x15 0x06 0x16 0x04 0x1F 0x8D 0x00 0x16 0x3B 0x16 0x05 0x61 0x09 0xAD 0x04 0x1D 0x04 0x43 0x04 0x38 0x7A 0x03 0x21 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2D 0x1A 0x66 0x10 0x01 0x2D 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x17 0xAD 0x04 0x1D 0x04 0x43 0x03 0x38 0x70 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x7A 0x03 0x21 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x2D 0x1A 0x66 0x05 0x1A 0x92 0x78 0x03 0x78 0x05 0x41 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x04 0x15 0x04 0x66 0x0A 0xAD 0x04 0x1D 0x04 0x43 0x25 0x61 0x08 0x11 0x60 0x01 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x15 0x1E 0x1F 0x41 0x15 0x04 0x92 0x6F 0x08 0x11 0x60 0x03 0x8D 0x00 0x15 0x15 0x04 0x1E 0xAD 0x05 0x03 0x1F 0x8D 0x00 0x16 0x3B 0xAD 0x05 0x77 0x06 0x44 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0x28 0x04 0x1F 0x1A 0x92 0x6F 0x08 0x11 0x70 0x00 0x8D 0x00 0x15 0x1D 0x07 0x6F 0x08 0x11 0x60 0x02 0x8D 0x00 0x15 0xAD 0x03 0x1D 0x04 0x43 0x24 0x94 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x00 0x94 0x0B 0x00 0x00 0x28 0x06 0x15 0x06 0x66 0x0A 0xAD 0x04 0x1D 0x04 0x43 0x25 0x61 0x08 0x11 0x60 0x01 0x8D 0x00 0x15 0x07 0x03 0x8D 0x00 0x19 0x28 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x70 0x0A 0x28 0x07 0x11 0x71 0x10 0x8D 0x00 0x15 0x15 0x04 0x15 0x06 0x03 0x15 0x06 0x92 0xAD 0x05 0x03 0x8B 0x00 0x1A 0x29 0x07 0x18 0xAD 0x05 0x1A 0x1F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x07 0x8C 0x00 0x1B 0x29 0x05 0x16 0x05 0x78 0x05 0x51 0x16 0x04 0x10 0x20 0x6A 0x08 0x11 0x74 0x44 0x8D 0x00 0x1C 0x19 0x03 0x1A 0x1F 0x16 0x04 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x13 0x1D 0x29 0x05 0x16 0x05 0x61 0x04 0x03 0x78 0x11 0x71 0x11 0x78 0x28 0x05 0x11 0x73 0x33 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x7A 0x00 0x1E 0x02 0x00 0x1D 0x02 0x02 0x00 0x1D 0x00 0x02 0x00 0x1D 0x01 0x02 0x00 0x29 0x00 0x02 0x00 0x29 0x01 0x02 0x00 0x29 0x02 0x01 0x00 0x29 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x04 0x00 0x06 0x83 0x04 0x00 0x06 0x00 0x00 0x61 0x03 0x83 0x06 0x01 0x03 0x82 0x03 0x01 0x01 0x00 0x1D 0x00 0x06 0x00 0x00 0x19 0x03 0x83 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x04 0x06 0x83 0x05 0x00 0x01 0x80 0x00 0x00 0x06 0x82 0x03 0x00 0x01 0x83 0x06 0x00 0x06 0x83 0x06 0x00 0x06 0x82 0x08 0x10 0x06 0x82 0x0F 0x02 0x06 0x82 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x1D 0x01 0x06 0x82 0x08 0x12 0x01 0x84 0x0C 0x00 0x06 0x84 0x0B 0x00 0x03 0x84 0x0B 0x01 0x06 0x00 0x02 0x27 0x06 0x82 0x07 0x01 0x06 0x82 0x10 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/photocard/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x48 0x00 0x1B 0x28 0x0B 0x07 0x05 0x02 0x02 0x18 0x12 0x06 0x07 0x08 0x23 0x0D 0x06 0x24 0x38 0x14 0x17 0x1C 0x23 0x14 0x1F 0x08 0x1D 0x14 0x27 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x00 0x29 0x07 0x08 0x08 0x06 0x04 0x04 0x06 0x05 0x06 0x06 0x0A 0x04 0x06 0x04 0x0A 0x07 0x05 0x26 0x0C 0x2F 0x0E 0x1A 0x0F 0x0A 0x19 0x17 0x0F 0x0D 0x23 0x22 0x7F; -0x80 0xB4 0x09 0x00 0x0B 0x0E 0x0A 0x14 0x0A 0x22 0x05 0x0C 0x0E 0x0C 0x13 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_magnify.gif b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_magnify.gif deleted file mode 100644 index 63f52704..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_magnify.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_pencil.gif b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_pencil.gif deleted file mode 100644 index 721a1498..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_pencil.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_thumbsup.gif b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_thumbsup.gif deleted file mode 100644 index 177ad133..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_thumbsup.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_wave.gif b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_wave.gif deleted file mode 100644 index 83bbb536..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/duke_wave.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.bat deleted file mode 100644 index a6bed074..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.bat +++ /dev/null @@ -1,38 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -REM Workfile:@(#)photocard.bat 1.6 -REM Version:1.6 -REM Modified:02/24/06 19:01:01 - -@echo on -@echo This demo requires a cref or jcwde with com.sun.javacard.photocard applet installed - -@echo Start cref or jcwde before running this demo -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - - -set JC_RMICPATH=%JC_HOME%\lib\base-core.jar;%JC_HOME%\lib\base-opt.jar;%JC_HOME%\lib\jcrmiclientframework.jar;%JC_HOME%\lib\jcclientsamples.jar;%JC_HOME%\lib\apduio.jar;%JC_HOME%\samples\classes;%JC_HOME%\samples\src_client - -%JAVA_HOME%\bin\java -classpath %JC_RMICPATH%;%CLASSPATH% com.sun.javacard.clientsamples.photocardclient.PhotoCardClient %1 %2 %3 %4 - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out deleted file mode 100644 index eb4052b3..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out +++ /dev/null @@ -1,55 +0,0 @@ -This demo requires a cref or jcwde with com.sun.javacard.photocard applet installed -Start cref or jcwde before running this demo - - -PhotoCard demo - -Reading file: duke_magnify.gif... -Image size is 21,280 bytes -Placing picture inside smart card... -On-card picture ID is 1 - -Reading file: duke_pencil.gif... -Image size is 11,723 bytes -Placing picture inside smart card... -On-card picture ID is 2 - -Reading file: duke_wave.gif... -Image size is 7,553 bytes -Placing picture inside smart card... -On-card picture ID is 3 - -Reading file: duke_thumbsup.gif... -Image size is 6,771 bytes -Placing picture inside smart card... -On-card picture ID is 4 - - -Recovering pictures from smart card... - -Recovering Picture ID 1... -On-card image size is 21,280 bytes -Recovered 21,280 bytes for duke_magnify.gif -Placing recovered picture in file recv.duke_magnify.gif - -Recovering Picture ID 2... -On-card image size is 11,723 bytes -Recovered 11,723 bytes for duke_pencil.gif -Placing recovered picture in file recv.duke_pencil.gif - -Recovering Picture ID 3... -On-card image size is 7,553 bytes -Recovered 7,553 bytes for duke_wave.gif -Placing recovered picture in file recv.duke_wave.gif - -Recovering Picture ID 4... -On-card image size is 6,771 bytes -Recovered 6,771 bytes for duke_thumbsup.gif -Placing recovered picture in file recv.duke_thumbsup.gif - - -Verifying photo-id now... - -Reading file: duke_magnify.gif... -sending photo for on-card verification -Photo is valid. diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out.not_crypto b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out.not_crypto deleted file mode 100644 index 0d6fb5eb..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/photocard/photocard.scr.expected.out.not_crypto +++ /dev/null @@ -1,55 +0,0 @@ -This demo requires a cref or jcwde with com.sun.javacard.photocard applet installed -Start cref or jcwde before running this demo - - -PhotoCard demo - -Reading file: duke_magnify.gif... -Image size is 21,280 bytes -Placing picture inside smart card... -On-card picture ID is 1 - -Reading file: duke_pencil.gif... -Image size is 11,723 bytes -Placing picture inside smart card... -On-card picture ID is 2 - -Reading file: duke_wave.gif... -Image size is 7,553 bytes -Placing picture inside smart card... -On-card picture ID is 3 - -Reading file: duke_thumbsup.gif... -Image size is 6,771 bytes -Placing picture inside smart card... -On-card picture ID is 4 - - -Recovering pictures from smart card... - -Recovering Picture ID 1... -On-card image size is 21,280 bytes -Recovered 21,280 bytes for duke_magnify.gif -Placing recovered picture in file recv.duke_magnify.gif - -Recovering Picture ID 2... -On-card image size is 11,723 bytes -Recovered 11,723 bytes for duke_pencil.gif -Placing recovered picture in file recv.duke_pencil.gif - -Recovering Picture ID 3... -On-card image size is 7,553 bytes -Recovered 7,553 bytes for duke_wave.gif -Placing recovered picture in file recv.duke_wave.gif - -Recovering Picture ID 4... -On-card image size is 6,771 bytes -Recovered 6,771 bytes for duke_thumbsup.gif -Placing recovered picture in file recv.duke_thumbsup.gif - - -Verifying photo-id now... - -Reading file: duke_magnify.gif... -sending photo for on-card verification -Photo verification requires availability of MessageDigest class and SHA256 algorithm diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/RMIDemo.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/RMIDemo.scr deleted file mode 100644 index 08ed63fb..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/RMIDemo.scr +++ /dev/null @@ -1,63 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x34 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x20 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x34 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0x52 0x00 0x66 0x00 0xBF 0x00 0x0A 0x00 0x29 0x00 0x00 0x01 0x3F 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x00 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x08 0x01 0x00 0x35 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x66 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x00 0x82 0x03 0x03 0x00 0x03 0x07 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x40 0x22 0x83 0x05 0x02 0x00 0x01 0x01 0x05 0x00 0x00 0x00 0x5A 0x00 0x72 0x00 0x95 0x00 0xB5 0x00 0xBA 0x81 0x00 0x00 0x00 0x0A 0x05 0x05 0x03 0x02 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x04 0x05 0x15 0x44 0x00 0x00 0x01 0x27 0x78 0x00 0x02 0x04 0x93 0x57 0x00 0x04 0x03 0xEC 0xA8 0x00 0x06 0x05 0xF1 0x0F 0x00 0x04 0x02 0x00 0x09 0x50 0x75 0x72 0x7F; -0x80 0xB4 0x06 0x00 0x09 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xBF 0x00 0x04 0x10 0x18 0x8C 0x00 0x10 0x18 0x8F 0x00 0x06 0x3D 0x8C 0x00 0x09 0x87 0x00 0x18 0x8F 0x00 0x11 0x3D 0x04 0x8C 0x00 0x05 0x87 0x01 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8F 0x00 0x07 0x3D 0xAD 0x00 0x8C 0x00 0x08 0x87 0x02 0xAD 0x01 0xAD 0x02 0x05 0x8B 0x00 0x0A 0x18 0x8B 0x00 0x0B 0x7A 0x02 0x30 0x8F 0x00 0x0C 0x3D 0x8C 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0D 0x3B 0x7A 0x02 0x20 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x7A 0x02 0x10 0x18 0x8C 0x00 0x0F 0x18 0x03 0x89 0x03 0x18 0x08 0x90 0x0B 0x87 0x04 0x7A 0x05 0x20 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x19 0x03 0xAD 0x04 0x03 0x08 0x8D 0x00 0x13 0x3B 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x8D 0x00 0x12 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAF 0x03 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x41 0x89 0x03 0x7A 0x03 0x20 0x1D 0x64 0x08 0x11 0x60 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x12 0xAF 0x03 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x12 0x18 0x3D 0x85 0x03 0x1D 0x43 0x89 0x03 0x7A 0x01 0x10 0xAD 0x04 0x77 0x01 0x10 0xAF 0x7F; -0x80 0xB4 0x07 0x00 0x02 0x03 0x78 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x52 0x00 0x14 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x01 0x02 0x00 0x1F 0x01 0x02 0x00 0x1F 0x00 0x06 0x83 0x06 0x00 0x01 0x00 0x1F 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x01 0x83 0x04 0x00 0x06 0x83 0x04 0x00 0x06 0x00 0x00 0x49 0x03 0x83 0x06 0x01 0x03 0x82 0x03 0x01 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x03 0x83 0x06 0x7F; -0x80 0xB4 0x05 0x00 0x15 0x04 0x06 0x83 0x05 0x00 0x06 0x82 0x03 0x00 0x01 0x83 0x06 0x00 0x06 0x82 0x0F 0x02 0x06 0x82 0x10 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/RMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x29 0x00 0x12 0x10 0x0B 0x07 0x05 0x02 0x02 0x18 0x0F 0x06 0x12 0x14 0x11 0x04 0x0E 0x0E 0x04 0x05 0x05 0x00 0x13 0x05 0x04 0x04 0x06 0x05 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x0C 0x0A 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x0D 0x0F 0x14 0x0C 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/SecureRMIDemo.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/SecureRMIDemo.scr deleted file mode 100644 index 54af347a..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/_tmp/SecureRMIDemo.scr +++ /dev/null @@ -1,91 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x20 0x01 0x00 0x3A 0xDE 0xCA 0xFF 0xED 0x02 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x26 0x63 0x6F 0x6D 0x2F 0x73 0x75 0x6E 0x2F 0x6A 0x7F; -0x80 0xB4 0x01 0x00 0x1D 0x61 0x76 0x61 0x63 0x61 0x72 0x64 0x2F 0x73 0x61 0x6D 0x70 0x6C 0x65 0x73 0x2F 0x53 0x65 0x63 0x75 0x72 0x65 0x52 0x4D 0x49 0x44 0x65 0x6D 0x6F 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x21 0x00 0x3A 0x00 0x21 0x00 0x0E 0x00 0x2A 0x00 0xBE 0x00 0xAF 0x03 0x3B 0x00 0x14 0x00 0x81 0x00 0x00 0x02 0x4B 0x00 0x00 0x00 0x04 0x00 0x02 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x04 0x04 0x04 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x2A 0x04 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x03 0x00 0x01 0x08 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x0D 0x01 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0A 0x01 0x02 0x0D 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0xAF 0x00 0x08 0x02 0xB1 0x01 0xB0 0x02 0x41 0x01 0x40 0xA1 0x81 0x00 0x05 0x50 0x75 0x72 0x73 0x65 0x02 0x82 0x03 0x04 0x00 0x02 0x01 0x15 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x00 0x38 0x00 0xEC 0x01 0x5E 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7F; -0x80 0xB4 0x06 0x00 0x20 0xFF 0xFF 0xFF 0xFF 0x00 0x50 0x00 0x5D 0x01 0xA4 0x82 0x00 0x03 0x01 0x02 0x03 0x82 0x01 0x06 0x01 0x02 0x03 0x14 0x15 0x13 0x00 0x83 0x03 0x01 0x00 0x01 0x07 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x00 0x00 0x02 0x18 0x22 0x82 0x05 0x03 0x00 0x02 0x01 0x05 0x00 0x00 0x02 0x36 0x02 0x76 0x02 0xB9 0x02 0xDE 0x03 0x16 0x81 0x00 0x00 0x00 0x0A 0x05 0x03 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x01 0x02 0x04 0x05 0x05 0x15 0x44 0x00 0x00 0x04 0x27 0x78 0x00 0x02 0x05 0x93 0x57 0x00 0x04 0x01 0xEC 0xA8 0x00 0x06 0x03 0xF1 0x0F 0x00 0x04 0x02 0x00 0x0F 0x7F; -0x80 0xB4 0x06 0x00 0x12 0x53 0x65 0x63 0x75 0x72 0x65 0x50 0x75 0x72 0x73 0x65 0x49 0x6D 0x70 0x6C 0x01 0x00 0x0A 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x3B 0x00 0x05 0x10 0x18 0x8C 0x00 0x22 0x18 0x01 0x87 0x00 0x18 0x8F 0x00 0x09 0x3D 0x05 0x05 0x8C 0x00 0x0A 0x87 0x01 0x18 0x8F 0x00 0x09 0x3D 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8C 0x00 0x0A 0x87 0x00 0xAD 0x01 0x7B 0x00 0x29 0x03 0x05 0x8B 0x00 0x2A 0xAD 0x00 0x7B 0x00 0x2B 0x03 0x05 0x8B 0x00 0x2A 0x7A 0x02 0x20 0x18 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x60 0x0C 0x18 0x03 0x88 0x02 0x18 0x03 0x88 0x03 0x03 0x78 0x18 0x19 0x8C 0x00 0x0B 0x78 0x02 0x20 0xAE 0x02 0x1D 0x53 0x60 0x05 0x04 0x70 0x03 0x03 0x78 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x20 0xAE 0x03 0x1D 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x03 0x20 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x18 0x19 0x8C 0x00 0x0D 0x60 0x0C 0x18 0x3D 0x84 0x02 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x55 0x88 0x02 0x70 0x0B 0x18 0x3D 0x84 0x02 0x10 0xFD 0x53 0x88 0x02 0x03 0x78 0x04 0x24 0x19 0x8B 0x00 0x0E 0x2D 0x19 0x8B 0x00 0x0F 0x61 0x04 0x03 0x78 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0E 0x03 0x3E 0x25 0x10 0xF3 0x53 0x38 0x1A 0x07 0x25 0x32 0x1F 0x05 0x6D 0x04 0x03 0x78 0x03 0x29 0x04 0x1A 0x07 0x3E 0x25 0x05 0x43 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x25 0x32 0x08 0x29 0x05 0x16 0x05 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x29 0x05 0x16 0x04 0x16 0x05 0x6B 0x05 0x04 0x70 0x03 0x03 0x78 0x04 0x20 0x18 0x19 0x8C 0x00 0x11 0x60 0x69 0x18 0x19 0x8B 0x00 0x0C 0x3B 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x07 0x25 0x05 0x6B 0x4F 0x18 0x03 0x88 0x03 0xAD 0x01 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x06 0x88 0x03 0x18 0x19 0x03 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x35 0xAD 0x00 0x19 0x8B 0x00 0x0E 0x08 0x05 0x8B 0x00 0x12 0x60 0x14 0x18 0x04 0x88 0x03 0x18 0x19 0x03 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x18 0x19 0x8B 0x00 0x14 0x3B 0x70 0x16 0x18 0x19 0x11 0x66 0x66 0x8B 0x00 0x15 0x3B 0x70 0x0B 0x18 0x19 0x11 0x65 0x65 0x8B 0x00 0x15 0x3B 0x04 0x78 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x04 0x24 0x18 0x8B 0x00 0x08 0x60 0x04 0x03 0x78 0x19 0x8B 0x00 0x0E 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x03 0x29 0x04 0x08 0x29 0x05 0x16 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1F 0x08 0x41 0x6D 0x10 0x16 0x04 0x1A 0x16 0x05 0x25 0x41 0x29 0x04 0x59 0x05 0x01 0x70 0xED 0x1A 0x1F 0x08 0x41 0x16 0x04 0x8D 0x00 0x16 0x3B 0x1A 0x07 0x3E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x05 0x41 0x5B 0x38 0x03 0x78 0x01 0x20 0x03 0x78 0x02 0x20 0x18 0x19 0x8B 0x00 0x17 0x10 0x80 0x6B 0x0E 0x18 0x19 0x8B 0x00 0x18 0x10 0x39 0x6B 0x05 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x03 0x03 0x78 0x04 0x13 0x18 0x8C 0x00 0x19 0x8F 0x00 0x1A 0x3D 0x8C 0x00 0x1B 0x2C 0x8F 0x00 0x1C 0x3D 0x19 0x8C 0x00 0x1D 0x2D 0x8F 0x00 0x1E 0x3D 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8C 0x00 0x1F 0x2E 0x18 0x8F 0x00 0x20 0x3D 0x07 0x8C 0x00 0x21 0x87 0x04 0xAD 0x04 0x19 0x04 0x8B 0x00 0x23 0xAD 0x04 0x19 0x05 0x8B 0x00 0x23 0xAD 0x04 0x1B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8B 0x00 0x23 0xAD 0x04 0x19 0x06 0x8B 0x00 0x23 0x18 0x8B 0x00 0x24 0x7A 0x02 0x30 0x8F 0x00 0x25 0x3D 0x8C 0x00 0x26 0x3B 0x7A 0x02 0x20 0xAD 0x04 0x19 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x27 0x7A 0x02 0x20 0x18 0x8C 0x00 0x28 0x18 0x03 0x89 0x05 0x18 0x19 0x87 0x06 0x18 0x08 0x90 0x0B 0x87 0x07 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x43 0x63 0x08 0x11 0x60 0x00 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x43 0x89 0x05 0x7A 0x03 0x20 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0x1D 0x64 0x08 0x11 0x60 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x8D 0x00 0x2D 0xAF 0x05 0x1D 0x41 0x11 0x01 0x90 0x6F 0x08 0x11 0x60 0x01 0x8D 0x00 0x2D 0x18 0x3D 0x85 0x05 0x1D 0x41 0x89 0x05 0x7A 0x02 0x10 0xAD 0x06 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAF 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x78 0x05 0x20 0xAD 0x06 0x05 0x8E 0x02 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x06 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x2D 0x19 0x92 0x08 0x6A 0x08 0x11 0x60 0x02 0x8D 0x00 0x2D 0x19 0x03 0xAD 0x07 0x03 0x08 0x8D 0x00 0x2E 0x3B 0x7A 0x02 0x10 0xAD 0x06 0x05 0x8E 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x1E 0x00 0x2C 0x05 0x61 0x08 0x11 0x60 0x04 0x8D 0x00 0x2D 0xAD 0x06 0x04 0x8E 0x02 0x00 0x2C 0x03 0x61 0x08 0x11 0x60 0x03 0x8D 0x00 0x2D 0xAD 0x07 0x77 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x17 0x08 0x00 0x14 0x00 0x04 0x00 0x02 0x00 0x02 0x03 0x00 0x02 0x12 0x34 0x03 0x00 0x02 0x43 0x21 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0xBE 0x00 0x2F 0x02 0x00 0x13 0x01 0x02 0x00 0x13 0x00 0x02 0x00 0x13 0x02 0x02 0x00 0x13 0x03 0x02 0x00 0x56 0x00 0x02 0x00 0x62 0x02 0x02 0x00 0x62 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x02 0x00 0x62 0x00 0x03 0x82 0x03 0x12 0x01 0x83 0x09 0x00 0x06 0x83 0x09 0x00 0x06 0x00 0x00 0x69 0x03 0x82 0x03 0x04 0x06 0x00 0x00 0x8D 0x03 0x83 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x03 0x83 0x0A 0x0D 0x06 0x83 0x10 0x04 0x06 0x00 0x01 0xA8 0x03 0x83 0x09 0x01 0x03 0x82 0x03 0x07 0x03 0x82 0x03 0x0C 0x03 0x82 0x03 0x0B 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x06 0x03 0x82 0x03 0x0E 0x03 0x82 0x03 0x0F 0x06 0x83 0x03 0x00 0x01 0x00 0x13 0x00 0x06 0x00 0x00 0x01 0x01 0x00 0x62 0x00 0x06 0x00 0x02 0x21 0x01 0x82 0x04 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x82 0x04 0x00 0x01 0x82 0x06 0x00 0x06 0x82 0x06 0x00 0x06 0x82 0x03 0x00 0x03 0x82 0x06 0x01 0x03 0x83 0x03 0x01 0x01 0x00 0x56 0x00 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0xC1 0x03 0x82 0x06 0x04 0x06 0x82 0x05 0x00 0x05 0x00 0x00 0x00 0x03 0x83 0x09 0x08 0x05 0x00 0x00 0x02 0x01 0x82 0x01 0x00 0x06 0x83 0x0F 0x02 0x06 0x83 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/SecureRMIDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x81 0x00 0x2E 0x0A 0x0C 0x0C 0x02 0x0A 0x15 0x04 0x0C 0x0D 0x1B 0x04 0x06 0x05 0x7D 0x02 0x0F 0x10 0x0F 0xB4 0x02 0x07 0x07 0x07 0x19 0x0F 0x04 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x10 0x19 0x0E 0x04 0x05 0x10 0x19 0x11 0x04 0x05 0x10 0x10 0x05 0x10 0x1D 0x0B 0x10 0x10 0x00 0x4F 0x05 0x08 0x06 0x06 0x06 0x07 0x05 0x05 0x05 0x07 0x11 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x21 0x06 0x1D 0x05 0x08 0x3F 0x14 0x07 0x05 0x0F 0x05 0x0C 0x05 0x09 0x05 0x0C 0x05 0x0B 0x0B 0x0B 0x08 0x2D 0x16 0x09 0x0F 0x03 0x04 0x04 0x05 0x04 0x05 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x09 0x07 0x07 0x07 0x04 0x06 0x04 0x0A 0x07 0x18 0x09 0x07 0x09 0x09 0x0C 0x12 0x09 0x07 0x09 0x09 0x0F 0x12 0x09 0x07 0x09 0x0C 0x09 0x07 0x09 0x0B 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x04 0x0B 0x09 0x07 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.bat deleted file mode 100644 index 3c4aedee..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.bat +++ /dev/null @@ -1,38 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -REM Workfile:@(#)rmidemo.bat 1.22 -REM Version:1.22 -REM Modified:02/24/06 19:01:01 - -@echo on -@echo This demo requires a cref or jcwde with com.sun.javacard.RMIDemo applet installed - -@echo Start cref or jcwde before running this demo -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - - -set JC_RMICPATH=%JC_HOME%\lib\base-core.jar;%JC_HOME%\lib\base-opt.jar;%JC_HOME%\lib\jcrmiclientframework.jar;%JC_HOME%\lib\jcclientsamples.jar;%JC_HOME%\lib\apduio.jar;%JC_HOME%\samples\classes;%JC_HOME%\samples\src_client - -%JAVA_HOME%\bin\java -classpath %JC_RMICPATH%;%CLASSPATH% com.sun.javacard.clientsamples.purseclient.PurseClient %1 - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.scr.expected.out deleted file mode 100644 index 60968452..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/rmidemo.scr.expected.out +++ /dev/null @@ -1,12 +0,0 @@ -This demo requires a cref or jcwde with com.sun.javacard.RMIDemo applet installed -Start cref or jcwde before running this demo -Receiving initial reference... OK -Getting the balance... Balance = 0 -Crediting 20... -Debiting 15... -Getting the new balance... Balance = 5 -Setting account number equal to 54321... -Getting the account number... 5 4 3 2 1 -Trying to set incorrect (too long) account number. Expecting to get UserException with code=0x6002 -Received UserException javacard.framework.UserException -Reason code = 0x6002 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.bat deleted file mode 100644 index b3c147f0..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.bat +++ /dev/null @@ -1,39 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -REM Workfile:@(#)securermidemo.bat 1.21 -REM Version:1.21 -REM Modified:02/24/06 19:01:01 - -@echo on -@echo This demo requires a cref or jcwde with com.sun.javacard.SecureRMIDemo -@echo applet installed - -@echo Start cref or jcwde before running this demo -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - - -set JC_RMICPATH=%JC_HOME%\lib\base-core.jar;%JC_HOME%\lib\base-opt.jar;%JC_HOME%\lib\jcrmiclientframework.jar;%JC_HOME%\lib\jcclientsamples.jar;%JC_HOME%\lib\apduio.jar;%JC_HOME%\samples\classes;%JC_HOME%\samples\src_client - -%JAVA_HOME%\bin\java -classpath %JC_RMICPATH%;%CLASSPATH% com.sun.javacard.clientsamples.securepurseclient.SecurePurseClient %1 - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.scr.expected.out deleted file mode 100644 index b405deac..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/rmi/securermidemo.scr.expected.out +++ /dev/null @@ -1,11 +0,0 @@ -This demo requires a cref or jcwde with com.sun.javacard.SecureRMIDemo -applet installed -Start cref or jcwde before running this demo -Authenticating as app provider... done. -Receiving initial reference... OK -Getting the balance... Balance = 0 -Crediting 20... -Getting the new balance... Balance = 20 -Debiting 15... Should fail with UserException with code=0x6003 -Received UserException javacard.framework.UserException -Reason code = 0x6003 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/wallet/_tmp/Wallet.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/wallet/_tmp/Wallet.scr deleted file mode 100644 index fd9717a8..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo2/wallet/_tmp/Wallet.scr +++ /dev/null @@ -1,67 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x15 0x00 0x62 0x00 0x12 0x01 0xCB 0x00 0x0A 0x00 0x3C 0x00 0x00 0x00 0xD6 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x06 0x01 0x00 0x41 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x15 0x06 0x00 0x12 0x00 0x80 0x03 0x02 0x00 0x01 0x04 0x04 0x00 0x00 0x00 0x5C 0xFF 0xFF 0x00 0x4F 0x00 0x64 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x01 0xCB 0x00 0x05 0x43 0x18 0x8C 0x00 0x03 0x18 0x8F 0x00 0x13 0x3D 0x06 0x10 0x08 0x8C 0x00 0x02 0x87 0x00 0x19 0x1E 0x25 0x29 0x04 0x1E 0x16 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x05 0x1E 0x16 0x05 0x41 0x04 0x41 0x31 0x19 0x1E 0x25 0x29 0x06 0xAD 0x00 0x19 0x1E 0x04 0x41 0x16 0x06 0x8B 0x00 0x04 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x05 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x10 0xAD 0x00 0x8B 0x00 0x08 0x61 0x04 0x03 0x78 0x04 0x78 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x10 0xAD 0x00 0x8B 0x00 0x09 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x0B 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0C 0x1A 0x03 0x25 0x10 0x80 0x6A 0x08 0x11 0x6E 0x00 0x8D 0x00 0x0C 0x1A 0x04 0x25 0x75 0x00 0x2D 0x00 0x04 0x00 0x20 0x00 0x27 0x00 0x30 0x00 0x21 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x40 0x00 0x1B 0x00 0x50 0x00 0x15 0x18 0x19 0x8C 0x00 0x0D 0x7A 0x18 0x19 0x8C 0x00 0x0E 0x7A 0x18 0x19 0x8C 0x00 0x0F 0x7A 0x18 0x19 0x8C 0x00 0x10 0x7A 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x0C 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x12 0x5B 0x29 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x63 0x08 0x11 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x41 0x11 0x7F 0xFF 0x6F 0x08 0x11 0x6A 0x84 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x41 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0x7A 0x03 0x24 0xAD 0x00 0x8B 0x00 0x11 0x61 0x08 0x11 0x63 0x01 0x8D 0x00 0x0C 0x19 0x8B 0x00 0x0A 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x00 0x12 0x5B 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x1F 0x04 0x6B 0x07 0x16 0x04 0x04 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x1A 0x08 0x25 0x29 0x05 0x16 0x05 0x10 0x7F 0x6E 0x06 0x16 0x05 0x63 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6A 0x83 0x8D 0x00 0x0C 0xAF 0x01 0x16 0x05 0x43 0x63 0x08 0x11 0x6A 0x85 0x8D 0x00 0x0C 0x18 0xAF 0x01 0x16 0x05 0x43 0x89 0x01 0x7A 0x04 0x22 0x19 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0A 0x2D 0x19 0x8B 0x00 0x14 0x32 0x1F 0x05 0x6D 0x08 0x11 0x67 0x00 0x8D 0x00 0x0C 0x19 0x05 0x8B 0x00 0x15 0x1A 0x03 0xAF 0x01 0x10 0x08 0x4F 0x5B 0x38 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0xAF 0x01 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x03 0x05 0x8B 0x00 0x16 0x7A 0x04 0x22 0x19 0x8B 0x00 0x0A 0x2D 0x19 0x8B 0x00 0x12 0x5B 0x32 0xAD 0x00 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x0E 0x08 0x1F 0x8B 0x00 0x17 0x61 0x08 0x11 0x63 0x00 0x8D 0x00 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x62 0x00 0x18 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x06 0x80 0x09 0x00 0x06 0x80 0x03 0x00 0x03 0x80 0x09 0x08 0x03 0x80 0x03 0x01 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x09 0x02 0x03 0x80 0x09 0x05 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x06 0x00 0x01 0x78 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x1F 0x06 0x00 0x00 0xC3 0x06 0x00 0x01 0xAD 0x03 0x80 0x09 0x04 0x03 0x80 0x0A 0x06 0x01 0x80 0x09 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x7F; -0x80 0xB4 0x05 0x00 0x05 0x04 0x03 0x80 0x09 0x01 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/wallet/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x3C 0x00 0x0F 0x13 0x1F 0x20 0x0D 0x67 0x41 0x11 0x05 0x05 0x41 0x0E 0x05 0x20 0x09 0x1C 0x00 0x29 0x05 0x04 0x07 0x2A 0x04 0x06 0x07 0x09 0x0D 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x1F 0x05 0x10 0x0D 0x1D 0x06 0x06 0x06 0x07 0x08 0x08 0x04 0x09 0x12 0x15 0x10 0x10 0x08 0x04 0x09 0x12 0x15 0x0D 0x0F 0x05 0x0B 0x05 0x19 0x07 0x05 0x0A 0x08 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr deleted file mode 100644 index e9bb0971..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr +++ /dev/null @@ -1,122 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)demo3.scr 1.10 -// Version:1.10 -// Date:01/04/06 -//- - -///////////////////////////////////////////////////////////////////// -// This is a sample input file used by the jp.bat file. -// -// Comments lines begin with "//". -// Non-comment lines are C-APDUs represented by hex digits. -// -// Beneath each C-APDU is a comment the corresponding R-APDU expected to be returned -// by the card. -// -// Compare the expected with the actual APDUs to verify correct behavior. -///////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////// -// Select all installed Applets -///////////////////////////////////////////////////////////////////// - -powerup; - -////////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 22446688 in the Bank -////////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Credit $250.00 -0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 00 00 00 07 00 00 00 00 00 00 00 00 90 00 -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=7 - -// Complete Transaction: Date 10/27/97; Time 15:33 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x21 0x7F; -// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00; - -// Initialize Transaction: Debit $25.00; -0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 61 a8 00 08 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=8 - -// Complete Transaction: Date 10/27/97; Time 15:35 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x23 0x7F; -// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00; - -///////////////////////////////////////////////////////////////////// -// Regular transaction session at CAD 33557799 in a store -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Initialize Transaction: Debit $22.95 -0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 57 e4 00 09 00 00 00 00 00 00 00 00 90 00; -//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=9 - -// Complete Transaction: Date 10/27/97; Time 17:45 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x11 0x2d 0x7F; -// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05 - -///////////////////////////////////////////////////////////////////// -// Session of reading balance and log at CAD 22446688 in the Bank -///////////////////////////////////////////////////////////////////// - -// Select JavaPurse -0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127; -// 90 00 = SW_NO_ERROR - -// Verify PIN (User PIN 01020304) -0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00; -// 90 00; - -// Read the only record in Balances file : -// SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24 -0x00 0xb2 0x01 0x24 0x00 0x7F; -// 4e ed 7d 00 4e 20 90 00 = Balance = $202.05, Max Balance = $320.00, Max Transaction = $200; - -// Read the first record in log file -// SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c -0x00 0xb2 0x01 0x1c 0x00 0x7F; -// 00 09 02 08 f7 33 55 77 99 0a 1b 61 11 2d 4e ed 90 00 90 00 -// TN = 9; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799; -// Date 10/27/97 (0a 1b 61); Time 17:45(11 2d); Balance $202.05 (4b 13), SW = NO_ERROR (9000) - -// Initialize transaction: Debit $9.86 -0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4e ed 00 0a 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19; - -// Initialize transaction: Debit $192.19 -0x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F; -// 05 05 05 05 0c 1f 62 4b 13 00 0b 00 00 00 00 00 00 00 00 90 00; - -// Complete Transaction: Date 10/28/97; Time 18:53 -0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F; -// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0; - -// *** SCRIPT END *** -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr.expected.out deleted file mode 100644 index b5d3fb6d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/demo3/demo3.scr.expected.out +++ /dev/null @@ -1,18 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 61, a8, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 00, 00, 00, 07, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 21, Le: 0a, 61, a8, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 09, c4, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 61, a8, 00, 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 23, Le: 0a, 57, e4, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 55, 77, 99, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 57, e4, 00, 09, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 11, 2d, Le: 0a, 4e, ed, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 24, Lc: 00, Le: 06, 4e, ed, 7d, 00, 4e, 20, SW1: 90, SW2: 00 -CLA: 00, INS: b2, P1: 01, P2: 1c, Lc: 00, Le: 12, 00, 09, 02, 08, f7, 33, 55, 77, 99, 0a, 1b, 61, 11, 2d, 4e, ed, 90, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 0a, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 4b, 13, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4b, 13, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 0b, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde.app b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde.app deleted file mode 100644 index 7977f8a9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde.app +++ /dev/null @@ -1,17 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)jcwde.app 1.5 -// Version:1.5 -// Date:01/04/06 -//- - -// applet AID -com.sun.javacard.installer.InstallerApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0x8:0x1 -com.sun.javacard.samples.JavaPurse.JavaPurse 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1 -com.sun.javacard.samples.JavaLoyalty.JavaLoyalty 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5:0x1 -com.sun.javacard.samples.wallet.Wallet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x6:0x1 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_ecrmi.app b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_ecrmi.app deleted file mode 100644 index 7c52cb21..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_ecrmi.app +++ /dev/null @@ -1,13 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)jcwde_ecrmi.app 1.5 -// Version:1.5 -// Date:01/04/06 -//- - -// applet AID -com.sun.javacard.samples.eccrmi.ECPurseApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x8:0x1 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_rmi.app b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_rmi.app deleted file mode 100644 index 234ad7b9..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_rmi.app +++ /dev/null @@ -1,13 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)jcwde_rmi.app 1.3 -// Version:1.3 -// Date:01/04/06 -//- - -// applet AID -com.sun.javacard.samples.RMIDemo.PurseApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x8:0x1 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_securermi.app b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_securermi.app deleted file mode 100644 index 555edfb5..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_securermi.app +++ /dev/null @@ -1,13 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)jcwde_securermi.app 1.4 -// Version:1.4 -// Date:01/04/06 -//- - -// applet AID -com.sun.javacard.samples.SecureRMIDemo.SecurePurseApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0xa:0x1 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_transit.app b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_transit.app deleted file mode 100644 index a0c4df4b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/jcwde/jcwde_transit.app +++ /dev/null @@ -1,16 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)jcwde_transit.app 1.2 -// Version:1.2 -// Date:01/04/06 -//- - -// applet AID -com.sun.javacard.installer.InstallerApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0x8:0x1 -com.sun.javacard.samples.transit.TransitApplet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0xD:0x1 - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/_tmp/ChnDemo.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/_tmp/ChnDemo.scr deleted file mode 100644 index 28522137..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/_tmp/ChnDemo.scr +++ /dev/null @@ -1,87 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x1B 0x00 0x1F 0x00 0x9E 0x00 0x3E 0x03 0x64 0x00 0x17 0x00 0x6A 0x00 0x00 0x01 0xEE 0x00 0x04 0x00 0x01 0x00 0x0A 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x02 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x09 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x1E 0x03 0x00 0x1B 0x02 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x01 0x00 0x61 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x02 0x01 0xBE 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x3E 0x02 0x80 0x03 0x03 0x00 0x01 0x04 0x06 0x00 0x01 0x00 0x73 0xFF 0xFF 0x00 0x6F 0x00 0x7D 0x00 0x76 0x00 0x7A 0x00 0xBB 0x80 0x11 0x02 0x08 0x09 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x81 0x00 0x00 0x02 0x80 0x03 0x02 0x00 0x02 0x04 0x06 0x00 0x00 0x01 0xD4 0xFF 0xFF 0x01 0xCC 0x01 0xEF 0x01 0xDB 0x01 0xE8 0x80 0x11 0x02 0x08 0x09 0x81 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x01 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x64 0x00 0x07 0x40 0x18 0x8C 0x00 0x17 0x18 0x05 0x90 0x0C 0x87 0x00 0x18 0x7F 0x00 0x19 0x18 0x03 0x89 0x01 0x18 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x25 0x11 0x00 0xFF 0x53 0x55 0x89 0x02 0xAD 0x00 0x03 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x11 0x00 0xFF 0x53 0x55 0x39 0xAD 0x00 0x04 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x25 0x11 0x00 0xFF 0x53 0x55 0x39 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x05 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x10 0x04 0x78 0x00 0x10 0x7A 0x01 0x20 0x04 0x78 0x00 0x20 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x21 0x19 0x8B 0x00 0x08 0x2D 0x19 0x8B 0x00 0x09 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x0A 0x1A 0x04 0x25 0x75 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x00 0x02 0x00 0x10 0x00 0x0D 0x00 0x20 0x00 0x13 0x18 0x19 0x8C 0x00 0x0B 0x7A 0x18 0x19 0x8C 0x00 0x0C 0x7A 0x11 0x6D 0x00 0x8D 0x00 0x0A 0x7A 0x03 0x31 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAF 0x02 0x6B 0x09 0xAD 0x00 0x03 0x26 0x32 0x70 0x07 0xAD 0x00 0x04 0x26 0x32 0x1E 0x60 0x05 0x59 0x03 0x14 0xAF 0x01 0x1F 0x6C 0x11 0x8D 0x00 0x0D 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAF 0x01 0x1F 0x43 0x89 0x01 0x8D 0x00 0x0E 0x04 0x78 0x03 0x78 0x01 0x00 0x7B 0x00 0x19 0x77 0x03 0x24 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0F 0x5B 0x29 0x04 0x1F 0x05 0x6B 0x07 0x16 0x04 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0A 0x1A 0x08 0x25 0x10 0x08 0x4D 0x1A 0x10 0x06 0x25 0x55 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x16 0x05 0x11 0x7F 0xFF 0x6E 0x06 0x16 0x05 0x63 0x08 0x11 0x6A 0x55 0x8D 0x00 0x0A 0xAF 0x01 0x16 0x05 0x41 0x11 0x7F 0xFF 0x6F 0x08 0x11 0x6A 0x54 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x8D 0x00 0x0D 0x18 0xAF 0x01 0x16 0x05 0x41 0x89 0x01 0x8D 0x00 0x0E 0x7A 0x04 0x23 0x7B 0x00 0x10 0x03 0x7B 0x00 0x10 0x92 0x5B 0x8D 0x00 0x11 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x8D 0x00 0x12 0x61 0x08 0x11 0x69 0x05 0x8D 0x00 0x0A 0x19 0x8B 0x00 0x08 0x2E 0x19 0x8B 0x00 0x13 0x29 0x04 0x16 0x04 0x05 0x6D 0x08 0x11 0x67 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x19 0x05 0x8B 0x00 0x14 0x1B 0x03 0xAF 0x01 0x10 0x08 0x4F 0x5B 0x38 0x1B 0x04 0xAF 0x01 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x03 0x05 0x8B 0x00 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x03 0x40 0x18 0x8C 0x00 0x17 0x18 0x04 0x05 0x8D 0x00 0x16 0x87 0x03 0xAD 0x03 0x03 0x02 0x39 0x18 0x04 0x05 0x8D 0x00 0x18 0x87 0x04 0x18 0x8B 0x00 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x05 0x30 0x8F 0x00 0x1B 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x1C 0x3B 0x7A 0x01 0x10 0x18 0x8C 0x00 0x1D 0x04 0x78 0x01 0x10 0x18 0x8C 0x00 0x1E 0x7A 0x01 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x60 0x04 0x03 0x78 0x18 0x8C 0x00 0x1D 0x04 0x78 0x01 0x20 0x18 0x8C 0x00 0x1E 0x7A 0x02 0x21 0x19 0x8B 0x00 0x08 0x2D 0x19 0x8B 0x00 0x09 0x60 0x10 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x0A 0x1A 0x04 0x25 0x75 0x00 0x2B 0x00 0x04 0x00 0x10 0x00 0x1B 0x00 0x20 0x00 0x21 0x00 0x30 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x00 0x40 0x00 0x15 0x18 0x19 0x8C 0x00 0x1F 0x7A 0x18 0x19 0x8C 0x00 0x20 0x7A 0x18 0x8C 0x00 0x21 0x7A 0x18 0x8C 0x00 0x22 0x7A 0x11 0x6D 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0A 0x7A 0x03 0x22 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x10 0x07 0x25 0x10 0x08 0x4D 0x1A 0x10 0x0A 0x25 0x11 0x00 0xFF 0x53 0x55 0x32 0x1F 0x06 0x6A 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x54 0x8D 0x00 0x0A 0x7A 0x03 0x27 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x00 0x0F 0x5B 0x29 0x04 0x1F 0x05 0x6B 0x07 0x16 0x04 0x05 0x6A 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x67 0x00 0x8D 0x00 0x0A 0x1A 0x08 0x25 0x10 0x08 0x4D 0x1A 0x10 0x06 0x25 0x11 0x00 0xFF 0x53 0x55 0x29 0x05 0x16 0x05 0x02 0x6A 0x0A 0xAD 0x03 0x03 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x39 0x70 0x0C 0x18 0x8C 0x00 0x22 0x11 0x6A 0x52 0x8D 0x00 0x0A 0x19 0x3B 0x8D 0x00 0x23 0x29 0x06 0x19 0x3B 0x8D 0x00 0x24 0x29 0x07 0x03 0x29 0x08 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x11 0x00 0xF0 0x53 0x11 0x00 0x80 0x6A 0x0D 0x16 0x06 0x11 0x00 0xF0 0x53 0x11 0x00 0x90 0x6B 0x05 0x04 0x29 0x08 0xAD 0x04 0x03 0x25 0x04 0x6B 0x25 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x25 0x67 0x08 0x11 0x6A 0x53 0x8D 0x00 0x0A 0x8D 0x00 0x25 0xAD 0x03 0x03 0x26 0x16 0x08 0x8B 0x00 0x26 0x61 0x0C 0x18 0x8C 0x00 0x22 0x11 0x6A 0x51 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x7A 0x03 0x10 0x8D 0x00 0x25 0x67 0x08 0x11 0x6A 0x53 0x8D 0x00 0x0A 0xAD 0x04 0x03 0x25 0x04 0x6B 0x08 0x11 0x6A 0x50 0x8D 0x00 0x0A 0xAD 0x03 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x02 0x6B 0x08 0x11 0x6A 0x52 0x8D 0x00 0x0A 0x8D 0x00 0x25 0xAD 0x03 0x03 0x26 0x03 0x8B 0x00 0x26 0x60 0x09 0xAD 0x04 0x03 0x04 0x38 0x70 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x8D 0x00 0x0A 0x7A 0x03 0x10 0xAD 0x04 0x03 0x03 0x38 0x7A 0x03 0x10 0xAD 0x04 0x03 0x03 0x38 0xAD 0x03 0x03 0x02 0x39 0x7A 0x03 0x10 0xAD 0x03 0x03 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x07 0x39 0xAD 0x04 0x03 0x03 0x38 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x1A 0x08 0x00 0x17 0x00 0x04 0x00 0x02 0x00 0x01 0x03 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x02 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x9E 0x00 0x27 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x02 0x02 0x00 0x20 0x00 0x02 0x00 0x20 0x01 0x03 0x80 0x03 0x01 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x06 0x00 0x01 0x4E 0x06 0x00 0x00 0xF0 0x06 0x80 0x08 0x01 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x02 0x03 0x80 0x0A 0x06 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x06 0x80 0x08 0x14 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x04 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x0F 0x06 0x80 0x03 0x00 0x06 0x80 0x08 0x0D 0x05 0x00 0x00 0x02 0x03 0x80 0x03 0x01 0x01 0x00 0x20 0x00 0x06 0x00 0x01 0x9E 0x06 0x00 0x03 0x4A 0x06 0x00 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x57 0x06 0x00 0x02 0x3F 0x06 0x00 0x02 0x62 0x06 0x00 0x03 0x00 0x06 0x00 0x03 0x42 0x06 0x80 0x0A 0x02 0x06 0x80 0x0A 0x06 0x06 0x00 0x00 0xEA 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x80 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x6A 0x00 0x1F 0x0C 0x08 0x17 0x02 0x18 0x7A 0x04 0x07 0x0B 0x09 0x04 0x4E 0x14 0x05 0x3E 0x09 0x1B 0x02 0x0B 0xE2 0x3C 0x15 0x23 0x0D 0x10 0x0A 0x10 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x05 0x08 0x05 0x00 0x47 0x05 0x0A 0x4F 0x06 0x07 0x16 0x05 0x10 0x15 0x06 0x07 0x22 0x0A 0x09 0x07 0x09 0x12 0x1E 0x10 0x03 0x0B 0x06 0x04 0x05 0x05 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x04 0x05 0x0D 0x05 0x19 0x07 0x06 0x0D 0x06 0x06 0x07 0x08 0x08 0x0C 0x08 0x07 0x05 0x10 0x1D 0x06 0x05 0x05 0x07 0x07 0x1C 0x07 0x09 0x12 0x22 0x06 0x05 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x0D 0x28 0x08 0x03 0x09 0x06 0x06 0x06 0x08 0x0D 0x0D 0x03 0x08 0x0F 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channel.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channel.scr deleted file mode 100644 index d0dbf9a7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channel.scr +++ /dev/null @@ -1,236 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.8 -// Version:1.8 -// Date:07/16/03 -//- - - -// Logical Channels demo - -// This demo simulates a fictitious wireless device using a smart card -// to keep track of use time in a fictitious network. -// The device user only has a certain amount of credits he can use, and -// every unit of time he remains connected to the network using the -// device decreases such credits. -// The user is assigned a home area, where he can operate the device at -// a lower cost. However, if he "moves" to an external area, the -// network connection charges increase. If the user runs out of credits, -// the user is disconnected from the network automatically. - - - - -output on; - - -echo "Applet creation and functional test section."; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - - - -// create ConnectionManager -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x00 0x7F; - -// create AccountAccessor -0x80 0xB8 0x00 0x00 0x12 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x08 0x01 0x98 0x00 0x01 0x00 0x05 0x7F; - -CONTACTLESS; -powerup; - -// Select Account accessor -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Initialize Account accessor with 100 credits -0x80 0x20 0x00 0x00 0x02 0x00 0x64 0x7F; -// 90 00 = SW_NO_ERROR - -// Assume some time happens, and the user turns the device on to use it... - -// Terminal selects Connection Manager upon turning on the device -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x7F; -// 90 00 = SW_NO_ERROR - -EXTENDED ON; - -0x80 0x40 0x00 0x00 0x01 0x20 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A 0x7B 0x7C 0x7D 0x7E 0x7F 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x8B 0x8C 0x8D 0x8E 0x8F 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9A 0x9B 0x9C 0x9D 0x9E 0x9F 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8 0xA9 0xAA 0xAB 0xAC 0xAD 0xAE 0xAF 0xB0 0xB1 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA 0xBB 0xBC 0xBD 0xBE 0xBF 0xC0 0xC1 0xC2 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xCB 0xCC 0xCD 0xCE 0xCF 0xD0 0xD1 0xD2 0xD3 0xD4 0xD5 0xD6 0xD7 0xD8 0xD9 0xDA 0xDB 0xDC 0xDD 0xDE 0xDF 0xE0 0xE1 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 0xE8 0xE9 0xEA 0xEB 0xEC 0xED 0xEE 0xEF 0xF0 0xF1 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 0xFA 0xFB 0xFC 0xFD 0xFE 0xFF 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x6F 0xFF; - -EXTENDED OFF; - -// Upon network carrier detect, terminal decodes area code (408 dec) -// and sends a "Time tick" to the card -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - - -// The user starts using the device. The terminal queries for available credits. -// First, open a new logical channel, via MANAGE CHANNEL OPENcommand. -0x00 0x70 0x00 0x00 0x00 0x01; - -// In order to do so without losing network information (in ConnectionManager -// applet), Account Accessor applet is selected on a second logical channel. -0x01 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance on user account. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x64 0x90 0x00 = 100 credits and SW_NO_ERROR - -// User starts a network service. For this, sufficient credits shall be available -// on the user account to pay for the first time unit of device use. -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Service initiation has a charge of one time unit. Verified by obtaining balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x63 0x90 0x00 = SW_NO_ERROR - -// Time tick for another time unit -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x62 0x90 0x00 = SW_NO_ERROR - -// Time tick. The user has moved to a new area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x5D 0x90 0x00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// User terminates network service. No charges applied. -0x80 0x30 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - - -// Terminal queries balance. No change, since device is not in use. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// The Account manager applet is deselected, -// via a MANAGE CHANNEL CLOSE command. -0x00 0x70 0x80 0x01 0x00 0x7F; - -// User powers down the device. - -powerdown; - -CONTACTED; - -// Select Account accessor -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Initialize Account accessor with 100 credits -0x80 0x20 0x00 0x00 0x02 0x00 0x64 0x7F; -// 90 00 = SW_NO_ERROR - -// Assume some time happens, and the user turns the device on to use it... - -// Terminal selects Connection Manager upon turning on the device -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x7F; -// 90 00 = SW_NO_ERROR - -EXTENDED ON; - -0x80 0x40 0x00 0x00 0x01 0x20 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A 0x7B 0x7C 0x7D 0x7E 0x7F 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x8B 0x8C 0x8D 0x8E 0x8F 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9A 0x9B 0x9C 0x9D 0x9E 0x9F 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8 0xA9 0xAA 0xAB 0xAC 0xAD 0xAE 0xAF 0xB0 0xB1 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA 0xBB 0xBC 0xBD 0xBE 0xBF 0xC0 0xC1 0xC2 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xCB 0xCC 0xCD 0xCE 0xCF 0xD0 0xD1 0xD2 0xD3 0xD4 0xD5 0xD6 0xD7 0xD8 0xD9 0xDA 0xDB 0xDC 0xDD 0xDE 0xDF 0xE0 0xE1 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 0xE8 0xE9 0xEA 0xEB 0xEC 0xED 0xEE 0xEF 0xF0 0xF1 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 0xFA 0xFB 0xFC 0xFD 0xFE 0xFF 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x6F 0xFF; - -EXTENDED OFF; - -// Upon network carrier detect, terminal decodes area code (408 dec) -// and sends a "Time tick" to the card -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - - -// The user starts using the device. The terminal queries for available credits. -// First, open a new logical channel, via MANAGE CHANNEL OPENcommand. -0x00 0x70 0x00 0x00 0x00 0x01; - -// In order to do so without losing network information (in ConnectionManager -// applet), Account Accessor applet is selected on a second logical channel. -0x01 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance on user account. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x64 0x90 0x00 = 100 credits and SW_NO_ERROR - -// User starts a network service. For this, sufficient credits shall be available -// on the user account to pay for the first time unit of device use. -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Service initiation has a charge of one time unit. Verified by obtaining balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x63 0x90 0x00 = SW_NO_ERROR - -// Time tick for another time unit -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x62 0x90 0x00 = SW_NO_ERROR - -// Time tick. The user has moved to a new area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x5D 0x90 0x00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// User terminates network service. No charges applied. -0x80 0x30 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - - -// Terminal queries balance. No change, since device is not in use. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// The Account manager applet is deselected, -// via a MANAGE CHANNEL CLOSE command. -0x00 0x70 0x80 0x01 0x00 0x7F; - - -powerdown; - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr deleted file mode 100644 index e72c21e5..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr +++ /dev/null @@ -1,349 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x1B 0x00 0x1F 0x00 0x9E 0x00 0x3E 0x03 0x64 0x00 0x17 0x00 0x6A 0x00 0x00 0x01 0xEE 0x00 0x04 0x00 0x01 0x00 0x0A 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x02 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x02 0x09 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x1E 0x03 0x00 0x1B 0x02 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x01 0x00 0x61 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x02 0x01 0xBE 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x3E 0x02 0x80 0x03 0x03 0x00 0x01 0x04 0x06 0x00 0x01 0x00 0x73 0xFF 0xFF 0x00 0x6F 0x00 0x7D 0x00 0x76 0x00 0x7A 0x00 0xBB 0x80 0x11 0x02 0x08 0x09 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x81 0x00 0x00 0x02 0x80 0x03 0x02 0x00 0x02 0x04 0x06 0x00 0x00 0x01 0xD4 0xFF 0xFF 0x01 0xCC 0x01 0xEF 0x01 0xDB 0x01 0xE8 0x80 0x11 0x02 0x08 0x09 0x81 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x01 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x64 0x00 0x07 0x40 0x18 0x8C 0x00 0x17 0x18 0x05 0x90 0x0C 0x87 0x00 0x18 0x7F 0x00 0x19 0x18 0x03 0x89 0x01 0x18 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x25 0x11 0x00 0xFF 0x53 0x55 0x89 0x02 0xAD 0x00 0x03 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x25 0x11 0x00 0xFF 0x53 0x55 0x39 0xAD 0x00 0x04 0x19 0x1E 0x59 0x02 0x01 0x25 0x10 0x08 0x4D 0x19 0x1E 0x59 0x02 0x01 0x25 0x11 0x00 0xFF 0x53 0x55 0x39 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x05 0x7A 0x05 0x30 0x8F 0x00 0x06 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x10 0x04 0x78 0x00 0x10 0x7A 0x01 0x20 0x04 0x78 0x00 0x20 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x21 0x19 0x8B 0x00 0x08 0x2D 0x19 0x8B 0x00 0x09 0x60 0x10 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x0A 0x1A 0x04 0x25 0x75 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0x00 0x02 0x00 0x10 0x00 0x0D 0x00 0x20 0x00 0x13 0x18 0x19 0x8C 0x00 0x0B 0x7A 0x18 0x19 0x8C 0x00 0x0C 0x7A 0x11 0x6D 0x00 0x8D 0x00 0x0A 0x7A 0x03 0x31 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAF 0x02 0x6B 0x09 0xAD 0x00 0x03 0x26 0x32 0x70 0x07 0xAD 0x00 0x04 0x26 0x32 0x1E 0x60 0x05 0x59 0x03 0x14 0xAF 0x01 0x1F 0x6C 0x11 0x8D 0x00 0x0D 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0xAF 0x01 0x1F 0x43 0x89 0x01 0x8D 0x00 0x0E 0x04 0x78 0x03 0x78 0x01 0x00 0x7B 0x00 0x19 0x77 0x03 0x24 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0F 0x5B 0x29 0x04 0x1F 0x05 0x6B 0x07 0x16 0x04 0x05 0x6A 0x08 0x11 0x67 0x00 0x8D 0x00 0x0A 0x1A 0x08 0x25 0x10 0x08 0x4D 0x1A 0x10 0x06 0x25 0x55 0x29 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x16 0x05 0x11 0x7F 0xFF 0x6E 0x06 0x16 0x05 0x63 0x08 0x11 0x6A 0x55 0x8D 0x00 0x0A 0xAF 0x01 0x16 0x05 0x41 0x11 0x7F 0xFF 0x6F 0x08 0x11 0x6A 0x54 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x8D 0x00 0x0D 0x18 0xAF 0x01 0x16 0x05 0x41 0x89 0x01 0x8D 0x00 0x0E 0x7A 0x04 0x23 0x7B 0x00 0x10 0x03 0x7B 0x00 0x10 0x92 0x5B 0x8D 0x00 0x11 0x2D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1A 0x8D 0x00 0x12 0x61 0x08 0x11 0x69 0x05 0x8D 0x00 0x0A 0x19 0x8B 0x00 0x08 0x2E 0x19 0x8B 0x00 0x13 0x29 0x04 0x16 0x04 0x05 0x6D 0x08 0x11 0x67 0x00 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x19 0x05 0x8B 0x00 0x14 0x1B 0x03 0xAF 0x01 0x10 0x08 0x4F 0x5B 0x38 0x1B 0x04 0xAF 0x01 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x03 0x05 0x8B 0x00 0x15 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x03 0x40 0x18 0x8C 0x00 0x17 0x18 0x04 0x05 0x8D 0x00 0x16 0x87 0x03 0xAD 0x03 0x03 0x02 0x39 0x18 0x04 0x05 0x8D 0x00 0x18 0x87 0x04 0x18 0x8B 0x00 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x05 0x30 0x8F 0x00 0x1B 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x1C 0x3B 0x7A 0x01 0x10 0x18 0x8C 0x00 0x1D 0x04 0x78 0x01 0x10 0x18 0x8C 0x00 0x1E 0x7A 0x01 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x60 0x04 0x03 0x78 0x18 0x8C 0x00 0x1D 0x04 0x78 0x01 0x20 0x18 0x8C 0x00 0x1E 0x7A 0x02 0x21 0x19 0x8B 0x00 0x08 0x2D 0x19 0x8B 0x00 0x09 0x60 0x10 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x11 0x6E 0x00 0x8D 0x00 0x0A 0x1A 0x04 0x25 0x75 0x00 0x2B 0x00 0x04 0x00 0x10 0x00 0x1B 0x00 0x20 0x00 0x21 0x00 0x30 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x00 0x40 0x00 0x15 0x18 0x19 0x8C 0x00 0x1F 0x7A 0x18 0x19 0x8C 0x00 0x20 0x7A 0x18 0x8C 0x00 0x21 0x7A 0x18 0x8C 0x00 0x22 0x7A 0x11 0x6D 0x00 0x8D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x0A 0x7A 0x03 0x22 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x10 0x07 0x25 0x10 0x08 0x4D 0x1A 0x10 0x0A 0x25 0x11 0x00 0xFF 0x53 0x55 0x32 0x1F 0x06 0x6A 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x54 0x8D 0x00 0x0A 0x7A 0x03 0x27 0x19 0x8B 0x00 0x08 0x2D 0x1A 0x07 0x25 0x32 0x19 0x8B 0x00 0x0F 0x5B 0x29 0x04 0x1F 0x05 0x6B 0x07 0x16 0x04 0x05 0x6A 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x67 0x00 0x8D 0x00 0x0A 0x1A 0x08 0x25 0x10 0x08 0x4D 0x1A 0x10 0x06 0x25 0x11 0x00 0xFF 0x53 0x55 0x29 0x05 0x16 0x05 0x02 0x6A 0x0A 0xAD 0x03 0x03 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x39 0x70 0x0C 0x18 0x8C 0x00 0x22 0x11 0x6A 0x52 0x8D 0x00 0x0A 0x19 0x3B 0x8D 0x00 0x23 0x29 0x06 0x19 0x3B 0x8D 0x00 0x24 0x29 0x07 0x03 0x29 0x08 0x16 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x11 0x00 0xF0 0x53 0x11 0x00 0x80 0x6A 0x0D 0x16 0x06 0x11 0x00 0xF0 0x53 0x11 0x00 0x90 0x6B 0x05 0x04 0x29 0x08 0xAD 0x04 0x03 0x25 0x04 0x6B 0x25 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x25 0x67 0x08 0x11 0x6A 0x53 0x8D 0x00 0x0A 0x8D 0x00 0x25 0xAD 0x03 0x03 0x26 0x16 0x08 0x8B 0x00 0x26 0x61 0x0C 0x18 0x8C 0x00 0x22 0x11 0x6A 0x51 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0A 0x7A 0x03 0x10 0x8D 0x00 0x25 0x67 0x08 0x11 0x6A 0x53 0x8D 0x00 0x0A 0xAD 0x04 0x03 0x25 0x04 0x6B 0x08 0x11 0x6A 0x50 0x8D 0x00 0x0A 0xAD 0x03 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x26 0x02 0x6B 0x08 0x11 0x6A 0x52 0x8D 0x00 0x0A 0x8D 0x00 0x25 0xAD 0x03 0x03 0x26 0x03 0x8B 0x00 0x26 0x60 0x09 0xAD 0x04 0x03 0x04 0x38 0x70 0x08 0x11 0x6A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x51 0x8D 0x00 0x0A 0x7A 0x03 0x10 0xAD 0x04 0x03 0x03 0x38 0x7A 0x03 0x10 0xAD 0x04 0x03 0x03 0x38 0xAD 0x03 0x03 0x02 0x39 0x7A 0x03 0x10 0xAD 0x03 0x03 0x02 0x7F; -0x80 0xB4 0x07 0x00 0x07 0x39 0xAD 0x04 0x03 0x03 0x38 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x1A 0x08 0x00 0x17 0x00 0x04 0x00 0x02 0x00 0x01 0x03 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0B 0x02 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x9E 0x00 0x27 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x02 0x02 0x00 0x20 0x00 0x02 0x00 0x20 0x01 0x03 0x80 0x03 0x01 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x03 0x80 0x0A 0x0E 0x06 0x80 0x07 0x01 0x06 0x00 0x01 0x4E 0x06 0x00 0x00 0xF0 0x06 0x80 0x08 0x01 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x02 0x03 0x80 0x0A 0x06 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x06 0x80 0x08 0x14 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x04 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x0F 0x06 0x80 0x03 0x00 0x06 0x80 0x08 0x0D 0x05 0x00 0x00 0x02 0x03 0x80 0x03 0x01 0x01 0x00 0x20 0x00 0x06 0x00 0x01 0x9E 0x06 0x00 0x03 0x4A 0x06 0x00 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x57 0x06 0x00 0x02 0x3F 0x06 0x00 0x02 0x62 0x06 0x00 0x03 0x00 0x06 0x00 0x03 0x42 0x06 0x80 0x0A 0x02 0x06 0x80 0x0A 0x06 0x06 0x00 0x00 0xEA 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x80 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/ChannelsDemo/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x6A 0x00 0x1F 0x0C 0x08 0x17 0x02 0x18 0x7A 0x04 0x07 0x0B 0x09 0x04 0x4E 0x14 0x05 0x3E 0x09 0x1B 0x02 0x0B 0xE2 0x3C 0x15 0x23 0x0D 0x10 0x0A 0x10 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x08 0x05 0x08 0x05 0x00 0x47 0x05 0x0A 0x4F 0x06 0x07 0x16 0x05 0x10 0x15 0x06 0x07 0x22 0x0A 0x09 0x07 0x09 0x12 0x1E 0x10 0x03 0x0B 0x06 0x04 0x05 0x05 0x08 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x04 0x05 0x0D 0x05 0x19 0x07 0x06 0x0D 0x06 0x06 0x07 0x08 0x08 0x0C 0x08 0x07 0x05 0x10 0x1D 0x06 0x05 0x05 0x07 0x07 0x1C 0x07 0x09 0x12 0x22 0x06 0x05 0x07 0x7F; -0x80 0xB4 0x09 0x00 0x0D 0x28 0x08 0x03 0x09 0x06 0x06 0x06 0x08 0x0D 0x0D 0x03 0x08 0x0F 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.8 -// Version:1.8 -// Date:07/16/03 -//- - - -// Logical Channels demo - -// This demo simulates a fictitious wireless device using a smart card -// to keep track of use time in a fictitious network. -// The device user only has a certain amount of credits he can use, and -// every unit of time he remains connected to the network using the -// device decreases such credits. -// The user is assigned a home area, where he can operate the device at -// a lower cost. However, if he "moves" to an external area, the -// network connection charges increase. If the user runs out of credits, -// the user is disconnected from the network automatically. - - - - -output on; - - -echo "Applet creation and functional test section."; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - - - -// create ConnectionManager -0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x00 0x7F; - -// create AccountAccessor -0x80 0xB8 0x00 0x00 0x12 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x08 0x01 0x98 0x00 0x01 0x00 0x05 0x7F; - -CONTACTLESS; -powerup; - -// Select Account accessor -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Initialize Account accessor with 100 credits -0x80 0x20 0x00 0x00 0x02 0x00 0x64 0x7F; -// 90 00 = SW_NO_ERROR - -// Assume some time happens, and the user turns the device on to use it... - -// Terminal selects Connection Manager upon turning on the device -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x7F; -// 90 00 = SW_NO_ERROR - -EXTENDED ON; - -0x80 0x40 0x00 0x00 0x01 0x20 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A 0x7B 0x7C 0x7D 0x7E 0x7F 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x8B 0x8C 0x8D 0x8E 0x8F 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9A 0x9B 0x9C 0x9D 0x9E 0x9F 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8 0xA9 0xAA 0xAB 0xAC 0xAD 0xAE 0xAF 0xB0 0xB1 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA 0xBB 0xBC 0xBD 0xBE 0xBF 0xC0 0xC1 0xC2 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xCB 0xCC 0xCD 0xCE 0xCF 0xD0 0xD1 0xD2 0xD3 0xD4 0xD5 0xD6 0xD7 0xD8 0xD9 0xDA 0xDB 0xDC 0xDD 0xDE 0xDF 0xE0 0xE1 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 0xE8 0xE9 0xEA 0xEB 0xEC 0xED 0xEE 0xEF 0xF0 0xF1 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 0xFA 0xFB 0xFC 0xFD 0xFE 0xFF 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x6F 0xFF; - -EXTENDED OFF; - -// Upon network carrier detect, terminal decodes area code (408 dec) -// and sends a "Time tick" to the card -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - - -// The user starts using the device. The terminal queries for available credits. -// First, open a new logical channel, via MANAGE CHANNEL OPENcommand. -0x00 0x70 0x00 0x00 0x00 0x01; - -// In order to do so without losing network information (in ConnectionManager -// applet), Account Accessor applet is selected on a second logical channel. -0x01 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance on user account. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x64 0x90 0x00 = 100 credits and SW_NO_ERROR - -// User starts a network service. For this, sufficient credits shall be available -// on the user account to pay for the first time unit of device use. -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Service initiation has a charge of one time unit. Verified by obtaining balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x63 0x90 0x00 = SW_NO_ERROR - -// Time tick for another time unit -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x62 0x90 0x00 = SW_NO_ERROR - -// Time tick. The user has moved to a new area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x5D 0x90 0x00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// User terminates network service. No charges applied. -0x80 0x30 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - - -// Terminal queries balance. No change, since device is not in use. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// The Account manager applet is deselected, -// via a MANAGE CHANNEL CLOSE command. -0x00 0x70 0x80 0x01 0x00 0x7F; - -// User powers down the device. - -powerdown; - -CONTACTED; - -// Select Account accessor -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Initialize Account accessor with 100 credits -0x80 0x20 0x00 0x00 0x02 0x00 0x64 0x7F; -// 90 00 = SW_NO_ERROR - -// Assume some time happens, and the user turns the device on to use it... - -// Terminal selects Connection Manager upon turning on the device -0x00 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x02 0x7F; -// 90 00 = SW_NO_ERROR - -EXTENDED ON; - -0x80 0x40 0x00 0x00 0x01 0x20 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5A 0x5B 0x5C 0x5D 0x5E 0x5F 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6A 0x6B 0x6C 0x6D 0x6E 0x6F 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7A 0x7B 0x7C 0x7D 0x7E 0x7F 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8A 0x8B 0x8C 0x8D 0x8E 0x8F 0x90 0x91 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9A 0x9B 0x9C 0x9D 0x9E 0x9F 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8 0xA9 0xAA 0xAB 0xAC 0xAD 0xAE 0xAF 0xB0 0xB1 0xB2 0xB3 0xB4 0xB5 0xB6 0xB7 0xB8 0xB9 0xBA 0xBB 0xBC 0xBD 0xBE 0xBF 0xC0 0xC1 0xC2 0xC3 0xC4 0xC5 0xC6 0xC7 0xC8 0xC9 0xCA 0xCB 0xCC 0xCD 0xCE 0xCF 0xD0 0xD1 0xD2 0xD3 0xD4 0xD5 0xD6 0xD7 0xD8 0xD9 0xDA 0xDB 0xDC 0xDD 0xDE 0xDF 0xE0 0xE1 0xE2 0xE3 0xE4 0xE5 0xE6 0xE7 0xE8 0xE9 0xEA 0xEB 0xEC 0xED 0xEE 0xEF 0xF0 0xF1 0xF2 0xF3 0xF4 0xF5 0xF6 0xF7 0xF8 0xF9 0xFA 0xFB 0xFC 0xFD 0xFE 0xFF 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x6F 0xFF; - -EXTENDED OFF; - -// Upon network carrier detect, terminal decodes area code (408 dec) -// and sends a "Time tick" to the card -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - - -// The user starts using the device. The terminal queries for available credits. -// First, open a new logical channel, via MANAGE CHANNEL OPENcommand. -0x00 0x70 0x00 0x00 0x00 0x01; - -// In order to do so without losing network information (in ConnectionManager -// applet), Account Accessor applet is selected on a second logical channel. -0x01 0xa4 0x04 0x00 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x0b 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance on user account. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x64 0x90 0x00 = 100 credits and SW_NO_ERROR - -// User starts a network service. For this, sufficient credits shall be available -// on the user account to pay for the first time unit of device use. -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Service initiation has a charge of one time unit. Verified by obtaining balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x63 0x90 0x00 = SW_NO_ERROR - -// Time tick for another time unit -0x80 0x10 0x00 0x00 0x02 0x01 0x98 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x62 0x90 0x00 = SW_NO_ERROR - -// Time tick. The user has moved to a new area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x5D 0x90 0x00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - -// Terminal queries balance. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// User terminates network service. No charges applied. -0x80 0x30 0x00 0x00 0x00 0x7F; -// 90 00 = SW_NO_ERROR - -// Time tick. Area code (650). -0x80 0x10 0x00 0x00 0x02 0x02 0x8A 0x7F; -// 90 00 = SW_NO_ERROR - - -// Terminal queries balance. No change, since device is not in use. -0x81 0x10 0x00 0x00 0x00 0x02; -// 0x00 0x58 0x90 0x00 = SW_NO_ERROR - -// The Account manager applet is deselected, -// via a MANAGE CHANNEL CLOSE command. -0x00 0x70 0x80 0x01 0x00 0x7F; - - -powerdown; - - - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr.expected.out deleted file mode 100644 index 905d43f2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/logical_channels/channelDemo.scr.expected.out +++ /dev/null @@ -1,52 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Applet creation and functional test section. -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 02, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 02, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 12, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, 08, 01, 98, 00, 01, 00, 05, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 02, 00, 64, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 02, Le: 00, SW1: 90, SW2: 00 -Extended APDU mode enabled. -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 00, 01, 20, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 9a, 9b, 9c, 9d, 9e, 9f, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, da, db, dc, dd, de, df, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ea, eb, ec, ed, ee, ef, f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, fa, fb, fc, fd, fe, ff, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1fLe: 00, 00, 00, SW1: 90, SW2: 00 -Extended APDU mode disabled. -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 01, 98, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: 70, P1: 00, P2: 00, Lc: 00, Le: 01, 01, SW1: 90, SW2: 00 -CLA: 01, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 64, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 63, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 01, 98, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 62, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 5d, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 58, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 58, SW1: 90, SW2: 00 -CLA: 00, INS: 70, P1: 80, P2: 01, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 02, 00, 64, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 02, Le: 00, SW1: 90, SW2: 00 -Extended APDU mode enabled. -CLA: 80, INS: 40, P1: 00, P2: 00, Lc: 00, 01, 20, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 9a, 9b, 9c, 9d, 9e, 9f, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, da, db, dc, dd, de, df, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ea, eb, ec, ed, ee, ef, f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, fa, fb, fc, fd, fe, ff, 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1fLe: 00, 00, 00, SW1: 90, SW2: 00 -Extended APDU mode disabled. -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 01, 98, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: 70, P1: 00, P2: 00, Lc: 00, Le: 01, 01, SW1: 90, SW2: 00 -CLA: 01, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0b, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, bc, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, bb, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 01, 98, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, ba, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, b5, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, b0, SW1: 90, SW2: 00 -CLA: 80, INS: 30, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 02, 02, 8a, Le: 00, SW1: 90, SW2: 00 -CLA: 81, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 02, 00, b0, SW1: 90, SW2: 00 -CLA: 00, INS: 70, P1: 80, P2: 01, Lc: 00, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Footer.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Footer.scr deleted file mode 100644 index da461c76..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Footer.scr +++ /dev/null @@ -1,3 +0,0 @@ - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Header.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Header.scr deleted file mode 100644 index dc625d20..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/misc/Header.scr +++ /dev/null @@ -1,23 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageA.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageA.scr deleted file mode 100644 index 6551160d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageA.scr +++ /dev/null @@ -1,90 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x15 0x01 0x0E 0x00 0x20 0x03 0x4F 0x00 0x3A 0x00 0xA6 0x00 0x00 0x02 0xD4 0x00 0x28 0x00 0x01 0x00 0x0B 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x20 0x00 0x80 0x03 0x0D 0x00 0x05 0x07 0x01 0x00 0x00 0x02 0x70 0x00 0x81 0x00 0x03 0x00 0x02 0x01 0x00 0x00 0x00 0x00 0x81 0x00 0x01 0xFF 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x4F 0x00 0x02 0x30 0x8F 0x00 0x41 0x3D 0x8C 0x00 0x40 0x3B 0x7A 0x05 0x10 0x18 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x00 0x18 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x01 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x11 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x12 0x7A 0x02 0x10 0x18 0x8C 0x00 0x15 0x18 0x8B 0x00 0x16 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x10 0x18 0x8C 0x00 0x1A 0x18 0x03 0x8D 0x00 0x17 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x7A 0x05 0x11 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x18 0x05 0x8D 0x00 0x17 0x89 0x04 0x18 0x04 0x8D 0x00 0x17 0x89 0x05 0x18 0x05 0x05 0x8D 0x00 0x42 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x18 0x03 0x8D 0x00 0x17 0x89 0x07 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x06 0x1D 0x8F 0x00 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x08 0x18 0x05 0x04 0x8D 0x00 0x42 0x87 0x09 0x18 0x03 0x8D 0x00 0x17 0x89 0x0A 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x09 0x1D 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x03 0x8D 0x00 0x17 0x89 0x0B 0x7A 0x02 0x11 0xAD 0x06 0x67 0x06 0x7D 0x00 0x19 0x78 0x03 0x30 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAD 0x06 0x92 0x6D 0x1E 0xAD 0x06 0x1D 0x24 0x66 0x0F 0xAD 0x06 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1B 0x78 0x59 0x01 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x02 0x11 0xAD 0x09 0x67 0x06 0x7D 0x00 0x1D 0x78 0x03 0x30 0x1D 0xAD 0x09 0x92 0x6D 0x1E 0xAD 0x09 0x1D 0x24 0x66 0x0F 0xAD 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1E 0x78 0x59 0x01 0x01 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x00 0x10 0x8D 0x00 0x1F 0x7A 0x02 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x01 0x87 0x00 0x18 0x01 0x87 0x01 0x01 0x7F 0x00 0x11 0x01 0x7F 0x00 0x12 0x7A 0x02 0x12 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x0B 0x6A 0x07 0xAF 0x0B 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x20 0x18 0x8C 0x00 0x21 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x04 0x12 0x18 0x8C 0x00 0x21 0x30 0x1D 0x7D 0x00 0x1B 0x6A 0x08 0x7D 0x00 0x23 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x0B 0xAF 0x07 0xAF 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x41 0x6A 0x08 0x7D 0x00 0x24 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x30 0x1D 0x7D 0x00 0x1C 0x6A 0x06 0x1D 0x8D 0x00 0x20 0x7A 0x03 0x12 0x18 0x8C 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x30 0x1D 0x7D 0x00 0x1E 0x6A 0x08 0x7D 0x00 0x25 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x07 0xAF 0x08 0x43 0xAF 0x0A 0x41 0x6A 0x08 0x7D 0x00 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x06 0x18 0x01 0x87 0x09 0x8D 0x00 0x1F 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x27 0x8D 0x00 0x20 0xAF 0x05 0x04 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x28 0x8D 0x00 0x20 0xAF 0x04 0x05 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x29 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x02 0x10 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x2A 0x8D 0x00 0x20 0x7A 0x03 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7B 0x00 0x2B 0x03 0x7B 0x00 0x2B 0x92 0x5B 0x8D 0x00 0x2C 0x2C 0x19 0x67 0x08 0x7D 0x00 0x2D 0x8D 0x00 0x20 0x18 0x19 0x03 0x8D 0x00 0x2E 0x87 0x0D 0xAD 0x0D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x67 0x08 0x7D 0x00 0x30 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x0D 0x8D 0x00 0x1F 0x7A 0x02 0x23 0x19 0x8B 0x00 0x31 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x03 0x32 0x03 0x29 0x04 0x1A 0x04 0x25 0x73 0x00 0x7B 0x00 0x10 0x00 0x22 0x00 0x39 0x00 0x3F 0x00 0x45 0x00 0x4B 0x00 0x51 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x57 0x00 0x5D 0x00 0x63 0x00 0x69 0x00 0x33 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x2D 0x00 0x6F 0x00 0x75 0x18 0x8C 0x00 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x50 0x18 0x8C 0x00 0x33 0x70 0x4A 0x18 0x8C 0x00 0x34 0x70 0x44 0x18 0x8C 0x00 0x35 0x70 0x3E 0x18 0x8C 0x00 0x36 0x70 0x38 0x18 0x8C 0x00 0x37 0x70 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x8C 0x00 0x38 0x70 0x2C 0x18 0x8C 0x00 0x39 0x70 0x26 0x18 0x8C 0x00 0x3A 0x70 0x20 0x18 0x8C 0x00 0x3B 0x70 0x1A 0x18 0x8C 0x00 0x3C 0x70 0x14 0x18 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x3D 0x70 0x0E 0x18 0x8C 0x00 0x3E 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x20 0x7A 0x05 0x30 0x18 0x8C 0x00 0x3F 0x18 0x01 0x87 0x0E 0x18 0x01 0x87 0x0F 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x10 0x1D 0x1E 0x6D 0x1E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x1E 0x8C 0x00 0x2F 0x87 0x0E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x12 0x1E 0x8C 0x00 0x2F 0x87 0x0F 0x7A 0x02 0x20 0x18 0x8C 0x00 0x3F 0x18 0x1D 0x89 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x3A 0x00 0x28 0x00 0x03 0x00 0x01 0x03 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x00 0x00 0x22 0x91 0x01 0x91 0x02 0x91 0x7F; -0x80 0xB4 0x08 0x00 0x1D 0x03 0x91 0x04 0x91 0x05 0x91 0x06 0x91 0x07 0x91 0x08 0x91 0x09 0x91 0x0A 0x91 0x0B 0x91 0x0C 0x91 0x0D 0x91 0x0E 0x91 0x0F 0x91 0x10 0x90 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x0E 0x00 0x43 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x08 0x02 0x00 0x00 0x06 0x02 0x00 0x00 0x07 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x02 0x02 0x00 0x00 0x09 0x02 0x00 0x00 0x0A 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x0B 0x02 0x00 0x00 0x0C 0x02 0x00 0x16 0x00 0x02 0x00 0x00 0x04 0x02 0x00 0x0C 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x02 0x00 0x0C 0x01 0x02 0x00 0x0C 0x02 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x04 0x01 0x00 0x16 0x00 0x06 0x00 0x03 0x44 0x06 0x80 0x03 0x00 0x03 0x80 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x06 0x80 0x08 0x10 0x01 0x00 0x0C 0x00 0x05 0x00 0x00 0x06 0x06 0x00 0x00 0x0C 0x05 0x00 0x00 0x08 0x05 0x00 0x00 0x26 0x05 0x00 0x00 0x0A 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x0C 0x06 0x80 0x08 0x12 0x06 0x80 0x07 0x01 0x06 0x00 0x00 0xD1 0x06 0x00 0x01 0x03 0x05 0x00 0x00 0x12 0x05 0x00 0x00 0x10 0x05 0x00 0x00 0x14 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x16 0x05 0x00 0x00 0x18 0x05 0x00 0x00 0x24 0x05 0x00 0x00 0x22 0x05 0x00 0x00 0x1A 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x05 0x00 0x00 0x1E 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x04 0x06 0x00 0x03 0x0E 0x05 0x00 0x00 0x20 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0x5F 0x06 0x00 0x00 0x51 0x06 0x00 0x01 0x35 0x06 0x00 0x01 0x3B 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x4E 0x06 0x00 0x01 0x7E 0x06 0x00 0x01 0xB7 0x06 0x00 0x01 0xE1 0x06 0x00 0x01 0xEF 0x06 0x00 0x02 0x1E 0x06 0x00 0x02 0x28 0x06 0x00 0x02 0x3B 0x06 0x00 0x02 0x7F; -0x80 0xB4 0x05 0x00 0x11 0x66 0x06 0x81 0x00 0x00 0x06 0x00 0x00 0x3F 0x01 0x00 0x00 0x00 0x06 0x80 0x08 0x0E 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0xA6 0x00 0x33 0x19 0x0C 0x2A 0x0E 0x0A 0x07 0x07 0x08 0x07 0x08 0x16 0x08 0x07 0x08 0x16 0x05 0x0B 0x05 0x06 0x08 0x14 0x0B 0x05 0x06 0x08 0x1C 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x13 0x04 0x3D 0x02 0x02 0x35 0x02 0x03 0x10 0x04 0x0E 0x0A 0x0E 0x16 0x0B 0x29 0x02 0x0F 0xAC 0x04 0x07 0x12 0x0E 0x0B 0x00 0x6F 0x04 0x04 0x08 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x06 0x03 0x03 0x06 0x03 0x07 0x04 0x05 0x09 0x05 0x0A 0x07 0x07 0x08 0x07 0x0E 0x05 0x0B 0x08 0x07 0x0E 0x05 0x0B 0x0C 0x17 0x08 0x09 0x0A 0x17 0x08 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x0F 0x04 0x07 0x0B 0x04 0x05 0x06 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x0E 0x07 0x09 0x03 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x05 0x03 0x06 0x05 0x03 0x08 0x09 0x09 0x03 0x06 0x04 0x05 0x07 0x03 0x06 0x09 0x03 0x0A 0x07 0x47 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x09 0x06 0x08 0x07 0x0D 0x0A 0x08 0x06 0x08 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageB.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageB.scr deleted file mode 100644 index 17a12621..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageB.scr +++ /dev/null @@ -1,60 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x22 0x00 0x56 0x00 0x27 0x00 0xCC 0x00 0x0A 0x00 0x28 0x00 0x00 0x00 0xF8 0x00 0x04 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x22 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x00 0x01 0x07 0xA0 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x05 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x27 0x42 0x80 0x03 0x04 0x00 0x03 0x05 0x06 0x00 0x00 0x00 0x0F 0xFF 0xFF 0x00 0x77 0x00 0xAF 0x00 0xB6 0x00 0xBD 0x80 0x02 0x00 0x80 0x12 0x01 0x0A 0x7F; -0x80 0xB4 0x06 0x00 0x0A 0x00 0x82 0x00 0x01 0xFF 0x00 0x01 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xCC 0x00 0x05 0x30 0x8F 0x00 0x04 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x30 0x18 0x77 0x05 0x40 0x18 0x8C 0x00 0x05 0x18 0x01 0x87 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x01 0x87 0x01 0x18 0x01 0x87 0x02 0x18 0x7D 0x00 0x06 0x89 0x03 0x7B 0x00 0x08 0x67 0x1B 0x18 0x8F 0x00 0x09 0x3D 0x8C 0x00 0x0A 0x87 0x00 0xAD 0x00 0x7F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x08 0x18 0x7F 0x00 0x0B 0x18 0x18 0x87 0x01 0x70 0x19 0x18 0x7B 0x00 0x08 0x87 0x00 0x01 0x7F 0x00 0x08 0x18 0x7B 0x00 0x0B 0x87 0x01 0x01 0x7F 0x00 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x0C 0x19 0x1E 0x25 0x61 0x08 0x18 0x8B 0x00 0x0D 0x70 0x0D 0x18 0x19 0x1E 0x04 0x41 0x19 0x1E 0x25 0x8B 0x00 0x0E 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x2D 0x18 0x8B 0x00 0x10 0x60 0x03 0x7A 0x1A 0x03 0x25 0x10 0x80 0x6B 0x1E 0x1A 0x04 0x25 0x75 0x00 0x11 0x00 0x01 0x00 0x12 0x00 0x09 0xAD 0x01 0x18 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x70 0x10 0x11 0x6D 0x00 0x8D 0x00 0x12 0x70 0x08 0x11 0x6E 0x00 0x8D 0x00 0x12 0x7A 0x02 0x20 0x18 0x19 0x87 0x02 0x7A 0x02 0x10 0x18 0x01 0x87 0x02 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x0F 0x01 0x10 0xAD 0x01 0x8B 0x00 0x13 0x7A 0x01 0x10 0x18 0x8C 0x00 0x14 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x04 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x56 0x00 0x15 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x03 0x01 0x00 0x00 0x00 0x06 0x80 0x03 0x00 0x05 0x81 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x13 0x05 0x00 0x00 0x00 0x01 0x00 0x1D 0x00 0x06 0x00 0x00 0xC5 0x05 0x00 0x00 0x02 0x06 0x80 0x08 0x12 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x02 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x06 0x80 0x07 0x01 0x03 0x00 0x00 0x09 0x06 0x82 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x28 0x00 0x0D 0x1C 0x04 0x04 0x06 0x0F 0x02 0x0B 0x08 0x0A 0x41 0x1B 0x07 0x05 0x00 0x17 0x04 0x07 0x0C 0x10 0x05 0x06 0x04 0x07 0x04 0x0A 0x06 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x0B 0x06 0x03 0x09 0x0D 0x07 0x05 0x1C 0x08 0x08 0x16 0x07 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageC.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageC.scr deleted file mode 100644 index ae38ff83..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/_tmp/packageC.scr +++ /dev/null @@ -1,49 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x00 0x00 0x0B 0x00 0x06 0x00 0x0A 0x00 0x08 0x00 0x0C 0x00 0x05 0x00 0x09 0x00 0x23 0x00 0x02 0x00 0x00 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x0E 0x04 0x00 0x0B 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0D 0x06 0x00 0x0A 0x00 0x80 0x00 0x00 0xFF 0x00 0x01 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x0B 0x07 0x00 0x08 0x00 0x01 0x10 0x18 0x8C 0x00 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0F 0x08 0x00 0x0C 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x0C 0x0A 0x00 0x09 0x01 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x01 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x09 0x05 0x00 0x06 0x00 0x01 0x06 0x80 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x08 0x09 0x00 0x05 0x00 0x00 0x00 0x01 0x05 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od1.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od1.scr deleted file mode 100644 index 0ecd8e07..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od1.scr +++ /dev/null @@ -1,54 +0,0 @@ - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -//Scenario 1 - Object Deletion - -// create Applet A's instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 SW_NO_ERROR - -// Select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//setup transient -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//setup persistent -0x80 0x19 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//call removetrees -0x80 0x11 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//analyze remove trees -0x80 0x12 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//deselect Applet A's instance by selecting it again -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//analyze transient deselect memory gone -0x80 0x13 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//reset the card -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2-2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2-2.scr deleted file mode 100644 index 17e92795..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2-2.scr +++ /dev/null @@ -1,161 +0,0 @@ -//Card was reset - -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//analyze all attributes gone -0x80 0x16 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//Scenario 2 - Applet deletion - -//select installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//delete Applet A's instance -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//Delete Applet A's instance again and verify error -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 64 43 - -//create Applet A's instance again for mem monitoring. Also capture initialMem -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's first instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's second instance with new AID -0x80 0xB8 0x00 0x00 0x1B -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0E 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x00 0x00 -0x7F; -// 90 00 - -//Delete Applet B's first instance and verify error -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x7F; -//64 48 - -//No Applet deletion because of shared reference. -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//Make Applet A's instance get a shareable reference to Applet B's first instance -0x80 0x21 0x00 0x00 0x00 0x7F; -// 90 00 - -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Try deleting Applet B's first instance & Applet B's second instance and verify error. -0x80 0xc4 0x02 0x00 0x18 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -//64 48 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//Lose reference from A. Also calls Object Deletion -0x80 0x22 0x00 0x00 0x00 0x7F; -// 90 00 - -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Delete applet B's first instance & applet B's second instance -0x80 0xc4 0x02 0x00 0x18 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -// 90 00 - -//create Applet B's first instance again -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's second instance with new AID again -0x80 0xB8 0x00 0x00 0x1B -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0E 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x00 0x00 -0x7F; -// 90 00 - -//select Applet B's second instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 0x7F; -// 90 00 - -//introduce reference from Applet B's first instance to Applet B's second instance -0x80 0x12 0x00 0x00 0x00 0x7F; -// 90 00 - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Delete applet B's second instance -0x80 0xc4 0x01 0x00 0x0C -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -// 90 00 - -//Delete applet B's first instance -0x80 0xc4 0x01 0x00 0x0C -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x7F; -// 90 00 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//verify all mem returned -0x80 0x18 0x00 0x00 0x00 0x7F; -// 90 00 - -// Scenario - package deletion - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//create Applet B's first instance again for testing package deletion -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//Delete package B and verify error -0x80 0xc0 0x00 0x00 0x0B -0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 -0x7F; -// 64 4d - -//Delete package C and verify error -0x80 0xc0 0x00 0x00 0x0B -0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 -0x7F; -// 64 4c - -//Delete Applet B's first instance & package B -0x80 0xc2 0x00 0x00 0x0B 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x7F; -// 90 00 - -//Delete packageC -0x80 0xc0 0x00 0x00 0x0B 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -// 90 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2.scr deleted file mode 100644 index fa06a4ab..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od2.scr +++ /dev/null @@ -1,23 +0,0 @@ -//Card was reset - -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//verify reset mem gone -0x80 0x14 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//set all attributes (including transient arrays) to null. This also requests GC -0x80 0x15 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3-2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3-2.scr deleted file mode 100644 index 06ffa9cc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3-2.scr +++ /dev/null @@ -1,21 +0,0 @@ -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//delete package C -0x80 0xc0 0x00 0x00 0x0B 0x0A -0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -// 90 00 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//verify memory returned -0x80 0x18 0x00 0x00 0x00 0x7F; -// 90 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3.scr deleted file mode 100644 index e8a1bcce..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/od3.scr +++ /dev/null @@ -1,32 +0,0 @@ -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -//Scenario - package deletion memory check - -// create Applet A's first instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 - -// Select Applet A's first instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 - -//capture initial memory -0x80 0x17 0x00 0x00 0x00 0x7F; -// 90 00 - -//now load package C -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr deleted file mode 100644 index 8148c81b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr +++ /dev/null @@ -1,279 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x15 0x01 0x0E 0x00 0x20 0x03 0x4F 0x00 0x3A 0x00 0xA6 0x00 0x00 0x02 0xD4 0x00 0x28 0x00 0x01 0x00 0x0B 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x20 0x00 0x80 0x03 0x0D 0x00 0x05 0x07 0x01 0x00 0x00 0x02 0x70 0x00 0x81 0x00 0x03 0x00 0x02 0x01 0x00 0x00 0x00 0x00 0x81 0x00 0x01 0xFF 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x4F 0x00 0x02 0x30 0x8F 0x00 0x41 0x3D 0x8C 0x00 0x40 0x3B 0x7A 0x05 0x10 0x18 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x00 0x18 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x01 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x11 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x12 0x7A 0x02 0x10 0x18 0x8C 0x00 0x15 0x18 0x8B 0x00 0x16 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x10 0x18 0x8C 0x00 0x1A 0x18 0x03 0x8D 0x00 0x17 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x7A 0x05 0x11 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x18 0x05 0x8D 0x00 0x17 0x89 0x04 0x18 0x04 0x8D 0x00 0x17 0x89 0x05 0x18 0x05 0x05 0x8D 0x00 0x42 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x18 0x03 0x8D 0x00 0x17 0x89 0x07 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x06 0x1D 0x8F 0x00 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x08 0x18 0x05 0x04 0x8D 0x00 0x42 0x87 0x09 0x18 0x03 0x8D 0x00 0x17 0x89 0x0A 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x09 0x1D 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x03 0x8D 0x00 0x17 0x89 0x0B 0x7A 0x02 0x11 0xAD 0x06 0x67 0x06 0x7D 0x00 0x19 0x78 0x03 0x30 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAD 0x06 0x92 0x6D 0x1E 0xAD 0x06 0x1D 0x24 0x66 0x0F 0xAD 0x06 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1B 0x78 0x59 0x01 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x02 0x11 0xAD 0x09 0x67 0x06 0x7D 0x00 0x1D 0x78 0x03 0x30 0x1D 0xAD 0x09 0x92 0x6D 0x1E 0xAD 0x09 0x1D 0x24 0x66 0x0F 0xAD 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1E 0x78 0x59 0x01 0x01 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x00 0x10 0x8D 0x00 0x1F 0x7A 0x02 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x01 0x87 0x00 0x18 0x01 0x87 0x01 0x01 0x7F 0x00 0x11 0x01 0x7F 0x00 0x12 0x7A 0x02 0x12 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x0B 0x6A 0x07 0xAF 0x0B 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x20 0x18 0x8C 0x00 0x21 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x04 0x12 0x18 0x8C 0x00 0x21 0x30 0x1D 0x7D 0x00 0x1B 0x6A 0x08 0x7D 0x00 0x23 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x0B 0xAF 0x07 0xAF 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x41 0x6A 0x08 0x7D 0x00 0x24 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x30 0x1D 0x7D 0x00 0x1C 0x6A 0x06 0x1D 0x8D 0x00 0x20 0x7A 0x03 0x12 0x18 0x8C 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x30 0x1D 0x7D 0x00 0x1E 0x6A 0x08 0x7D 0x00 0x25 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x07 0xAF 0x08 0x43 0xAF 0x0A 0x41 0x6A 0x08 0x7D 0x00 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x06 0x18 0x01 0x87 0x09 0x8D 0x00 0x1F 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x27 0x8D 0x00 0x20 0xAF 0x05 0x04 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x28 0x8D 0x00 0x20 0xAF 0x04 0x05 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x29 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x02 0x10 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x2A 0x8D 0x00 0x20 0x7A 0x03 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7B 0x00 0x2B 0x03 0x7B 0x00 0x2B 0x92 0x5B 0x8D 0x00 0x2C 0x2C 0x19 0x67 0x08 0x7D 0x00 0x2D 0x8D 0x00 0x20 0x18 0x19 0x03 0x8D 0x00 0x2E 0x87 0x0D 0xAD 0x0D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x67 0x08 0x7D 0x00 0x30 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x0D 0x8D 0x00 0x1F 0x7A 0x02 0x23 0x19 0x8B 0x00 0x31 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x03 0x32 0x03 0x29 0x04 0x1A 0x04 0x25 0x73 0x00 0x7B 0x00 0x10 0x00 0x22 0x00 0x39 0x00 0x3F 0x00 0x45 0x00 0x4B 0x00 0x51 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x57 0x00 0x5D 0x00 0x63 0x00 0x69 0x00 0x33 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x2D 0x00 0x6F 0x00 0x75 0x18 0x8C 0x00 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x50 0x18 0x8C 0x00 0x33 0x70 0x4A 0x18 0x8C 0x00 0x34 0x70 0x44 0x18 0x8C 0x00 0x35 0x70 0x3E 0x18 0x8C 0x00 0x36 0x70 0x38 0x18 0x8C 0x00 0x37 0x70 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x8C 0x00 0x38 0x70 0x2C 0x18 0x8C 0x00 0x39 0x70 0x26 0x18 0x8C 0x00 0x3A 0x70 0x20 0x18 0x8C 0x00 0x3B 0x70 0x1A 0x18 0x8C 0x00 0x3C 0x70 0x14 0x18 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x3D 0x70 0x0E 0x18 0x8C 0x00 0x3E 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x20 0x7A 0x05 0x30 0x18 0x8C 0x00 0x3F 0x18 0x01 0x87 0x0E 0x18 0x01 0x87 0x0F 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x10 0x1D 0x1E 0x6D 0x1E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x1E 0x8C 0x00 0x2F 0x87 0x0E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x12 0x1E 0x8C 0x00 0x2F 0x87 0x0F 0x7A 0x02 0x20 0x18 0x8C 0x00 0x3F 0x18 0x1D 0x89 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x3A 0x00 0x28 0x00 0x03 0x00 0x01 0x03 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x00 0x00 0x22 0x91 0x01 0x91 0x02 0x91 0x7F; -0x80 0xB4 0x08 0x00 0x1D 0x03 0x91 0x04 0x91 0x05 0x91 0x06 0x91 0x07 0x91 0x08 0x91 0x09 0x91 0x0A 0x91 0x0B 0x91 0x0C 0x91 0x0D 0x91 0x0E 0x91 0x0F 0x91 0x10 0x90 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x0E 0x00 0x43 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x08 0x02 0x00 0x00 0x06 0x02 0x00 0x00 0x07 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x02 0x02 0x00 0x00 0x09 0x02 0x00 0x00 0x0A 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x0B 0x02 0x00 0x00 0x0C 0x02 0x00 0x16 0x00 0x02 0x00 0x00 0x04 0x02 0x00 0x0C 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x02 0x00 0x0C 0x01 0x02 0x00 0x0C 0x02 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x04 0x01 0x00 0x16 0x00 0x06 0x00 0x03 0x44 0x06 0x80 0x03 0x00 0x03 0x80 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x06 0x80 0x08 0x10 0x01 0x00 0x0C 0x00 0x05 0x00 0x00 0x06 0x06 0x00 0x00 0x0C 0x05 0x00 0x00 0x08 0x05 0x00 0x00 0x26 0x05 0x00 0x00 0x0A 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x0C 0x06 0x80 0x08 0x12 0x06 0x80 0x07 0x01 0x06 0x00 0x00 0xD1 0x06 0x00 0x01 0x03 0x05 0x00 0x00 0x12 0x05 0x00 0x00 0x10 0x05 0x00 0x00 0x14 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x16 0x05 0x00 0x00 0x18 0x05 0x00 0x00 0x24 0x05 0x00 0x00 0x22 0x05 0x00 0x00 0x1A 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x05 0x00 0x00 0x1E 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x04 0x06 0x00 0x03 0x0E 0x05 0x00 0x00 0x20 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0x5F 0x06 0x00 0x00 0x51 0x06 0x00 0x01 0x35 0x06 0x00 0x01 0x3B 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x4E 0x06 0x00 0x01 0x7E 0x06 0x00 0x01 0xB7 0x06 0x00 0x01 0xE1 0x06 0x00 0x01 0xEF 0x06 0x00 0x02 0x1E 0x06 0x00 0x02 0x28 0x06 0x00 0x02 0x3B 0x06 0x00 0x02 0x7F; -0x80 0xB4 0x05 0x00 0x11 0x66 0x06 0x81 0x00 0x00 0x06 0x00 0x00 0x3F 0x01 0x00 0x00 0x00 0x06 0x80 0x08 0x0E 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0xA6 0x00 0x33 0x19 0x0C 0x2A 0x0E 0x0A 0x07 0x07 0x08 0x07 0x08 0x16 0x08 0x07 0x08 0x16 0x05 0x0B 0x05 0x06 0x08 0x14 0x0B 0x05 0x06 0x08 0x1C 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x13 0x04 0x3D 0x02 0x02 0x35 0x02 0x03 0x10 0x04 0x0E 0x0A 0x0E 0x16 0x0B 0x29 0x02 0x0F 0xAC 0x04 0x07 0x12 0x0E 0x0B 0x00 0x6F 0x04 0x04 0x08 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x06 0x03 0x03 0x06 0x03 0x07 0x04 0x05 0x09 0x05 0x0A 0x07 0x07 0x08 0x07 0x0E 0x05 0x0B 0x08 0x07 0x0E 0x05 0x0B 0x0C 0x17 0x08 0x09 0x0A 0x17 0x08 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x0F 0x04 0x07 0x0B 0x04 0x05 0x06 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x0E 0x07 0x09 0x03 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x05 0x03 0x06 0x05 0x03 0x08 0x09 0x09 0x03 0x06 0x04 0x05 0x07 0x03 0x06 0x09 0x03 0x0A 0x07 0x47 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x09 0x06 0x08 0x07 0x0D 0x0A 0x08 0x06 0x08 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x00 0x00 0x0B 0x00 0x06 0x00 0x0A 0x00 0x08 0x00 0x0C 0x00 0x05 0x00 0x09 0x00 0x23 0x00 0x02 0x00 0x00 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x0E 0x04 0x00 0x0B 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0D 0x06 0x00 0x0A 0x00 0x80 0x00 0x00 0xFF 0x00 0x01 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x0B 0x07 0x00 0x08 0x00 0x01 0x10 0x18 0x8C 0x00 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0F 0x08 0x00 0x0C 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x0C 0x0A 0x00 0x09 0x01 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x01 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x09 0x05 0x00 0x06 0x00 0x01 0x06 0x80 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x08 0x09 0x00 0x05 0x00 0x00 0x00 0x01 0x05 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x22 0x00 0x56 0x00 0x27 0x00 0xCC 0x00 0x0A 0x00 0x28 0x00 0x00 0x00 0xF8 0x00 0x04 0x00 0x00 0x00 0x00 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x22 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x00 0x01 0x07 0xA0 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x05 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x27 0x42 0x80 0x03 0x04 0x00 0x03 0x05 0x06 0x00 0x00 0x00 0x0F 0xFF 0xFF 0x00 0x77 0x00 0xAF 0x00 0xB6 0x00 0xBD 0x80 0x02 0x00 0x80 0x12 0x01 0x0A 0x7F; -0x80 0xB4 0x06 0x00 0x0A 0x00 0x82 0x00 0x01 0xFF 0x00 0x01 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x00 0xCC 0x00 0x05 0x30 0x8F 0x00 0x04 0x3D 0x18 0x1D 0x1E 0x8C 0x00 0x07 0x3B 0x7A 0x01 0x30 0x18 0x77 0x05 0x40 0x18 0x8C 0x00 0x05 0x18 0x01 0x87 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x01 0x87 0x01 0x18 0x01 0x87 0x02 0x18 0x7D 0x00 0x06 0x89 0x03 0x7B 0x00 0x08 0x67 0x1B 0x18 0x8F 0x00 0x09 0x3D 0x8C 0x00 0x0A 0x87 0x00 0xAD 0x00 0x7F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x08 0x18 0x7F 0x00 0x0B 0x18 0x18 0x87 0x01 0x70 0x19 0x18 0x7B 0x00 0x08 0x87 0x00 0x01 0x7F 0x00 0x08 0x18 0x7B 0x00 0x0B 0x87 0x01 0x01 0x7F 0x00 0x0B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x0C 0x19 0x1E 0x25 0x61 0x08 0x18 0x8B 0x00 0x0D 0x70 0x0D 0x18 0x19 0x1E 0x04 0x41 0x19 0x1E 0x25 0x8B 0x00 0x0E 0x7A 0x02 0x21 0x19 0x8B 0x00 0x0F 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x2D 0x18 0x8B 0x00 0x10 0x60 0x03 0x7A 0x1A 0x03 0x25 0x10 0x80 0x6B 0x1E 0x1A 0x04 0x25 0x75 0x00 0x11 0x00 0x01 0x00 0x12 0x00 0x09 0xAD 0x01 0x18 0x8B 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x11 0x70 0x10 0x11 0x6D 0x00 0x8D 0x00 0x12 0x70 0x08 0x11 0x6E 0x00 0x8D 0x00 0x12 0x7A 0x02 0x20 0x18 0x19 0x87 0x02 0x7A 0x02 0x10 0x18 0x01 0x87 0x02 0x7A 0x7F; -0x80 0xB4 0x07 0x00 0x0F 0x01 0x10 0xAD 0x01 0x8B 0x00 0x13 0x7A 0x01 0x10 0x18 0x8C 0x00 0x14 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0D 0x08 0x00 0x0A 0x00 0x04 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x56 0x00 0x15 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x03 0x01 0x00 0x00 0x00 0x06 0x80 0x03 0x00 0x05 0x81 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x00 0x00 0x13 0x05 0x00 0x00 0x00 0x01 0x00 0x1D 0x00 0x06 0x00 0x00 0xC5 0x05 0x00 0x00 0x02 0x06 0x80 0x08 0x12 0x03 0x80 0x03 0x01 0x03 0x80 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x19 0x02 0x03 0x80 0x0A 0x01 0x03 0x80 0x03 0x03 0x03 0x00 0x00 0x08 0x06 0x80 0x07 0x01 0x03 0x00 0x00 0x09 0x06 0x82 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageB/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x28 0x00 0x0D 0x1C 0x04 0x04 0x06 0x0F 0x02 0x0B 0x08 0x0A 0x41 0x1B 0x07 0x05 0x00 0x17 0x04 0x07 0x0C 0x10 0x05 0x06 0x04 0x07 0x04 0x0A 0x06 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x0B 0x06 0x03 0x09 0x0D 0x07 0x05 0x1C 0x08 0x08 0x16 0x07 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; - -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -//Scenario 1 - Object Deletion - -// create Applet A's instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 SW_NO_ERROR - -// Select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//setup transient -0x80 0x20 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//setup persistent -0x80 0x19 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//call removetrees -0x80 0x11 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//analyze remove trees -0x80 0x12 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//deselect Applet A's instance by selecting it again -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//analyze transient deselect memory gone -0x80 0x13 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//reset the card -powerdown; - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr.expected.out deleted file mode 100644 index bfd0d938..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-1.scr.expected.out +++ /dev/null @@ -1,16 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Applet creation and functional test section. -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 19, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 11, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 12, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 13, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr deleted file mode 100644 index 2cb651c7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr +++ /dev/null @@ -1,49 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -//Card was reset - -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//verify reset mem gone -0x80 0x14 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//set all attributes (including transient arrays) to null. This also requests GC -0x80 0x15 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr.expected.out deleted file mode 100644 index 30771f5e..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-2.scr.expected.out +++ /dev/null @@ -1,9 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Functional test section. -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 14, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 15, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr deleted file mode 100644 index bfb0b0a2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr +++ /dev/null @@ -1,187 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -//Card was reset - -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//analyze all attributes gone -0x80 0x16 0x00 0x00 0x00 0x7F; -// 90 00 SW_NO_ERROR - -//Scenario 2 - Applet deletion - -//select installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//delete Applet A's instance -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 SW_NO_ERROR - -//Delete Applet A's instance again and verify error -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 64 43 - -//create Applet A's instance again for mem monitoring. Also capture initialMem -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's first instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's second instance with new AID -0x80 0xB8 0x00 0x00 0x1B -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0E 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x00 0x00 -0x7F; -// 90 00 - -//Delete Applet B's first instance and verify error -0x80 0xc4 0x01 0x00 0x0C 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x7F; -//64 48 - -//No Applet deletion because of shared reference. -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//Make Applet A's instance get a shareable reference to Applet B's first instance -0x80 0x21 0x00 0x00 0x00 0x7F; -// 90 00 - -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Try deleting Applet B's first instance & Applet B's second instance and verify error. -0x80 0xc4 0x02 0x00 0x18 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -//64 48 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//Lose reference from A. Also calls Object Deletion -0x80 0x22 0x00 0x00 0x00 0x7F; -// 90 00 - -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Delete applet B's first instance & applet B's second instance -0x80 0xc4 0x02 0x00 0x18 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -// 90 00 - -//create Applet B's first instance again -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//create Applet B's second instance with new AID again -0x80 0xB8 0x00 0x00 0x1B -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x0E 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x00 0x00 -0x7F; -// 90 00 - -//select Applet B's second instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 0x7F; -// 90 00 - -//introduce reference from Applet B's first instance to Applet B's second instance -0x80 0x12 0x00 0x00 0x00 0x7F; -// 90 00 - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//Delete applet B's second instance -0x80 0xc4 0x01 0x00 0x0C -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x02 -0x7F; -// 90 00 - -//Delete applet B's first instance -0x80 0xc4 0x01 0x00 0x0C -0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 -0x7F; -// 90 00 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//verify all mem returned -0x80 0x18 0x00 0x00 0x00 0x7F; -// 90 00 - -// Scenario - package deletion - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//create Applet B's first instance again for testing package deletion -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x7F; -// 90 00 - -//Delete package B and verify error -0x80 0xc0 0x00 0x00 0x0B -0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 -0x7F; -// 64 4d - -//Delete package C and verify error -0x80 0xc0 0x00 0x00 0x0B -0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 -0x7F; -// 64 4c - -//Delete Applet B's first instance & package B -0x80 0xc2 0x00 0x00 0x0B 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x7F; -// 90 00 - -//Delete packageC -0x80 0xc0 0x00 0x00 0x0B 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -// 90 00 - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr.expected.out deleted file mode 100644 index 70e389d7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo1-3.scr.expected.out +++ /dev/null @@ -1,37 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Functional test section. -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 16, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 01, P2: 00, Lc: 0c, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 01, P2: 00, Lc: 0c, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 64, SW2: 43 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 1b, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 0e, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, 00, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 01, P2: 00, Lc: 0c, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, Le: 00, SW1: 64, SW2: 48 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 21, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 02, P2: 00, Lc: 18, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, Le: 00, SW1: 64, SW2: 48 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 02, P2: 00, Lc: 18, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 1b, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 0e, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, 00, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 12, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 01, P2: 00, Lc: 0c, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 02, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c4, P1: 01, P2: 00, Lc: 0c, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 18, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, 01, SW1: 90, SW2: 00 -CLA: 80, INS: c0, P1: 00, P2: 00, Lc: 0b, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, Le: 00, SW1: 64, SW2: 4d -CLA: 80, INS: c0, P1: 00, P2: 00, Lc: 0b, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 03, Le: 00, SW1: 64, SW2: 4c -CLA: 80, INS: c2, P1: 00, P2: 00, Lc: 0b, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 02, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c0, P1: 00, P2: 00, Lc: 0b, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 03, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr deleted file mode 100644 index 787eca0b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr +++ /dev/null @@ -1,218 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x0F 0x00 0x15 0x01 0x0E 0x00 0x20 0x03 0x4F 0x00 0x3A 0x00 0xA6 0x00 0x00 0x02 0xD4 0x00 0x28 0x00 0x01 0x00 0x0B 0x02 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x18 0x04 0x00 0x15 0x02 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x12 0x03 0x00 0x0F 0x01 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x01 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x20 0x06 0x00 0x20 0x00 0x80 0x03 0x0D 0x00 0x05 0x07 0x01 0x00 0x00 0x02 0x70 0x00 0x81 0x00 0x03 0x00 0x02 0x01 0x00 0x00 0x00 0x00 0x81 0x00 0x01 0xFF 0x00 0x01 0x7F; -0x80 0xB4 0x06 0x00 0x03 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x03 0x4F 0x00 0x02 0x30 0x8F 0x00 0x41 0x3D 0x8C 0x00 0x40 0x3B 0x7A 0x05 0x10 0x18 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x00 0x18 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x87 0x01 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x11 0x8F 0x00 0x18 0x3D 0x03 0x05 0x8C 0x00 0x2F 0x7F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x12 0x7A 0x02 0x10 0x18 0x8C 0x00 0x15 0x18 0x8B 0x00 0x16 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x10 0x18 0x8C 0x00 0x1A 0x18 0x03 0x8D 0x00 0x17 0x89 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x7A 0x05 0x11 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x18 0x05 0x8D 0x00 0x17 0x89 0x04 0x18 0x04 0x8D 0x00 0x17 0x89 0x05 0x18 0x05 0x05 0x8D 0x00 0x42 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x06 0x18 0x03 0x8D 0x00 0x17 0x89 0x07 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x06 0x1D 0x8F 0x00 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x08 0x18 0x05 0x04 0x8D 0x00 0x42 0x87 0x09 0x18 0x03 0x8D 0x00 0x17 0x89 0x0A 0x03 0x30 0x1D 0x05 0x6D 0x13 0xAD 0x09 0x1D 0x8F 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x13 0x3D 0x1D 0x8C 0x00 0x14 0x37 0x59 0x01 0x01 0x70 0xED 0x18 0x03 0x8D 0x00 0x17 0x89 0x0B 0x7A 0x02 0x11 0xAD 0x06 0x67 0x06 0x7D 0x00 0x19 0x78 0x03 0x30 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0xAD 0x06 0x92 0x6D 0x1E 0xAD 0x06 0x1D 0x24 0x66 0x0F 0xAD 0x06 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1B 0x78 0x59 0x01 0x01 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x02 0x11 0xAD 0x09 0x67 0x06 0x7D 0x00 0x1D 0x78 0x03 0x30 0x1D 0xAD 0x09 0x92 0x6D 0x1E 0xAD 0x09 0x1D 0x24 0x66 0x0F 0xAD 0x09 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1D 0x24 0x94 0x00 0x00 0x13 0x85 0x0C 0x1D 0x6A 0x06 0x7D 0x00 0x1E 0x78 0x59 0x01 0x01 0x70 0xE0 0x7D 0x00 0x1C 0x78 0x00 0x10 0x8D 0x00 0x1F 0x7A 0x02 0x10 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x01 0x87 0x00 0x18 0x01 0x87 0x01 0x01 0x7F 0x00 0x11 0x01 0x7F 0x00 0x12 0x7A 0x02 0x12 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x0B 0x6A 0x07 0xAF 0x0B 0x8D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x20 0x18 0x8C 0x00 0x21 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x31 0x1E 0x7D 0x00 0x1C 0x6A 0x06 0x1E 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x04 0x12 0x18 0x8C 0x00 0x21 0x30 0x1D 0x7D 0x00 0x1B 0x6A 0x08 0x7D 0x00 0x23 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x0B 0xAF 0x07 0xAF 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x43 0x41 0x6A 0x08 0x7D 0x00 0x24 0x8D 0x00 0x20 0x18 0x8C 0x00 0x22 0x30 0x1D 0x7D 0x00 0x1C 0x6A 0x06 0x1D 0x8D 0x00 0x20 0x7A 0x03 0x12 0x18 0x8C 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x30 0x1D 0x7D 0x00 0x1E 0x6A 0x08 0x7D 0x00 0x25 0x8D 0x00 0x20 0x03 0x8D 0x00 0x17 0x31 0x1E 0xAF 0x07 0xAF 0x08 0x43 0xAF 0x0A 0x41 0x6A 0x08 0x7D 0x00 0x26 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x06 0x18 0x01 0x87 0x09 0x8D 0x00 0x1F 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x27 0x8D 0x00 0x20 0xAF 0x05 0x04 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x28 0x8D 0x00 0x20 0xAF 0x04 0x05 0x8D 0x00 0x17 0x6A 0x08 0x7D 0x00 0x29 0x8D 0x00 0x20 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x02 0x10 0x18 0x03 0x8D 0x00 0x17 0x89 0x02 0x7A 0x02 0x11 0x03 0x8D 0x00 0x17 0x30 0x1D 0xAF 0x02 0x6A 0x08 0x7D 0x00 0x2A 0x8D 0x00 0x20 0x7A 0x03 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7B 0x00 0x2B 0x03 0x7B 0x00 0x2B 0x92 0x5B 0x8D 0x00 0x2C 0x2C 0x19 0x67 0x08 0x7D 0x00 0x2D 0x8D 0x00 0x20 0x18 0x19 0x03 0x8D 0x00 0x2E 0x87 0x0D 0xAD 0x0D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x67 0x08 0x7D 0x00 0x30 0x8D 0x00 0x20 0x7A 0x02 0x10 0x18 0x01 0x87 0x0D 0x8D 0x00 0x1F 0x7A 0x02 0x23 0x19 0x8B 0x00 0x31 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x03 0x32 0x03 0x29 0x04 0x1A 0x04 0x25 0x73 0x00 0x7B 0x00 0x10 0x00 0x22 0x00 0x39 0x00 0x3F 0x00 0x45 0x00 0x4B 0x00 0x51 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x57 0x00 0x5D 0x00 0x63 0x00 0x69 0x00 0x33 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x7B 0x00 0x2D 0x00 0x6F 0x00 0x75 0x18 0x8C 0x00 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x70 0x50 0x18 0x8C 0x00 0x33 0x70 0x4A 0x18 0x8C 0x00 0x34 0x70 0x44 0x18 0x8C 0x00 0x35 0x70 0x3E 0x18 0x8C 0x00 0x36 0x70 0x38 0x18 0x8C 0x00 0x37 0x70 0x32 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x18 0x8C 0x00 0x38 0x70 0x2C 0x18 0x8C 0x00 0x39 0x70 0x26 0x18 0x8C 0x00 0x3A 0x70 0x20 0x18 0x8C 0x00 0x3B 0x70 0x1A 0x18 0x8C 0x00 0x3C 0x70 0x14 0x18 0x8C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x3D 0x70 0x0E 0x18 0x8C 0x00 0x3E 0x70 0x08 0x11 0x6D 0x00 0x8D 0x00 0x20 0x7A 0x05 0x30 0x18 0x8C 0x00 0x3F 0x18 0x01 0x87 0x0E 0x18 0x01 0x87 0x0F 0x18 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x03 0x8D 0x00 0x17 0x89 0x10 0x1D 0x1E 0x6D 0x1E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x1E 0x8C 0x00 0x2F 0x87 0x0E 0x18 0x8F 0x00 0x18 0x3D 0x1D 0x04 0x41 0x7F; -0x80 0xB4 0x07 0x00 0x12 0x1E 0x8C 0x00 0x2F 0x87 0x0F 0x7A 0x02 0x20 0x18 0x8C 0x00 0x3F 0x18 0x1D 0x89 0x0C 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x3A 0x00 0x28 0x00 0x03 0x00 0x01 0x03 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x02 0x01 0x00 0x00 0x00 0x22 0x91 0x01 0x91 0x02 0x91 0x7F; -0x80 0xB4 0x08 0x00 0x1D 0x03 0x91 0x04 0x91 0x05 0x91 0x06 0x91 0x07 0x91 0x08 0x91 0x09 0x91 0x0A 0x91 0x0B 0x91 0x0C 0x91 0x0D 0x91 0x0E 0x91 0x0F 0x91 0x10 0x90 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x01 0x0E 0x00 0x43 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x08 0x02 0x00 0x00 0x06 0x02 0x00 0x00 0x07 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x02 0x02 0x00 0x00 0x09 0x02 0x00 0x00 0x0A 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x0B 0x02 0x00 0x00 0x0C 0x02 0x00 0x16 0x00 0x02 0x00 0x00 0x04 0x02 0x00 0x0C 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x02 0x00 0x0C 0x01 0x02 0x00 0x0C 0x02 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x04 0x01 0x00 0x16 0x00 0x06 0x00 0x03 0x44 0x06 0x80 0x03 0x00 0x03 0x80 0x03 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x01 0x06 0x80 0x08 0x10 0x01 0x00 0x0C 0x00 0x05 0x00 0x00 0x06 0x06 0x00 0x00 0x0C 0x05 0x00 0x00 0x08 0x05 0x00 0x00 0x26 0x05 0x00 0x00 0x0A 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x0C 0x06 0x80 0x08 0x12 0x06 0x80 0x07 0x01 0x06 0x00 0x00 0xD1 0x06 0x00 0x01 0x03 0x05 0x00 0x00 0x12 0x05 0x00 0x00 0x10 0x05 0x00 0x00 0x14 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x16 0x05 0x00 0x00 0x18 0x05 0x00 0x00 0x24 0x05 0x00 0x00 0x22 0x05 0x00 0x00 0x1A 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0B 0x05 0x00 0x00 0x1E 0x06 0x80 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x04 0x06 0x00 0x03 0x0E 0x05 0x00 0x00 0x20 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0x5F 0x06 0x00 0x00 0x51 0x06 0x00 0x01 0x35 0x06 0x00 0x01 0x3B 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x4E 0x06 0x00 0x01 0x7E 0x06 0x00 0x01 0xB7 0x06 0x00 0x01 0xE1 0x06 0x00 0x01 0xEF 0x06 0x00 0x02 0x1E 0x06 0x00 0x02 0x28 0x06 0x00 0x02 0x3B 0x06 0x00 0x02 0x7F; -0x80 0xB4 0x05 0x00 0x11 0x66 0x06 0x81 0x00 0x00 0x06 0x00 0x00 0x3F 0x01 0x00 0x00 0x00 0x06 0x80 0x08 0x0E 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/packageA/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0xA6 0x00 0x33 0x19 0x0C 0x2A 0x0E 0x0A 0x07 0x07 0x08 0x07 0x08 0x16 0x08 0x07 0x08 0x16 0x05 0x0B 0x05 0x06 0x08 0x14 0x0B 0x05 0x06 0x08 0x1C 0x04 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x13 0x04 0x3D 0x02 0x02 0x35 0x02 0x03 0x10 0x04 0x0E 0x0A 0x0E 0x16 0x0B 0x29 0x02 0x0F 0xAC 0x04 0x07 0x12 0x0E 0x0B 0x00 0x6F 0x04 0x04 0x08 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x05 0x06 0x03 0x03 0x06 0x03 0x07 0x04 0x05 0x09 0x05 0x0A 0x07 0x07 0x08 0x07 0x0E 0x05 0x0B 0x08 0x07 0x0E 0x05 0x0B 0x0C 0x17 0x08 0x09 0x0A 0x17 0x08 0x09 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x0F 0x04 0x07 0x0B 0x04 0x05 0x06 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x04 0x05 0x06 0x07 0x05 0x05 0x03 0x04 0x0F 0x03 0x0E 0x07 0x09 0x03 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x05 0x03 0x06 0x05 0x03 0x08 0x09 0x09 0x03 0x06 0x04 0x05 0x07 0x03 0x06 0x09 0x03 0x0A 0x07 0x47 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x06 0x7F; -0x80 0xB4 0x09 0x00 0x09 0x06 0x08 0x07 0x0D 0x0A 0x08 0x06 0x08 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -// resume printing output during functional test -output on; - -echo "Applet creation and functional test section."; - -//Scenario - package deletion memory check - -// create Applet A's first instance -0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x00 0x7F; -// 90 00 - -// Select Applet A's first instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//request Object Deletion -0x80 0x10 0x00 0x00 0x00 0x7F; -// 90 00 - -//capture initial memory -0x80 0x17 0x00 0x00 0x00 0x7F; -// 90 00 - -//now load package C -//select the installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x17 0x01 0x00 0x14 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x02 0x00 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x14 0x00 0x1F 0x00 0x00 0x00 0x0B 0x00 0x06 0x00 0x0A 0x00 0x08 0x00 0x0C 0x00 0x05 0x00 0x09 0x00 0x23 0x00 0x02 0x00 0x00 0x00 0x00 0x01 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x00 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x0E 0x04 0x00 0x0B 0x01 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0D 0x06 0x00 0x0A 0x00 0x80 0x00 0x00 0xFF 0x00 0x01 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x0B 0x07 0x00 0x08 0x00 0x01 0x10 0x18 0x8C 0x00 0x00 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x0F 0x08 0x00 0x0C 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/Export.cap -0x80 0xB2 0x0A 0x00 0x00 0x7F; -0x80 0xB4 0x0A 0x00 0x0C 0x0A 0x00 0x09 0x01 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x01 0x7F; -0x80 0xBC 0x0A 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x09 0x05 0x00 0x06 0x00 0x01 0x06 0x80 0x00 0x00 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/odSample/libPackageC/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x08 0x09 0x00 0x05 0x00 0x00 0x00 0x01 0x05 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -// resume printing output during functional test -output on; - -echo "Functional test section."; - -//select installer -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 - -//delete package C -0x80 0xc0 0x00 0x00 0x0B 0x0A -0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x03 0x7F; -// 90 00 - -//select Applet A's instance -0x00 0xA4 0x04 0x00 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x01 0x01 0x7F; -// 90 00 - -//verify memory returned -0x80 0x18 0x00 0x00 0x00 0x7F; -// 90 00 - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr.expected.out deleted file mode 100644 index ec1d321d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/object_deletion/odDemo2.scr.expected.out +++ /dev/null @@ -1,18 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Applet creation and functional test section. -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, 00, Le: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 17, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -Functional test section. -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: c0, P1: 00, P2: 00, Lc: 0b, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 03, Le: 00, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0b, a0, 00, 00, 00, 62, 03, 01, 0c, 07, 01, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 18, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/_tmp/sigMsgRec.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/_tmp/sigMsgRec.scr deleted file mode 100644 index 6593fe7b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/_tmp/sigMsgRec.scr +++ /dev/null @@ -1,78 +0,0 @@ -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x1F 0x00 0x7E 0x00 0x0C 0x02 0x24 0x00 0x96 0x00 0x63 0x00 0x00 0x01 0x05 0x00 0x06 0x00 0x03 0x00 0x83 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x95 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0F 0x06 0x00 0x0C 0x00 0x80 0x03 0x06 0x00 0x04 0x07 0x01 0x00 0x00 0x00 0xA3 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x02 0x24 0x00 0x04 0x41 0x18 0x8C 0x00 0x1A 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x07 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0C 0x18 0x07 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x10 0x87 0x00 0x18 0x08 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x06 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0xAD 0x01 0x7B 0x00 0x08 0x03 0x7B 0x00 0x08 0x92 0x8E 0x04 0x00 0x06 0x06 0xAD 0x01 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x06 0x07 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7B 0x00 0x0A 0x03 0x7B 0x00 0x0A 0x92 0x8E 0x04 0x00 0x10 0x06 0xAD 0x00 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x10 0x07 0x18 0x10 0x42 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8D 0x00 0x0B 0x87 0x02 0x18 0x10 0x1E 0x03 0x8D 0x00 0x0D 0x94 0x00 0x00 0x0E 0x87 0x03 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x11 0x3D 0x18 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1E 0x8C 0x00 0x12 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x1A 0x04 0x25 0x73 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x00 0x12 0x00 0x0D 0x00 0x14 0x00 0x1B 0x18 0x19 0x8C 0x00 0x14 0x70 0x16 0x18 0x19 0x8C 0x00 0x15 0x70 0x0F 0x18 0x19 0x8C 0x00 0x16 0x70 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x17 0x7A 0x09 0x23 0x19 0x8B 0x00 0x13 0x2D 0x19 0x8B 0x00 0x18 0x32 0x04 0x05 0x8D 0x00 0x19 0x28 0x04 0xAD 0x03 0xAD 0x01 0x04 0x8E 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x00 0x18 0xAD 0x03 0x1A 0x08 0x1F 0xAD 0x02 0x03 0x15 0x04 0x03 0x8E 0x08 0x00 0x0E 0x02 0x89 0x05 0xAD 0x02 0xAF 0x05 0x15 0x04 0x03 0x26 0x11 0xFF 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0xAF 0x05 0x04 0x41 0x15 0x04 0x03 0x26 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0xAF 0x05 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x8B 0x00 0x1C 0x19 0xAD 0x02 0x03 0xAF 0x05 0x05 0x41 0x8B 0x00 0x1D 0x7A 0x05 0x25 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0x03 0x31 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x2E 0x1B 0x07 0x25 0x11 0x00 0xFF 0x53 0x29 0x04 0x19 0x8B 0x00 0x18 0x29 0x05 0x1B 0x08 0xAD 0x02 0x03 0x16 0x05 0x8D 0x00 0x1E 0x3B 0xAD 0x03 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x03 0x16 0x05 0x8E 0x04 0x00 0x0E 0x01 0x29 0x06 0xAD 0x03 0xAD 0x02 0x03 0x03 0x8E 0x04 0x00 0x0E 0x03 0x31 0x1E 0x61 0x08 0x11 0x91 0x02 0x8D 0x00 0x17 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x05 0x24 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x19 0x8B 0x00 0x18 0x29 0x04 0x1A 0x08 0xAD 0x02 0x03 0x16 0x04 0x8D 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3B 0xAE 0x04 0x61 0x4B 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x01 0x29 0x05 0xAD 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0x11 0xFF 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0x04 0x16 0x05 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0x05 0x8B 0x00 0x1C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0xAD 0x02 0x03 0x05 0x8B 0x00 0x1D 0x18 0x04 0x88 0x04 0x70 0x1A 0x18 0x03 0x88 0x04 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x03 0x61 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x07 0x11 0x91 0x02 0x8D 0x00 0x17 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x96 0x00 0x06 0x00 0x03 0x00 0x03 0x03 0x00 0x03 0x01 0x00 0x01 0x03 0x00 0x40 0xBE 0xDF 0xD3 0x7A 0x08 0xE2 0x9A 0x58 0x27 0x54 0x2A 0x49 0x18 0xCE 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xE4 0x1A 0x60 0xDC 0x62 0x75 0xBD 0xB0 0x8D 0x15 0xA3 0x65 0xE6 0x7B 0xA9 0xDC 0x09 0x11 0x5F 0x9F 0xBF 0x29 0xE6 0xC2 0x82 0xC8 0x35 0x6B 0x0F 0x10 0x9B 0x19 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x62 0xFD 0xBD 0x96 0x49 0x21 0xE4 0x22 0x08 0x08 0x80 0x6C 0xD1 0xDE 0xA6 0xD3 0xC3 0x8F 0x03 0x00 0x40 0x84 0x21 0xFE 0x0B 0xA4 0xCA 0xF9 0x7D 0xBC 0xFC 0x0E 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xA9 0xBB 0x7A 0xBD 0x7D 0x65 0x40 0x2B 0x08 0xC6 0xDF 0xC9 0x4B 0x09 0x6A 0x29 0x3B 0xC2 0x42 0x88 0x23 0x44 0xAF 0x08 0x82 0x4C 0xFF 0x42 0xA4 0xB8 0xD2 0xDA 0x7F; -0x80 0xB4 0x08 0x00 0x19 0xCC 0xEE 0xC5 0x34 0xED 0x71 0x01 0xAB 0x3B 0x76 0xDE 0x6C 0xA2 0xCB 0x7C 0x38 0xB6 0x9A 0x4B 0x28 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x7E 0x00 0x1F 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x04 0x01 0x81 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x03 0x80 0x03 0x01 0x05 0x00 0x00 0x04 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0D 0x03 0x80 0x03 0x02 0x06 0x81 0x0F 0x00 0x01 0x81 0x19 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x81 0x0D 0x00 0x01 0x81 0x09 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0xE3 0x06 0x00 0x01 0x4D 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x9E 0x06 0x80 0x07 0x01 0x03 0x80 0x0A 0x06 0x06 0x80 0x08 0x0F 0x06 0x80 0x03 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x05 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x02 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x63 0x00 0x29 0x2E 0x0F 0x02 0x0F 0x0F 0x0F 0x16 0x0D 0x04 0x64 0x02 0x09 0x05 0x0B 0x02 0x02 0x0F 0x02 0x14 0x08 0x03 0x0A 0x02 0x20 0x09 0x02 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x2B 0x09 0x04 0x02 0x08 0x02 0x0C 0x0E 0x16 0x09 0x06 0x02 0x02 0x00 0x36 0x05 0x0D 0x0C 0x09 0x04 0x0B 0x04 0x07 0x04 0x05 0x06 0x04 0x05 0x06 0x04 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x04 0x05 0x08 0x09 0x04 0x0C 0x07 0x08 0x23 0x07 0x07 0x08 0x07 0x05 0x06 0x0B 0x11 0x28 0x09 0x0B 0x0C 0x07 0x0E 0x0C 0x0C 0x0D 0x0B 0x07 0x0D 0x0C 0x0E 0x7F; -0x80 0xB4 0x09 0x00 0x06 0x0C 0x20 0x06 0x08 0x15 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr deleted file mode 100644 index dc44a7fa..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr +++ /dev/null @@ -1,125 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x1F 0x00 0x7E 0x00 0x0C 0x02 0x24 0x00 0x96 0x00 0x63 0x00 0x00 0x01 0x05 0x00 0x06 0x00 0x03 0x00 0x83 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x95 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0F 0x06 0x00 0x0C 0x00 0x80 0x03 0x06 0x00 0x04 0x07 0x01 0x00 0x00 0x00 0xA3 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x02 0x24 0x00 0x04 0x41 0x18 0x8C 0x00 0x1A 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x07 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0C 0x18 0x07 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x10 0x87 0x00 0x18 0x08 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x06 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0xAD 0x01 0x7B 0x00 0x08 0x03 0x7B 0x00 0x08 0x92 0x8E 0x04 0x00 0x06 0x06 0xAD 0x01 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x06 0x07 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7B 0x00 0x0A 0x03 0x7B 0x00 0x0A 0x92 0x8E 0x04 0x00 0x10 0x06 0xAD 0x00 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x10 0x07 0x18 0x10 0x42 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8D 0x00 0x0B 0x87 0x02 0x18 0x10 0x1E 0x03 0x8D 0x00 0x0D 0x94 0x00 0x00 0x0E 0x87 0x03 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x11 0x3D 0x18 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1E 0x8C 0x00 0x12 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x1A 0x04 0x25 0x73 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x00 0x12 0x00 0x0D 0x00 0x14 0x00 0x1B 0x18 0x19 0x8C 0x00 0x14 0x70 0x16 0x18 0x19 0x8C 0x00 0x15 0x70 0x0F 0x18 0x19 0x8C 0x00 0x16 0x70 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x17 0x7A 0x09 0x23 0x19 0x8B 0x00 0x13 0x2D 0x19 0x8B 0x00 0x18 0x32 0x04 0x05 0x8D 0x00 0x19 0x28 0x04 0xAD 0x03 0xAD 0x01 0x04 0x8E 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x00 0x18 0xAD 0x03 0x1A 0x08 0x1F 0xAD 0x02 0x03 0x15 0x04 0x03 0x8E 0x08 0x00 0x0E 0x02 0x89 0x05 0xAD 0x02 0xAF 0x05 0x15 0x04 0x03 0x26 0x11 0xFF 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0xAF 0x05 0x04 0x41 0x15 0x04 0x03 0x26 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0xAF 0x05 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x8B 0x00 0x1C 0x19 0xAD 0x02 0x03 0xAF 0x05 0x05 0x41 0x8B 0x00 0x1D 0x7A 0x05 0x25 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0x03 0x31 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x2E 0x1B 0x07 0x25 0x11 0x00 0xFF 0x53 0x29 0x04 0x19 0x8B 0x00 0x18 0x29 0x05 0x1B 0x08 0xAD 0x02 0x03 0x16 0x05 0x8D 0x00 0x1E 0x3B 0xAD 0x03 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x03 0x16 0x05 0x8E 0x04 0x00 0x0E 0x01 0x29 0x06 0xAD 0x03 0xAD 0x02 0x03 0x03 0x8E 0x04 0x00 0x0E 0x03 0x31 0x1E 0x61 0x08 0x11 0x91 0x02 0x8D 0x00 0x17 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x05 0x24 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x19 0x8B 0x00 0x18 0x29 0x04 0x1A 0x08 0xAD 0x02 0x03 0x16 0x04 0x8D 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3B 0xAE 0x04 0x61 0x4B 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x01 0x29 0x05 0xAD 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0x11 0xFF 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0x04 0x16 0x05 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0x05 0x8B 0x00 0x1C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0xAD 0x02 0x03 0x05 0x8B 0x00 0x1D 0x18 0x04 0x88 0x04 0x70 0x1A 0x18 0x03 0x88 0x04 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x03 0x61 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x07 0x11 0x91 0x02 0x8D 0x00 0x17 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x96 0x00 0x06 0x00 0x03 0x00 0x03 0x03 0x00 0x03 0x01 0x00 0x01 0x03 0x00 0x40 0xBE 0xDF 0xD3 0x7A 0x08 0xE2 0x9A 0x58 0x27 0x54 0x2A 0x49 0x18 0xCE 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xE4 0x1A 0x60 0xDC 0x62 0x75 0xBD 0xB0 0x8D 0x15 0xA3 0x65 0xE6 0x7B 0xA9 0xDC 0x09 0x11 0x5F 0x9F 0xBF 0x29 0xE6 0xC2 0x82 0xC8 0x35 0x6B 0x0F 0x10 0x9B 0x19 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x62 0xFD 0xBD 0x96 0x49 0x21 0xE4 0x22 0x08 0x08 0x80 0x6C 0xD1 0xDE 0xA6 0xD3 0xC3 0x8F 0x03 0x00 0x40 0x84 0x21 0xFE 0x0B 0xA4 0xCA 0xF9 0x7D 0xBC 0xFC 0x0E 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xA9 0xBB 0x7A 0xBD 0x7D 0x65 0x40 0x2B 0x08 0xC6 0xDF 0xC9 0x4B 0x09 0x6A 0x29 0x3B 0xC2 0x42 0x88 0x23 0x44 0xAF 0x08 0x82 0x4C 0xFF 0x42 0xA4 0xB8 0xD2 0xDA 0x7F; -0x80 0xB4 0x08 0x00 0x19 0xCC 0xEE 0xC5 0x34 0xED 0x71 0x01 0xAB 0x3B 0x76 0xDE 0x6C 0xA2 0xCB 0x7C 0x38 0xB6 0x9A 0x4B 0x28 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x7E 0x00 0x1F 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x04 0x01 0x81 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x03 0x80 0x03 0x01 0x05 0x00 0x00 0x04 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0D 0x03 0x80 0x03 0x02 0x06 0x81 0x0F 0x00 0x01 0x81 0x19 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x81 0x0D 0x00 0x01 0x81 0x09 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0xE3 0x06 0x00 0x01 0x4D 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x9E 0x06 0x80 0x07 0x01 0x03 0x80 0x0A 0x06 0x06 0x80 0x08 0x0F 0x06 0x80 0x03 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x05 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x02 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x63 0x00 0x29 0x2E 0x0F 0x02 0x0F 0x0F 0x0F 0x16 0x0D 0x04 0x64 0x02 0x09 0x05 0x0B 0x02 0x02 0x0F 0x02 0x14 0x08 0x03 0x0A 0x02 0x20 0x09 0x02 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x2B 0x09 0x04 0x02 0x08 0x02 0x0C 0x0E 0x16 0x09 0x06 0x02 0x02 0x00 0x36 0x05 0x0D 0x0C 0x09 0x04 0x0B 0x04 0x07 0x04 0x05 0x06 0x04 0x05 0x06 0x04 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x04 0x05 0x08 0x09 0x04 0x0C 0x07 0x08 0x23 0x07 0x07 0x08 0x07 0x05 0x06 0x0B 0x11 0x28 0x09 0x0B 0x0C 0x07 0x0E 0x0C 0x0C 0x0D 0x0B 0x07 0x0D 0x0C 0x0E 0x7F; -0x80 0xB4 0x09 0x00 0x06 0x0C 0x20 0x06 0x08 0x15 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -// resume printing output during functional test -output on; - -//create applet With AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -echo "creating applet"; -//0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x07 0x01 0x00 0x7F; -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x7F; - -// select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -0x00 0xA4 0x04 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x7F; -//expected 90 00 - -0x80 0x10 0x00 0x00 0x01 0x01 0x7F; -//Sign expected the actual data - -//0x80 0x11 0x00 0x00 0x40 0x41 0xa3 0x79 0x00 0xbd 0xf3 0xd8 0x3c 0xca 0x13 0xd1 0xa9 0x34 0xd7 0xb5 0xcc 0x8e 0xed 0x36 0xa3 0xbc 0x57 0x3e 0xb2 0xb6 0xec 0x77 0xb0 0xcb 0x33 0x4d 0x43 0x1a 0x3f 0x25 0x82 0x64 0x80 0xb1 0x2f 0x98 0xdc 0xa9 0xd8 0x44 0xe9 0x92 0x2c 0x42 0x51 0x9d 0x8c 0x97 0x3e 0x97 0xcd 0x97 0x98 0xd0 0xf0 0x93 0xbb 0x93 0xf3 0x7F; -//Verify expected 90 00 - -0x80 0x11 0x00 0x00 0x40 0xa3 0x49 0x1d 0x51 0x55 0x05 0x49 0x71 0xba 0xdc 0x77 0x22 0xce 0x9a 0x51 0x71 0xf8 0xb1 0x88 0x8d 0x55 0x05 0xd5 0x2b 0xae 0xf6 0xb7 0x04 0xd9 0x1d 0x09 0x35 0x17 0xec 0x73 0x11 0xd5 0x7f 0xfd 0xeb 0xb3 0xd9 0x98 0x45 0xf7 0x8a 0xb6 0x72 0x21 0x44 0xa1 0x32 0xb3 0xa1 0xce 0x72 0xc5 0x6d 0xcc 0xee 0x18 0x64 0x2e 0x76 0x7F; - -powerdown; - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr.expected.out deleted file mode 100644 index e66fe9fd..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgFullRec.scr.expected.out +++ /dev/null @@ -1,9 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -creating applet -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 01, 01, Le: 42, a3, 49, 1d, 51, 55, 05, 49, 71, ba, dc, 77, 22, ce, 9a, 51, 71, f8, b1, 88, 8d, 55, 05, d5, 2b, ae, f6, b7, 04, d9, 1d, 09, 35, 17, ec, 73, 11, d5, 7f, fd, eb, b3, d9, 98, 45, f7, 8a, b6, 72, 21, 44, a1, 32, b3, a1, ce, 72, c5, 6d, cc, ee, 18, 64, 2e, 76, 00, 01, SW1: 90, SW2: 00 -CLA: 80, INS: 11, P1: 00, P2: 00, Lc: 40, a3, 49, 1d, 51, 55, 05, 49, 71, ba, dc, 77, 22, ce, 9a, 51, 71, f8, b1, 88, 8d, 55, 05, d5, 2b, ae, f6, b7, 04, d9, 1d, 09, 35, 17, ec, 73, 11, d5, 7f, fd, eb, b3, d9, 98, 45, f7, 8a, b6, 72, 21, 44, a1, 32, b3, a1, ce, 72, c5, 6d, cc, ee, 18, 64, 2e, 76, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr deleted file mode 100644 index 2c1efe1b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr +++ /dev/null @@ -1,129 +0,0 @@ - -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)Header.scr 1.9 -// Version:1.9 -// Date:01/04/06 -//- - -powerup; - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Turn output off during CAP file download -echo "CAP file download section. Output suppressed."; - -output off; - -0x80 0xB0 0x00 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Header.cap -0x80 0xB2 0x01 0x00 0x00 0x7F; -0x80 0xB4 0x01 0x00 0x16 0x01 0x00 0x13 0xDE 0xCA 0xFF 0xED 0x01 0x02 0x04 0x00 0x01 0x09 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x7F; -0x80 0xBC 0x01 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Directory.cap -0x80 0xB2 0x02 0x00 0x00 0x7F; -0x80 0xB4 0x02 0x00 0x20 0x02 0x00 0x1F 0x00 0x13 0x00 0x1F 0x00 0x0E 0x00 0x1F 0x00 0x7E 0x00 0x0C 0x02 0x24 0x00 0x96 0x00 0x63 0x00 0x00 0x01 0x05 0x00 0x06 0x00 0x03 0x00 0x83 0x03 0x7F; -0x80 0xB4 0x02 0x00 0x02 0x01 0x00 0x7F; -0x80 0xBC 0x02 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Import.cap -0x80 0xB2 0x04 0x00 0x00 0x7F; -0x80 0xB4 0x04 0x00 0x20 0x04 0x00 0x1F 0x03 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x01 0x03 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x01 0x02 0x00 0x01 0x07 0xA0 0x00 0x00 0x00 0x62 0x7F; -0x80 0xB4 0x04 0x00 0x02 0x00 0x01 0x7F; -0x80 0xBC 0x04 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Applet.cap -0x80 0xB2 0x03 0x00 0x00 0x7F; -0x80 0xB4 0x03 0x00 0x11 0x03 0x00 0x0E 0x01 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x95 0x7F; -0x80 0xBC 0x03 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Class.cap -0x80 0xB2 0x06 0x00 0x00 0x7F; -0x80 0xB4 0x06 0x00 0x0F 0x06 0x00 0x0C 0x00 0x80 0x03 0x06 0x00 0x04 0x07 0x01 0x00 0x00 0x00 0xA3 0x7F; -0x80 0xBC 0x06 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/Method.cap -0x80 0xB2 0x07 0x00 0x00 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x07 0x02 0x24 0x00 0x04 0x41 0x18 0x8C 0x00 0x1A 0x19 0x1E 0x25 0x29 0x04 0x16 0x04 0x61 0x08 0x18 0x8B 0x00 0x07 0x70 0x0C 0x18 0x19 0x1E 0x04 0x41 0x16 0x04 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x8B 0x00 0x0C 0x18 0x07 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x10 0x87 0x00 0x18 0x08 0x11 0x02 0x00 0x03 0x8D 0x00 0x0F 0x94 0x00 0x00 0x06 0x87 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x01 0xAD 0x01 0x7B 0x00 0x08 0x03 0x7B 0x00 0x08 0x92 0x8E 0x04 0x00 0x06 0x06 0xAD 0x01 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x06 0x07 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x7B 0x00 0x0A 0x03 0x7B 0x00 0x0A 0x92 0x8E 0x04 0x00 0x10 0x06 0xAD 0x00 0x7B 0x00 0x09 0x03 0x7B 0x00 0x09 0x92 0x8E 0x04 0x00 0x10 0x07 0x18 0x10 0x42 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x05 0x8D 0x00 0x0B 0x87 0x02 0x18 0x10 0x1E 0x03 0x8D 0x00 0x0D 0x94 0x00 0x00 0x0E 0x87 0x03 0x18 0x03 0x88 0x04 0x7A 0x05 0x30 0x8F 0x00 0x11 0x3D 0x18 0x1D 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x1E 0x8C 0x00 0x12 0x3B 0x7A 0x02 0x21 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x03 0x25 0x61 0x0A 0x1A 0x04 0x25 0x10 0xA4 0x6B 0x03 0x7A 0x1A 0x04 0x25 0x73 0x00 0x22 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x10 0x00 0x12 0x00 0x0D 0x00 0x14 0x00 0x1B 0x18 0x19 0x8C 0x00 0x14 0x70 0x16 0x18 0x19 0x8C 0x00 0x15 0x70 0x0F 0x18 0x19 0x8C 0x00 0x16 0x70 0x08 0x11 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x6D 0x00 0x8D 0x00 0x17 0x7A 0x09 0x23 0x19 0x8B 0x00 0x13 0x2D 0x19 0x8B 0x00 0x18 0x32 0x04 0x05 0x8D 0x00 0x19 0x28 0x04 0xAD 0x03 0xAD 0x01 0x04 0x8E 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x0E 0x00 0x18 0xAD 0x03 0x1A 0x08 0x1F 0xAD 0x02 0x03 0x15 0x04 0x03 0x8E 0x08 0x00 0x0E 0x02 0x89 0x05 0xAD 0x02 0xAF 0x05 0x15 0x04 0x03 0x26 0x11 0xFF 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0xAF 0x05 0x04 0x41 0x15 0x04 0x03 0x26 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0xAF 0x05 0x05 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x41 0x8B 0x00 0x1C 0x19 0xAD 0x02 0x03 0xAF 0x05 0x05 0x41 0x8B 0x00 0x1D 0x7A 0x05 0x25 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0x03 0x31 0x19 0x8B 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x00 0x13 0x2E 0x1B 0x07 0x25 0x11 0x00 0xFF 0x53 0x29 0x04 0x19 0x8B 0x00 0x18 0x29 0x05 0x1B 0x08 0xAD 0x02 0x03 0x16 0x05 0x8D 0x00 0x1E 0x3B 0xAD 0x03 0xAD 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x02 0x03 0x16 0x05 0x8E 0x04 0x00 0x0E 0x01 0x29 0x06 0xAD 0x03 0xAD 0x02 0x03 0x03 0x8E 0x04 0x00 0x0E 0x03 0x31 0x1E 0x61 0x08 0x11 0x91 0x02 0x8D 0x00 0x17 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x7A 0x05 0x24 0x19 0x8B 0x00 0x13 0x2D 0x1A 0x07 0x25 0x11 0x00 0xFF 0x53 0x32 0x19 0x8B 0x00 0x18 0x29 0x04 0x1A 0x08 0xAD 0x02 0x03 0x16 0x04 0x8D 0x00 0x1E 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x3B 0xAE 0x04 0x61 0x4B 0xAD 0x03 0xAD 0x00 0x05 0x8E 0x03 0x00 0x0E 0x00 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x01 0x29 0x05 0xAD 0x02 0x03 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x16 0x05 0x11 0xFF 0x00 0x53 0x10 0x08 0x4F 0x5B 0x38 0xAD 0x02 0x04 0x16 0x05 0x11 0x00 0xFF 0x53 0x5B 0x38 0x19 0x8B 0x00 0x1B 0x3B 0x19 0x05 0x8B 0x00 0x1C 0x7F; -0x80 0xB4 0x07 0x00 0x20 0x19 0xAD 0x02 0x03 0x05 0x8B 0x00 0x1D 0x18 0x04 0x88 0x04 0x70 0x1A 0x18 0x03 0x88 0x04 0xAD 0x03 0xAD 0x02 0x03 0x16 0x04 0x8E 0x04 0x00 0x0E 0x03 0x61 0x08 0x7F; -0x80 0xB4 0x07 0x00 0x07 0x11 0x91 0x02 0x8D 0x00 0x17 0x7A 0x7F; -0x80 0xBC 0x07 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/StaticField.cap -0x80 0xB2 0x08 0x00 0x00 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x08 0x00 0x96 0x00 0x06 0x00 0x03 0x00 0x03 0x03 0x00 0x03 0x01 0x00 0x01 0x03 0x00 0x40 0xBE 0xDF 0xD3 0x7A 0x08 0xE2 0x9A 0x58 0x27 0x54 0x2A 0x49 0x18 0xCE 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xE4 0x1A 0x60 0xDC 0x62 0x75 0xBD 0xB0 0x8D 0x15 0xA3 0x65 0xE6 0x7B 0xA9 0xDC 0x09 0x11 0x5F 0x9F 0xBF 0x29 0xE6 0xC2 0x82 0xC8 0x35 0x6B 0x0F 0x10 0x9B 0x19 0x7F; -0x80 0xB4 0x08 0x00 0x20 0x62 0xFD 0xBD 0x96 0x49 0x21 0xE4 0x22 0x08 0x08 0x80 0x6C 0xD1 0xDE 0xA6 0xD3 0xC3 0x8F 0x03 0x00 0x40 0x84 0x21 0xFE 0x0B 0xA4 0xCA 0xF9 0x7D 0xBC 0xFC 0x0E 0x7F; -0x80 0xB4 0x08 0x00 0x20 0xA9 0xBB 0x7A 0xBD 0x7D 0x65 0x40 0x2B 0x08 0xC6 0xDF 0xC9 0x4B 0x09 0x6A 0x29 0x3B 0xC2 0x42 0x88 0x23 0x44 0xAF 0x08 0x82 0x4C 0xFF 0x42 0xA4 0xB8 0xD2 0xDA 0x7F; -0x80 0xB4 0x08 0x00 0x19 0xCC 0xEE 0xC5 0x34 0xED 0x71 0x01 0xAB 0x3B 0x76 0xDE 0x6C 0xA2 0xCB 0x7C 0x38 0xB6 0x9A 0x4B 0x28 0x01 0x00 0x00 0x00 0x00 0x7F; -0x80 0xBC 0x08 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/ConstantPool.cap -0x80 0xB2 0x05 0x00 0x00 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x05 0x00 0x7E 0x00 0x1F 0x02 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x02 0x00 0x00 0x03 0x02 0x00 0x00 0x02 0x02 0x00 0x00 0x05 0x02 0x00 0x00 0x04 0x01 0x81 0x08 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x03 0x80 0x03 0x01 0x05 0x00 0x00 0x04 0x05 0x00 0x00 0x02 0x05 0x00 0x00 0x00 0x06 0x80 0x08 0x0D 0x03 0x80 0x03 0x02 0x06 0x81 0x0F 0x00 0x01 0x81 0x19 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x00 0x06 0x81 0x0D 0x00 0x01 0x81 0x09 0x00 0x01 0x00 0x00 0x00 0x06 0x00 0x00 0x01 0x03 0x80 0x0A 0x01 0x06 0x00 0x00 0xE3 0x06 0x00 0x01 0x4D 0x06 0x00 0x01 0x7F; -0x80 0xB4 0x05 0x00 0x20 0x9E 0x06 0x80 0x07 0x01 0x03 0x80 0x0A 0x06 0x06 0x80 0x08 0x0F 0x06 0x80 0x03 0x00 0x03 0x80 0x0A 0x07 0x03 0x80 0x0A 0x09 0x03 0x80 0x0A 0x05 0x06 0x80 0x10 0x7F; -0x80 0xB4 0x05 0x00 0x01 0x02 0x7F; -0x80 0xBC 0x05 0x00 0x00 0x7F; - -// com/sun/javacard/samples/sigMsgRec/javacard/RefLocation.cap -0x80 0xB2 0x09 0x00 0x00 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x09 0x00 0x63 0x00 0x29 0x2E 0x0F 0x02 0x0F 0x0F 0x0F 0x16 0x0D 0x04 0x64 0x02 0x09 0x05 0x0B 0x02 0x02 0x0F 0x02 0x14 0x08 0x03 0x0A 0x02 0x20 0x09 0x02 0x0C 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x02 0x2B 0x09 0x04 0x02 0x08 0x02 0x0C 0x0E 0x16 0x09 0x06 0x02 0x02 0x00 0x36 0x05 0x0D 0x0C 0x09 0x04 0x0B 0x04 0x07 0x04 0x05 0x06 0x04 0x05 0x06 0x04 0x05 0x7F; -0x80 0xB4 0x09 0x00 0x20 0x06 0x04 0x05 0x08 0x09 0x04 0x0C 0x07 0x08 0x23 0x07 0x07 0x08 0x07 0x05 0x06 0x0B 0x11 0x28 0x09 0x0B 0x0C 0x07 0x0E 0x0C 0x0C 0x0D 0x0B 0x07 0x0D 0x0C 0x0E 0x7F; -0x80 0xB4 0x09 0x00 0x06 0x0C 0x20 0x06 0x08 0x15 0x09 0x7F; -0x80 0xBC 0x09 0x00 0x00 0x7F; - -0x80 0xBA 0x00 0x00 0x00 0x7F; -// resume printing output during functional test -output on; - -//create applet With AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -echo "creating applet"; -//0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x07 0x01 0x00 0x7F; -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x7F; - -// select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -0x00 0xA4 0x04 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x7F; -//expected 90 00 - -//send data 70 bytes -0x80 0x10 0x00 0x00 0x46 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x7F; -//Signature data expected. Last two bytes is the size of recoverable data. expected 42 bytes - -//verify stage. send in signature -0x80 0x12 0x00 0x00 0x40 0x2d 0x15 0x79 0x89 0xba 0x71 0x6d 0x31 0x6c 0x0e 0x29 0x55 0xc0 0x0e 0x80 0xc3 0x5c 0xa3 0xe8 0xa1 0x12 0x65 0xe3 0x6f 0xb2 0x51 0x44 0x7d 0x30 0x4a 0x24 0xcf 0xa1 0x1b 0xaa 0x30 0x48 0xd3 0x70 0x4a 0x0b 0xe7 0x9a 0x05 0x1f 0x5f 0x87 0xc7 0x8f 0xe4 0xae 0xbc 0xde 0x0a 0x63 0x6a 0x28 0x48 0x52 0xc0 0xe7 0xd2 0x7f 0xfe 0x7f; -//expected output, the length of recoverable message. 0x2e - -//complete signature verification by sending in non-recoverable part of message -0x80 0x12 0x00 0x00 0x1c 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x7f; -//expected success 90 00 - - - -powerdown; - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr.expected.out deleted file mode 100644 index 49c6bb7c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/sigMsgPartRec.scr.expected.out +++ /dev/null @@ -1,10 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -creating applet -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0c, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, 00, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, SW1: 90, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0c, 01, Le: 00, SW1: 90, SW2: 00 -CLA: 80, INS: 10, P1: 00, P2: 00, Lc: 46, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f, 40, 41, 42, 43, 44, 45, 46, Le: 42, 2d, 15, 79, 89, ba, 71, 6d, 31, 6c, 0e, 29, 55, c0, 0e, 80, c3, 5c, a3, e8, a1, 12, 65, e3, 6f, b2, 51, 44, 7d, 30, 4a, 24, cf, a1, 1b, aa, 30, 48, d3, 70, 4a, 0b, e7, 9a, 05, 1f, 5f, 87, c7, 8f, e4, ae, bc, de, 0a, 63, 6a, 28, 48, 52, c0, e7, d2, 7f, fe, 00, 2a, SW1: 90, SW2: 00 -CLA: 80, INS: 12, P1: 00, P2: 00, Lc: 40, 2d, 15, 79, 89, ba, 71, 6d, 31, 6c, 0e, 29, 55, c0, 0e, 80, c3, 5c, a3, e8, a1, 12, 65, e3, 6f, b2, 51, 44, 7d, 30, 4a, 24, cf, a1, 1b, aa, 30, 48, d3, 70, 4a, 0b, e7, 9a, 05, 1f, 5f, 87, c7, 8f, e4, ae, bc, de, 0a, 63, 6a, 28, 48, 52, c0, e7, d2, 7f, fe, Le: 02, 00, 2a, SW1: 90, SW2: 00 -CLA: 80, INS: 12, P1: 00, P2: 00, Lc: 1c, 2b, 2c, 2d, 2e, 2f, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f, 40, 41, 42, 43, 44, 45, 46, Le: 00, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndFullRec.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndFullRec.scr deleted file mode 100644 index 3375cc00..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndFullRec.scr +++ /dev/null @@ -1,21 +0,0 @@ -// resume printing output during functional test -output on; - -//create applet With AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -echo "creating applet"; -//0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x07 0x01 0x00 0x7F; -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x7F; - -// select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -0x00 0xA4 0x04 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x7F; -//expected 90 00 - -0x80 0x10 0x00 0x00 0x01 0x01 0x7F; -//Sign expected the actual data - -//0x80 0x11 0x00 0x00 0x40 0x41 0xa3 0x79 0x00 0xbd 0xf3 0xd8 0x3c 0xca 0x13 0xd1 0xa9 0x34 0xd7 0xb5 0xcc 0x8e 0xed 0x36 0xa3 0xbc 0x57 0x3e 0xb2 0xb6 0xec 0x77 0xb0 0xcb 0x33 0x4d 0x43 0x1a 0x3f 0x25 0x82 0x64 0x80 0xb1 0x2f 0x98 0xdc 0xa9 0xd8 0x44 0xe9 0x92 0x2c 0x42 0x51 0x9d 0x8c 0x97 0x3e 0x97 0xcd 0x97 0x98 0xd0 0xf0 0x93 0xbb 0x93 0xf3 0x7F; -//Verify expected 90 00 - -0x80 0x11 0x00 0x00 0x40 0xa3 0x49 0x1d 0x51 0x55 0x05 0x49 0x71 0xba 0xdc 0x77 0x22 0xce 0x9a 0x51 0x71 0xf8 0xb1 0x88 0x8d 0x55 0x05 0xd5 0x2b 0xae 0xf6 0xb7 0x04 0xd9 0x1d 0x09 0x35 0x17 0xec 0x73 0x11 0xd5 0x7f 0xfd 0xeb 0xb3 0xd9 0x98 0x45 0xf7 0x8a 0xb6 0x72 0x21 0x44 0xa1 0x32 0xb3 0xa1 0xce 0x72 0xc5 0x6d 0xcc 0xee 0x18 0x64 0x2e 0x76 0x7F; - -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndPartRec.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndPartRec.scr deleted file mode 100644 index 05410bad..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/sigMsgRec/signAndPartRec.scr +++ /dev/null @@ -1,25 +0,0 @@ -// resume printing output during functional test -output on; - -//create applet With AID 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -echo "creating applet"; -//0x80 0xB8 0x00 0x00 0x0D 0x0B 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x07 0x07 0x01 0x00 0x7F; -0x80 0xB8 0x00 0x00 0x0C 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x00 0x7F; - -// select applet 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 -0x00 0xA4 0x04 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x0C 0x01 0x7F; -//expected 90 00 - -//send data 70 bytes -0x80 0x10 0x00 0x00 0x46 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x7F; -//Signature data expected. Last two bytes is the size of recoverable data. expected 42 bytes - -//verify stage. send in signature -0x80 0x12 0x00 0x00 0x40 0x2d 0x15 0x79 0x89 0xba 0x71 0x6d 0x31 0x6c 0x0e 0x29 0x55 0xc0 0x0e 0x80 0xc3 0x5c 0xa3 0xe8 0xa1 0x12 0x65 0xe3 0x6f 0xb2 0x51 0x44 0x7d 0x30 0x4a 0x24 0xcf 0xa1 0x1b 0xaa 0x30 0x48 0xd3 0x70 0x4a 0x0b 0xe7 0x9a 0x05 0x1f 0x5f 0x87 0xc7 0x8f 0xe4 0xae 0xbc 0xde 0x0a 0x63 0x6a 0x28 0x48 0x52 0xc0 0xe7 0xd2 0x7f 0xfe 0x7f; -//expected output, the length of recoverable message. 0x2e - -//complete signature verification by sending in non-recoverable part of message -0x80 0x12 0x00 0x00 0x1c 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x7f; -//expected success 90 00 - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/POSTerminal.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/POSTerminal.bat deleted file mode 100644 index b5ce9937..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/POSTerminal.bat +++ /dev/null @@ -1,35 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -@echo on -@echo This demo requires a cref with com.sun.javacard.samples.transit applet -@echo installed - -@echo Start cref before running this demo -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - - -set JC_RMICPATH=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\base-core.jar;%JC_HOME%\lib\base-opt.jar;%JC_HOME%\lib\jcrmiclientframework.jar;%JC_HOME%\lib\jcclientsamples.jar;%JC_HOME%\lib\apduio.jar;%JC_HOME%\samples\classes - -%JAVA_HOME%\bin\java -classpath %JC_RMICPATH%;%CLASSPATH% com.sun.javacard.clientsamples.transit.POSTerminal %1 %2 %3 %4 %5 %6 %7 %8 %9 - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.bat deleted file mode 100644 index 4396614d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.bat +++ /dev/null @@ -1,56 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - -@echo Issue the transit card (Initialize the transit card: load and create the transit applet) - -start /B %JC_HOME%\bin\cref -o TransitCard >&2 - -if "%1" == "-n" goto notransientkey -call %JC_HOME%\bin\apdutool TransitDemo-TransientKey.scr -goto continue -:notransientkey -call %JC_HOME%\bin\apdutool TransitDemo-NoTransientKey.scr - -:continue - -@echo Credit the transit card account at a POS terminal -start /B %JC_HOME%\bin\cref -i TransitCard -o TransitCard >&2 -call POSTerminal.bat -k FFFFFFFFFFFFFFFF -- VERIFY 12345 CREDIT 99 GET_BALANCE - -@echo Enter the transit system -start /B %JC_HOME%\bin\cref -i TransitCard -o TransitCard >&2 -call TransitTerminal.bat -k FFFFFFFFFFFFFFFF -- PROCESS_ENTRY 999 - -@echo Exit the transit system -start /B %JC_HOME%\bin\cref -i TransitCard -o TransitCard >&2 -call TransitTerminal.bat -k FFFFFFFFFFFFFFFF -- PROCESS_EXIT 10 - -@echo Check the balance at a POS termminal -start /B %JC_HOME%\bin\cref -i TransitCard -o TransitCard >&2 -call POSTerminal.bat -k FFFFFFFFFFFFFFFF -- VERIFY 12345 GET_BALANCE - -del /f TransitCard TransitCard - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.expected.out deleted file mode 100644 index 8df97fcc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemo.expected.out +++ /dev/null @@ -1,48 +0,0 @@ -Issue the transit card (Initialize the transit card: load and create the transit applet) -Java Card 2.2.2 APDU Tool, Version 1.3 -Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -Opening connection to localhost on port 9025. -Connected. -Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x01 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -Credit the transit card account at a POS terminal -This demo requires a cref with com.sun.javacard.samples.transit applet -installed -Start cref before running this demo -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 90, SW2: 00 -OK -CLA: 00, INS: 20, P1: 00, P2: 00, Lc: 05, 31, 32, 33, 34, 35, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 00, Lc: 05, 31, 32, 33, 34, 35, Le: 00, SW1: 90, SW2: 00 -OK -credit: [99] => OK -getBalance: [] => [ 99 ] -Enter the transit system -This demo requires a cref with com.sun.javacard.samples.transit applet -installed -Start cref before running this demo -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 90, SW2: 00 -OK -processEntry: [999] => [ TOTOBOZO, 21583] -Exit the transit system -This demo requires a cref with com.sun.javacard.samples.transit applet -installed -Start cref before running this demo -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 90, SW2: 00 -OK -processEntry: [10] => [ TOTOBOZO, 21583] -Check the balance at a POS termminal -This demo requires a cref with com.sun.javacard.samples.transit applet -installed -Start cref before running this demo -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 0d, 01, Le: 00, SW1: 90, SW2: 00 -OK -CLA: 00, INS: 20, P1: 00, P2: 00, Lc: 05, 31, 32, 33, 34, 35, Le: 00, SW1: 00, SW2: 00 -CLA: 00, INS: 20, P1: 00, P2: 00, Lc: 05, 31, 32, 33, 34, 35, Le: 00, SW1: 90, SW2: 00 -OK -getBalance: [] => [ 89 ] diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-NoTransientKey.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-NoTransientKey.scr deleted file mode 100644 index 636b694b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-NoTransientKey.scr +++ /dev/null @@ -1,41 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)TransitDemoFooter.scr 1.3 -// Version:1.3 -// Date:01/04/06 -//- - -///////////////////////////////////////////////////////////////////// -// This is a sample input file used by the jp.bat file. -// -// Comments lines begin with "//". -// Non-comment lines are C-APDUs represented by hex digits. -// -// Beneath each C-APDU is a comment the corresponding R-APDU expected to be returned -// by the card. -// -// Compare the expected with the actual APDUs to verify correct behavior. -///////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////// -// Select all installed Applets -///////////////////////////////////////////////////////////////////// - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Create transit applet -// AID=0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0xD 0x1 -// UID=0x54 0x4F 0x54 0x4F 0x42 0x4F 0x5A 0x4F // TOTOBOZO -// Static DES Key=0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF -// Use A Transient Key=0x00 // zero = do not use a transient key, - // non-zero = use a transient key -// PIN=0x31 0x32 0x33 0x34 0x35 // 12345 -0x80 0xB8 0x00 0x00 0x25 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0xD 0x1 0x19 0x0 0x0 0x16 0x54 0x4F 0x54 0x4F 0x42 0x4F 0x5A 0x4F 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x31 0x32 0x33 0x34 0x35 0x7F; - -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-TransientKey.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-TransientKey.scr deleted file mode 100644 index b8c622b2..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitDemoFooter-TransientKey.scr +++ /dev/null @@ -1,41 +0,0 @@ -//+ -// Copyright 2005 Sun Microsystems, Inc. All rights reserved. -// SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -//- - -//+ -// Workfile:@(#)TransitDemoFooter.scr 1.3 -// Version:1.3 -// Date:01/04/06 -//- - -///////////////////////////////////////////////////////////////////// -// This is a sample input file used by the jp.bat file. -// -// Comments lines begin with "//". -// Non-comment lines are C-APDUs represented by hex digits. -// -// Beneath each C-APDU is a comment the corresponding R-APDU expected to be returned -// by the card. -// -// Compare the expected with the actual APDUs to verify correct behavior. -///////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////// -// Select all installed Applets -///////////////////////////////////////////////////////////////////// - -// Select the installer applet -0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -// Create transit applet -// AID=0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0xD 0x1 -// UID=0x54 0x4F 0x54 0x4F 0x42 0x4F 0x5A 0x4F // TOTOBOZO -// Static DES Key=0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF -// Use A Transient Key=0x01 // zero = do not use a transient key, - // non-zero = use a transient key -// PIN=0x31 0x32 0x33 0x34 0x35 // 12345 -0x80 0xB8 0x00 0x00 0x25 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0xD 0x1 0x19 0x0 0x0 0x16 0x54 0x4F 0x54 0x4F 0x42 0x4F 0x5A 0x4F 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01 0x31 0x32 0x33 0x34 0x35 0x7F; - -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitTerminal.bat b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitTerminal.bat deleted file mode 100644 index e355f7c0..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/transit/TransitTerminal.bat +++ /dev/null @@ -1,35 +0,0 @@ -@echo off -REM -REM Copyright 2005 Sun Microsystems, Inc. All rights reserved. -REM Use is subject to license terms. -REM - -@echo on -@echo This demo requires a cref with com.sun.javacard.samples.transit applet -@echo installed - -@echo Start cref before running this demo -@echo off - -setlocal - - if "%JAVA_HOME%" == "" goto warning1 - if "%JC_HOME%" == "" goto warning2 - - -set JC_RMICPATH=%JC_HOME%\lib\apduio.jar;%JC_HOME%\lib\base-core.jar;%JC_HOME%\lib\base-opt.jar;%JC_HOME%\lib\jcrmiclientframework.jar;%JC_HOME%\lib\jcclientsamples.jar;%JC_HOME%\lib\apduio.jar;%JC_HOME%\samples\classes - -%JAVA_HOME%\bin\java -classpath %JC_RMICPATH%;%CLASSPATH% com.sun.javacard.clientsamples.transit.TransitTerminal %1 %2 %3 %4 %5 %6 %7 %8 %9 - - goto quit - -:warning1 - echo Set environment variable JAVA_HOME - goto quit - -:warning2 - echo Set environment variable JC_HOME - goto quit - -:quit - endlocal diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/UtilityDemoFooter.scr b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/UtilityDemoFooter.scr deleted file mode 100644 index 020478d3..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/UtilityDemoFooter.scr +++ /dev/null @@ -1,82 +0,0 @@ -// resume printing output during functional test -output on; - -//create BrokerApplet instance -0x80 0xB8 0x00 0x00 0x12 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x10 0x01 0x06 0x00 0x00 0x03 0x01 0x02 0x03 0x7F; - -echo "******************* Select applet"; -0x00 0xa4 0x04 0x00 0x0A 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x10 0x01 0x7F; -// 90 00 = SW_NO_ERROR - -echo "******************* Verify PIN; 1 2 3"; -0x00 0x20 0x00 0x00 0x03 0x1 0x02 0x03 0x7F; -// 90 00 = SW_NO_ERROR - -echo "******************* get portfolio"; -0x80 0x01 0x00 0x00 0x00 0x7F; -// 61 00 00 00 = Empty portfolio - -echo "******************* Buy stock"; -0x80 0x03 0x00 0x00 0x0B 0x41 0x41 0x41 0x41 0x41 0x00 0x00 0x00 0x10 0x00 0x02 0x7F; -// get back a stock purchase request TLV for broker -// e4 1b c8 05 41 41 41 41 41 ca 02 00 02 c9 04 00 00 00 10 cb 08 88 88 88 88 88 88 88 88 90 00 -// |-- stock symbol-- | | -price- | |-num. stocks - | | - dummy broker signature -| - -echo "******************* Update portfolio with stocks bought"; -0x80 0x05 0x00 0x00 0x1D 0xE6 0x1B 0xC8 0x05 0x41 0x41 0x41 0x41 0x41 0xCA 0x02 0x00 0x02 0xC9 0x04 0x00 0x00 0x00 0x10 0xCB 0x08 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x7F; -// 90 00 = SW_NO_ERROR - -echo "******************* get portfolio"; -0x80 0x01 0x00 0x00 0x00 0x7F; -// get complete portfolio - -echo "******************* get stock Information"; -0x80 0x02 0x00 0x00 0x05 0x41 0x41 0x41 0x41 0x41 0x7F; -// get stock information including symbol, number of stocks, and last trade information - -echo "******************* Buy stock"; -0x80 0x03 0x00 0x00 0x0B 0x42 0x42 0x42 0x42 0x42 0x00 0x00 0x00 0x20 0x00 0x03 0x7F; -// get back a stock purchase request TLV for broker -// e4 1b C8 05 42 42 42 42 42 ca 02 00 03 c9 04 00 00 00 20 cb 08 88 88 88 88 88 88 88 88 90 00 -// |-- stock symbol-- | | -price- | |-num. stocks - | | - dummy broker signature -| - -echo "******************* Update portfolio with stocks bought"; -0x80 0x05 0x00 0x00 0x1D 0xE6 0x1B 0xC8 0x05 0x42 0x42 0x42 0x42 0x42 0xCA 0x02 0x00 0x03 0xC9 0x04 0x00 0x00 0x00 0x20 0xCB 0x08 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x7F; -// 90 00 = SW_NO_ERROR - -echo "******************* sell stock"; -0x80 0x04 0x00 0x00 0x0B 0x41 0x41 0x41 0x41 0x41 0x00 0x00 0x00 0x05 0x00 0x02 0x7F; -// get back a sell stock request TLV for broker -// e3 1b C8 05 41 41 41 41 41 ca 02 00 02 c9 04 00 00 00 05 cb 08 88 88 88 88 88 88 88 88 90 00 -// |-- stock symbol-- | | -price- | |-num. stocks - | | - dummy broker signature -| - - -echo "******************* Update portfolio with stocks sold"; -0x80 0x05 0x00 0x00 0x1D 0x65 0x1B 0xC8 0x05 0x41 0x41 0x41 0x41 0x41 0xCA 0x02 0x00 0x02 0xC9 0x04 0x00 0x00 0x00 0x05 0xCB 0x08 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x88 0x7F; -// 90 00 = SW_NO_ERROR - -echo "******************* get portfolio"; -0x80 0x01 0x00 0x00 0x00 0x7F; -// get complete portfolio - -echo "******************* get stock Information"; -0x80 0x02 0x00 0x00 0x05 0x41 0x41 0x41 0x41 0x41 0x7F; -// get stock information including symbol, number of stocks, and last trade information - -echo "******************* get stock Information for a stock that doesn't exist"; -0x80 0x02 0x00 0x00 0x05 0x42 0x41 0x41 0x41 0x43 0x7F; -// 63 01 = SW_STOCK_NOT_FOUND - -echo "******************* Try to sell more stock than we hold"; -0x80 0x04 0x00 0x00 0x0B 0x41 0x41 0x41 0x41 0x41 0x00 0x00 0x00 0x55 0x00 0x02 0x7F; -// 63 03 = SW_NOT_ENOUGH_STOCKS_TO_SELL - -echo "******************* get Balance in BCD"; -0x80 0x06 0x01 0x00 0x00 0x7F; -// balance in BCD - -echo "******************* get Balance in HEX"; -0x80 0x06 0x02 0x00 0x00 0x7F; -// balance in HEX - -powerdown; diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/utilitydemo.scr.expected.out b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/utilitydemo.scr.expected.out deleted file mode 100644 index 3b29caaf..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src/demo/utilitydemo/utilitydemo.scr.expected.out +++ /dev/null @@ -1,39 +0,0 @@ -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00 -CAP file download section. Output suppressed. -OUTPUT OFF; -OUTPUT ON; -CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 12, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 10, 01, 06, 00, 00, 03, 01, 02, 03, Le: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 10, 01, SW1: 90, SW2: 00 -******************* Select applet -CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 10, 01, Le: 00, SW1: 90, SW2: 00 -******************* Verify PIN; 1 2 3 -CLA: 00, INS: 20, P1: 00, P2: 00, Lc: 03, 01, 02, 03, Le: 00, SW1: 90, SW2: 00 -******************* get portfolio -CLA: 80, INS: 01, P1: 00, P2: 00, Lc: 00, Le: 02, e1, 00, SW1: 90, SW2: 00 -******************* Buy stock -CLA: 80, INS: 03, P1: 00, P2: 00, Lc: 0b, 41, 41, 41, 41, 41, 00, 00, 00, 10, 00, 02, Le: 1d, e4, 1b, c8, 05, 41, 41, 41, 41, 41, ca, 02, 00, 02, c9, 04, 00, 00, 00, 10, cb, 08, 88, 88, 88, 88, 88, 88, 88, 88, SW1: 90, SW2: 00 -******************* Update portfolio with stocks bought -CLA: 80, INS: 05, P1: 00, P2: 00, Lc: 1d, e6, 1b, c8, 05, 41, 41, 41, 41, 41, ca, 02, 00, 02, c9, 04, 00, 00, 00, 10, cb, 08, 88, 88, 88, 88, 88, 88, 88, 88, Le: 00, SW1: 90, SW2: 00 -******************* get portfolio -CLA: 80, INS: 01, P1: 00, P2: 00, Lc: 00, Le: 1d, e1, 1b, e2, 19, c8, 05, 41, 41, 41, 41, 41, c9, 04, 00, 00, 00, 10, e7, 0a, c9, 04, 00, 00, 00, 10, ca, 02, 00, 02, SW1: 90, SW2: 00 -******************* get stock Information -CLA: 80, INS: 02, P1: 00, P2: 00, Lc: 05, 41, 41, 41, 41, 41, Le: 1b, e2, 19, c8, 05, 41, 41, 41, 41, 41, c9, 04, 00, 00, 00, 10, e7, 0a, c9, 04, 00, 00, 00, 10, ca, 02, 00, 02, SW1: 90, SW2: 00 -******************* Buy stock -CLA: 80, INS: 03, P1: 00, P2: 00, Lc: 0b, 42, 42, 42, 42, 42, 00, 00, 00, 20, 00, 03, Le: 1d, e4, 1b, c8, 05, 42, 42, 42, 42, 42, ca, 02, 00, 03, c9, 04, 00, 00, 00, 20, cb, 08, 88, 88, 88, 88, 88, 88, 88, 88, SW1: 90, SW2: 00 -******************* Update portfolio with stocks bought -CLA: 80, INS: 05, P1: 00, P2: 00, Lc: 1d, e6, 1b, c8, 05, 42, 42, 42, 42, 42, ca, 02, 00, 03, c9, 04, 00, 00, 00, 20, cb, 08, 88, 88, 88, 88, 88, 88, 88, 88, Le: 00, SW1: 90, SW2: 00 -******************* sell stock -CLA: 80, INS: 04, P1: 00, P2: 00, Lc: 0b, 41, 41, 41, 41, 41, 00, 00, 00, 05, 00, 02, Le: 1c, e3, 1b, c8, 05, 41, 41, 41, 41, 41, ca, 02, 00, 02, c9, 04, 00, 00, 00, 05, cb, 08, 88, 88, 88, 88, 88, 88, 88, SW1: 90, SW2: 00 -******************* Update portfolio with stocks sold -CLA: 80, INS: 05, P1: 00, P2: 00, Lc: 1d, 65, 1b, c8, 05, 41, 41, 41, 41, 41, ca, 02, 00, 02, c9, 04, 00, 00, 00, 05, cb, 08, 88, 88, 88, 88, 88, 88, 88, 88, Le: 00, SW1: 63, SW2: 04 -******************* get portfolio -CLA: 80, INS: 01, P1: 00, P2: 00, Lc: 00, Le: 38, e1, 36, e2, 19, c8, 05, 41, 41, 41, 41, 41, c9, 04, 00, 00, 00, 10, e7, 0a, c9, 04, 00, 00, 00, 10, ca, 02, 00, 02, e2, 19, c8, 05, 42, 42, 42, 42, 42, c9, 04, 00, 00, 00, 20, e7, 0a, c9, 04, 00, 00, 00, 20, ca, 02, 00, 03, SW1: 90, SW2: 00 -******************* get stock Information -CLA: 80, INS: 02, P1: 00, P2: 00, Lc: 05, 41, 41, 41, 41, 41, Le: 1b, e2, 19, c8, 05, 41, 41, 41, 41, 41, c9, 04, 00, 00, 00, 10, e7, 0a, c9, 04, 00, 00, 00, 10, ca, 02, 00, 02, SW1: 90, SW2: 00 -******************* get stock Information for a stock that doesn't exist -CLA: 80, INS: 02, P1: 00, P2: 00, Lc: 05, 42, 41, 41, 41, 43, Le: 00, SW1: 63, SW2: 01 -******************* Try to sell more stock than we hold -CLA: 80, INS: 04, P1: 00, P2: 00, Lc: 0b, 41, 41, 41, 41, 41, 00, 00, 00, 55, 00, 02, Le: 00, SW1: 63, SW2: 03 -******************* get Balance in BCD -CLA: 80, INS: 06, P1: 01, P2: 00, Lc: 00, Le: 08, 00, 00, 00, 99, 99, 99, 98, 72, SW1: 90, SW2: 00 -******************* get Balance in HEX -CLA: 80, INS: 06, P1: 02, P2: 00, Lc: 00, Le: 08, 00, 00, 00, 02, 54, 0b, e3, 80, SW1: 90, SW2: 00 diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/MessagesBundle.properties b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/MessagesBundle.properties deleted file mode 100644 index cdfae4ff..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/MessagesBundle.properties +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -# - -#+ -# @(#)MessagesBundle.properties 1.3 03/06/20 -#- - -# Sample ResourceBundle properties file - -msg00 = Usage: photoclientdemo [file 1] .. [file n] (n <=4) -msg01 = \n\nPhotoCard demo\n -msg02 = Failed to select applet. -msg03 = Reading file: {0}... -msg04 = Image size is {0} bytes -msg05 = Placing picture inside smart card... -msg06 = \nRecovering pictures from smart card...\n -msg07 = Recovering Picture ID {0}... -msg08 = Recovered {0} bytes for {1} -msg09 = On-card image size is {0} bytes -msg10 = On-card picture ID is {0}\n -msg11 = bogus msg. -#verifying photo-id -msg12=Placing recovered picture in file recv.{0}\n - - - - -msg13=Verifying photo-id now... - -msg14=Photo verification requires availability of MessageDigest class and SHA256 algorithm - -msg15=sending photo for on-card verification - -msg16=Verification failed - -msg17=Wrong reason code - -msg18=Wrong exception - -msg19=Invalid message digest length sent - -msg20=Invalid return code - -msg21=Photo is valid. diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/PhotoCardClient.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/PhotoCardClient.java deleted file mode 100644 index 09ac4834..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/photocardclient/PhotoCardClient.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * @(#)PhotoCardClient.java 1.11 06/01/06 - */ - -package com.sun.javacard.clientsamples.photocardclient; - -// J2SE libraries -import java.rmi.*; -import javacard.framework.*; -import java.io.*; -import java.text.*; -import java.util.ResourceBundle; -import java.security.MessageDigest; - -import com.sun.javacard.clientlib.*; -import com.sun.javacard.rmiclientlib.*; - -// Applet JC RMI interface -import com.sun.javacard.samples.photocard.PhotoCard; - - -public class PhotoCardClient { - - private static ResourceBundle msg; - - - private static final byte[] PHOTO_CARD_AID = { - (byte)0xA0, (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x62, (byte)0x03, (byte)0x01, (byte)0x0C, - (byte)0x07, (byte)0x01 - }; - - - public static void putPhotoInCard(PhotoCard theCard, byte[] data) throws Exception { - - short picID = theCard.requestPhotoStorage((short)data.length); - System.out.println(MessageFormat.format(msg.getString("msg10"), - new Object[] { new Integer(picID) })); - - for (int i = 0; i < data.length; i += PhotoCard.MAX_BUFFER_BYTES) { - byte[] buffer = new byte[96]; - if ((data.length - i) >= PhotoCard.MAX_BUFFER_BYTES) { - System.arraycopy(data, i, buffer, 0, PhotoCard.MAX_BUFFER_BYTES); - theCard.loadPhoto(picID, buffer, (short)PhotoCard.MAX_BUFFER_BYTES, (short)i, true); - } else { - System.arraycopy(data, i, buffer, 0, (short)(data.length - i)); - theCard.loadPhoto(picID, buffer, (short)(data.length - i), (short)i, false); - } - } - - } - - public static byte[] recoverPhoto(PhotoCard theCard, short picID) throws Exception { - - short picSize = theCard.getPhotoSize(picID); - System.out.println(MessageFormat.format(msg.getString("msg09"), - new Object[] { new Integer(picSize) })); - byte[] data = new byte[picSize]; - - for (int i = 0; i < picSize; i += PhotoCard.MAX_BUFFER_BYTES) { - byte[] buffer = null; - if ((picSize - i) >= PhotoCard.MAX_BUFFER_BYTES) { - buffer = theCard.getPhoto(picID, (short)i, (short)PhotoCard.MAX_BUFFER_BYTES); - System.arraycopy(buffer, 0, data, i, PhotoCard.MAX_BUFFER_BYTES); - } else { - buffer = theCard.getPhoto(picID, (short)i, (short)(picSize - i)); - System.arraycopy(buffer, 0, data, i, (short)(picSize - i)); - } - } - return data; - - } - - public static void verifyPhoto(PhotoCard theCard,short photoID, byte[] data) - throws Exception{ - MessageDigest md = null; - try{ - md = MessageDigest.getInstance("SHA-256"); - }catch(Exception e){ - System.out.println(msg.getString("msg14")); - return; - } - byte[] photoDigest = md.digest(data); - //send digest for verification - short response = theCard.verifyPhoto(photoID, photoDigest, (short)0); - switch(response){ - case 0: System.out.println(msg.getString("msg21")); - break; - case (short)0x7110: System.out.println(msg.getString("msg16")); - break; - case (short)0x7222: System.out.println(msg.getString("msg17")); - break; - case (short)0x7333: System.out.println(msg.getString("msg18")); - break; - case (short)0x7444: System.out.println(msg.getString("msg19")); - break; - default: System.out.println(msg.getString("msg20")); - } - } - - - public static void main(String[] argv) throws RemoteException{ - msg = - ResourceBundle.getBundle("com/sun/javacard/clientsamples/photocardclient/MessagesBundle"); - - CardAccessor ca = null; - - try { - - if ((argv.length < 1) || (argv.length >4)) { - System.out.println(msg.getString("msg00")); - } - - System.out.println(msg.getString("msg01")); - - // open and powerup the card - ca = new ApduIOCardAccessor(); - - // create a "filter" for RMI protocol - JCRMIConnect jcRMI = new JCRMIConnect(ca); - - // select the Java Card applet - if(argv.length == 0) { - jcRMI.selectApplet( PHOTO_CARD_AID, JCRMIConnect.REF_WITH_CLASS_NAME ); - } - else { - jcRMI.selectApplet( PHOTO_CARD_AID, JCRMIConnect.REF_WITH_INTERFACE_NAMES ); - } - - - // obtain the initial reference - PhotoCard myPhotoCard = (PhotoCard) jcRMI.getInitialReference(); - - // Failed to initialize - if(myPhotoCard == null) { - throw new Exception(msg.getString("msg02")); - } - - for (int i = 0; i < argv.length; i++) { - // Read the file first - String file1 = argv[i]; - byte[] file1Bytes = null; - //System.out.println("Reading file: " + file1 + "..."); - System.out.println(MessageFormat.format(msg.getString("msg03"), - new Object[] { file1 })); - - FileInputStream fis = new FileInputStream(new File(file1)); - int fLen = fis.available(); - System.out.println(MessageFormat.format(msg.getString("msg04"), - new Object[] { new Integer(fLen) })); - - file1Bytes = new byte[fLen]; - int fRead = fis.read(file1Bytes); - fis.close(); - - System.out.println(msg.getString("msg05")); - putPhotoInCard(myPhotoCard, file1Bytes); - } - - System.out.println(msg.getString("msg06")); - - - for (int i = 0; i < argv.length; i++) { - - System.out.println(MessageFormat.format(msg.getString("msg07"), - new Object[] { new Integer(i + 1) })); - byte[] recv1Bytes = recoverPhoto(myPhotoCard, (short)(i + 1)); - - String file1 = argv[i]; - System.out.println(MessageFormat.format(msg.getString("msg08"), - new Object[] { new Integer(recv1Bytes.length), - file1 })); - // Write recovered content into files - System.out.println(MessageFormat.format(msg.getString("msg12"), - new Object[] { file1 })); - FileOutputStream fos = new FileOutputStream(new File(file1 + ".recv")); - fos.write(recv1Bytes); - fos.flush(); - fos.close(); - } - System.out.println(""); - System.out.println(msg.getString("msg13")); - System.out.println(""); - //read photo data from card - String file1 = argv[0]; - byte[] file1Bytes = null; - System.out.println(MessageFormat.format(msg.getString("msg03"), - new Object[] { file1 })); - FileInputStream fis = new FileInputStream(new File(file1)); - int fLen = fis.available(); - file1Bytes = new byte[fLen]; - int fRead = fis.read(file1Bytes); - fis.close(); - //send photo to card for comparison - System.out.println(msg.getString("msg15")); - verifyPhoto(myPhotoCard,(short) 1, file1Bytes); - - - } - catch(UserException e) { - if(e.getReason()==(short)0x7110) - System.out.println(msg.getString("msg14")); - } - catch (Exception e){ - e.printStackTrace(); - } - finally { - try{ - if(ca!=null){ - ca.closeCard(); - } - }catch (Exception ignore){ - // System.out.println(ignore); - } - } - } - -} - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/MessagesBundle.properties b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/MessagesBundle.properties deleted file mode 100644 index 33aaf8cc..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/MessagesBundle.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -# - -#+ -# %W% %E% -#- - -# Sample ResourceBundle properties file - -msg01 = Receiving initial reference... -msg02 = OK -msg03 = Received null instead of the initial ref -msg04 = Getting the balance... -msg05 = Balance = -msg06 = Crediting 20... -msg07 = Debiting 15... -msg08 = Getting the new balance... -msg09 = Setting account number equal to 54321... -msg10 = Getting the account number... -msg11 = Trying to set incorrect (too long) account number. Expecting to get UserException with code=0x6002 -msg12 = Received UserException -msg13 = Reason code = 0x diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/PurseClient.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/PurseClient.java deleted file mode 100644 index b867f1df..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/purseclient/PurseClient.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -/* - * %W% %E% - */ - -package com.sun.javacard.clientsamples.purseclient; - -import java.rmi.*; -import javacard.framework.*; - -import com.sun.javacard.clientlib.*; -import com.sun.javacard.rmiclientlib.*; - -import com.sun.javacard.samples.RMIDemo.Purse; - -import java.util.ResourceBundle; - -public class PurseClient { - - private static final byte[] RMI_DEMO_AID = { - (byte)0xa0, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x62, (byte)0x03, - (byte)0x01, (byte)0xc, (byte)0x8, - (byte)0x01 - }; - - public static void main(String[] argv) throws RemoteException{ - - ResourceBundle msg - = ResourceBundle.getBundle("com/sun/javacard/clientsamples/purseclient/MessagesBundle"); - - CardAccessor ca = null; - - try { - - // open and powerup the card - ca = new ApduIOCardAccessor(); - - // create a "filter" for RMI protocol - JCRMIConnect jcRMI = new JCRMIConnect(ca); - - // select the Java Card applet - if(argv.length == 0) { - jcRMI.selectApplet( RMI_DEMO_AID, JCRMIConnect.REF_WITH_CLASS_NAME ); - } - else { - jcRMI.selectApplet( RMI_DEMO_AID, JCRMIConnect.REF_WITH_INTERFACE_NAMES ); - } - - // obtain the initial reference - System.out.print(msg.getString("msg01")+" "); - Purse myPurse = (Purse) jcRMI.getInitialReference(); - if(myPurse != null) { - System.out.println(msg.getString("msg02")); - } - else { - throw new Exception(msg.getString("msg03")); - } - - // get the balance amount - System.out.print(msg.getString("msg04")); - short balance = myPurse.getBalance(); - System.out.println(msg.getString("msg05") + balance); // prints 0 - - System.out.println(msg.getString("msg06")); - myPurse.credit((short)20); - System.out.println(msg.getString("msg07")); - myPurse.debit((short)15); - - System.out.print(msg.getString("msg08")); - balance = myPurse.getBalance(); - System.out.println(msg.getString("msg05") + balance); // prints 5 - - System.out.println(msg.getString("msg09")); - myPurse.setAccountNumber(new byte[]{5,4,3,2,1}); // expecting OK - - System.out.print(msg.getString("msg10")); - byte[] acct_number = myPurse.getAccountNumber(); - printArray(acct_number); // prints 5 4 3 2 1 - - System.out.println(msg.getString("msg11")); - myPurse.setAccountNumber(new byte[]{6,7,8,9,10,11}); - - } - catch(UserException e) { - System.out.println(msg.getString("msg12") + e.toString()); - System.out.println(msg.getString("msg13") + Integer.toHexString(0x00FFFF & e.getReason())); - } - catch (Exception e){ - System.out.println(e); - } - finally { - try{ - if(ca!=null){ - ca.closeCard(); - } - } - catch (Exception ignore){ - // System.out.println(ignore); - } - } - } - - private static void printArray(byte[] arr) { - for(int i=0; i>8); - externalAuthCommand[6] = (byte)ID; - externalAuthCommand[7] = 0x7F; - - - try { - byte[] response = this.exchangeAPDU( externalAuthCommand ); - if(response[response.length-2] != (byte)0x90 || response[response.length-1] != 0x00) return false; - else return true; - }catch (Exception e){ - return false; - } - - } - - /** Modifies the data and calls ca.exchangeAPDU to perform the actual send. - * The data returned from the smart card is returned by this method within - * the exchangeApdu object - * @param apdu The command APDU to be sent to the smart card - * @return The response APDU returned from the card. null if none available. - * @throws Exception if a communication error or timeout occurred - */ - public byte[] exchangeAPDU( byte[] sendData ) throws java.io.IOException{ - - final boolean select = isSelect(sendData); - - - byte[] dataWithChecksum; - - if(select) { - dataWithChecksum = new byte[ sendData.length ]; - System.arraycopy(sendData, 0, dataWithChecksum, 0, sendData.length); - } - else { - // set secure bits in CLA - sendData[0] |= APDU_SM_MASK_TYPE4; - - dataWithChecksum = new byte[ sendData.length + 2]; - System.arraycopy(sendData, 0, dataWithChecksum, 0, sendData.length-1); - dataWithChecksum[dataWithChecksum.length-1] = sendData[sendData.length-1]; - - int Lc = dataWithChecksum[4]; - - short csum = 0; - for(short n = 5; n>8); - dataWithChecksum[Lc+6] = (byte) (csum); - - dataWithChecksum[4] += 2; // increase Lc - - } - - - if(debug) { - for(int i=0; i " + "[ " + balance + " ]"); - } else { - - System.out.println("getBalance: [] => " + "error"); - } - } - - /** - * Credits the on-card account. - * - * @param amount - * The credited amount - * @throws Exception - */ - private void credit(byte amount) throws Exception { - - // Request Message: [1-byte Credit Amount] - - byte[] requestMessage = new byte[1]; - - requestMessage[0] = amount; - - // Response Message: [] - - byte[] responseMessage = processRequest(CREDIT, requestMessage); - - if (responseMessage != null) { - - System.out.println("credit: [" + amount + "] => " + "OK"); - } else { - - System.out.println("credit: [" + amount + "] => " + "error"); - } - } - - /** - * Prints the usage. - * - */ - private static void usage() { - commonUsage(); - System.out - .println(": ([VERIFY ]|[GET_BALANCE]|[CREDIT ])*"); - } - - /** - * Parses and runs the CLI command. - * - * @param args - * The CLI arguments: : ([VERIFY - * ]|[GET_BALANCE]|[CREDIT ])* - * @throws Exception - */ - public static void main(String[] args) throws Exception { - int i = parseCommonArgs(args); - if (i <= 0) { - usage(); - System.exit(3); - } - - POSTerminal terminal = new POSTerminal(hostName, port, staticKeyData); - - terminal.powerUp(); - terminal.selectApplet(); - terminal.initializeSession(); - - for (; i < args.length; i++) { - if (args[i].equals("VERIFY")) { - if (++i < args.length) { - byte[] pin = args[i].getBytes(); - terminal.verifyPIN(pin); - } else { - usage(); - System.exit(3); - } - } else if (args[i].equals("GET_BALANCE")) { - terminal.getBalance(); - } else if (args[i].equals("CREDIT")) { - if (++i < args.length) { - byte creditAmount = new Byte(args[i]).byteValue(); - terminal.credit(creditAmount); - } else { - usage(); - System.exit(3); - } - } else { - usage(); - System.exit(3); - } - } - - terminal.powerDown(); - - System.exit(0); - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/Terminal.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/Terminal.java deleted file mode 100644 index 720b397e..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/Terminal.java +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.clientsamples.transit; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.math.BigInteger; -import java.net.Socket; -import java.security.InvalidKeyException; -import java.security.SecureRandom; -import java.security.spec.KeySpec; -import java.util.Arrays; - -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.ShortBufferException; -import javax.crypto.spec.DESKeySpec; -import javax.crypto.spec.IvParameterSpec; - -import com.sun.javacard.apduio.Apdu; -import com.sun.javacard.apduio.CadT1Client; - -/** - * This class implements the common functionalities of a POS terminal and transit terminal. - * - */ -public abstract class Terminal implements Constants { - - /** - * The host where the cref or jcwde tool is running - */ - protected static String hostName = DEFAULT_HOST_NAME; - - /** - * The port the cref or jcwde is listening on - */ - protected static int port = DEFAULT_PORT; - - /** - * The static DES key - shared b/w the on-card and off-card applications - */ - protected static byte[] staticKeyData = null; - - /** - * The CAD client - */ - private CadT1Client cad; - - /** - * The cipher used to encrypt - using the static DES key - the derivation - * data to form the session key - */ - private Cipher cipher; - - /** - * The MAC initialized with the DES key and used to verify incoming messages - * and to sign outgoing messages - */ - private Mac mac; - - /** - * DES session key, generated from the derivation data - */ - private SecretKey sessionKey; - - /** - * The DES session key factory - */ - private SecretKeyFactory keyFactory; - - /** - * Creates a terminal. - * - * @param hostName - * The hostname where the cref or jcwde tools are running. - * @param hostPort - * The port used by the cref or jcwde tools - * @param staticKeyData - * The static DES key - secret shared by the on-card and off-card - * applications - * @throws Exception - */ - public Terminal(String hostName, int hostPort, byte[] staticKeyData) - throws Exception { - Socket socket = new Socket(hostName, hostPort); - socket.setTcpNoDelay(true); - BufferedInputStream input = new BufferedInputStream(socket - .getInputStream()); - BufferedOutputStream output = new BufferedOutputStream(socket - .getOutputStream()); - cad = new CadT1Client(input, output); - KeySpec keySpec = new DESKeySpec(fixParity(staticKeyData)); - keyFactory = SecretKeyFactory.getInstance("DES"); - SecretKey staticKey = keyFactory.generateSecret(keySpec); - cipher = Cipher.getInstance("DES/CBC/NoPadding"); - cipher.init(Cipher.ENCRYPT_MODE, staticKey, new IvParameterSpec(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0})); - } - - /** - * Powers up the CAD. - * - * @throws Exception - */ - void powerUp() throws Exception { - cad.powerUp(); - } - - /** - * Powers down the CAD. - * - */ - void powerDown() { - try { - cad.powerDown(true); - } catch (Exception e) {} - } - - /** - * Selects the on-card transit applet. - * - * @throws Exception - */ - void selectApplet() throws Exception { - - // C-APDU: [CLA, INS, P1, P2, LC, [ AID_TRANSIT ]] - - Apdu apdu = new Apdu(); - apdu.command[Apdu.CLA] = CLA_ISO7816; - apdu.command[Apdu.INS] = INS_SELECT; - apdu.command[Apdu.P1] = 0x04; - apdu.command[Apdu.P2] = 0; - - apdu.setDataIn(AID_TRANSIT); - - System.out.println(apdu); - cad.exchangeApdu(apdu); - System.out.println(apdu); - - if (apdu.getStatus() == SW_NO_ERROR) { - System.out.println("OK"); - } else { - System.out.println("Error: " + apdu.getStatus()); - } - } - - /** - * Verifies the user-provided PIN against the on-card PIN. - * - * @param pin - * The PIN - * @throws Exception - */ - void verifyPIN(byte[] pin) throws Exception { - - // C-APDU: [CLA, INS, P1, P2, LC, [ PIN ]] - - Apdu apdu = new Apdu(); - apdu.command[Apdu.CLA] = CLA_ISO7816; - apdu.command[Apdu.INS] = INS_VERIFY; - apdu.command[Apdu.P1] = 0; - apdu.command[Apdu.P2] = 0; - - apdu.setDataIn(pin); - - System.out.println(apdu); - cad.exchangeApdu(apdu); - System.out.println(apdu); - - if (apdu.getStatus() == SW_NO_ERROR) { - System.out.println("OK"); - } else { - System.out.println("Error: " + apdu.getStatus()); - } - } - - /** - * Initializes a session with the on-card applet using a mutual - * authentication scheme. - * - * @throws Exception - */ - void initializeSession() throws Exception { - - // C-APDU: [CLA, INS, P1, P2, LC, [4-bytes Host Challenge]] - - Apdu apdu = new Apdu(); - apdu.command[Apdu.CLA] = TRANSIT_CLA; - apdu.command[Apdu.INS] = INITIALIZE_SESSION; - apdu.command[Apdu.P1] = 0; - apdu.command[Apdu.P2] = 0; - - // Generate card challenge - - byte[] hostChallenge = generateHostChallenge(); - - byte[] data = new byte[hostChallenge.length]; - System.arraycopy(hostChallenge, 0, data, 0, hostChallenge.length); - apdu.setDataIn(data); - - System.err.println(apdu); - cad.exchangeApdu(apdu); - System.err.println(apdu); - - if (apdu.getStatus() == SW_NO_ERROR) { - - // R-APDU: [[4-bytes Card Challenge], [2-bytes Status Word], - // [8-bytes MAC]] - - data = apdu.getDataOut(); - - // Check status word - - byte[] cardChallenge = new byte[CHALLENGE_LENGTH]; - System.arraycopy(data, 0, cardChallenge, 0, CHALLENGE_LENGTH); - - // Generate key derivation data from host challenge and card - // challenge - byte[] keyDerivationData = generateKeyDerivationData(hostChallenge, - cardChallenge); - - // Generate session key from derivation data - generateSessionKey(keyDerivationData); - - // Initialize MAC with current session key for verification - mac = new Mac(sessionKey); - - // Check response message MAC - - if (mac.checkMAC(data, apdu.getLe() - MAC_LENGTH)) { - System.err.println("OK"); - } else { - throw new Exception("InitializeSession: Wrong signature"); - } - } else { - throw new Exception("InitializeSession: Error " + apdu.getStatus()); - } - } - - /** - * Processes a generic request: a transit terminal request or a POS terminal - * request. - * - * @param type - * The request type - * @param requestMessage - * The request message content - * @return The response message content or null if an error occured - * @throws Exception - */ - protected byte[] processRequest(byte type, byte[] requestMessage) - throws Exception { - - Apdu apdu = new Apdu(); - apdu.command[Apdu.CLA] = TRANSIT_CLA; - apdu.command[Apdu.INS] = PROCESS_REQUEST; - apdu.command[Apdu.P1] = 0; - apdu.command[Apdu.P2] = 0; - - byte[] data = new byte[(2 + requestMessage.length) + MAC_LENGTH]; - data[0] = type; // TLV Tag - data[1] = (byte) requestMessage.length; // TLV Length - // TLV Value - System.arraycopy(requestMessage, 0, data, 2, requestMessage.length); - mac.generateMAC(data, 2 + requestMessage.length); - apdu.setDataIn(data); - - System.err.println(apdu); - cad.exchangeApdu(apdu); - System.err.println(apdu); - - if (apdu.getStatus() == SW_NO_ERROR) { - - // R-APDU: [[Response Message], [2-bytes Status Word], [8-bytes - // MAC]] - - byte[] responseMessage = apdu.getDataOut(); - - // Check response message MAC - - if (mac.checkMAC(responseMessage, (apdu.getLe() - MAC_LENGTH))) { - - // Check status word - - data = new byte[apdu.getLe() - (2 + MAC_LENGTH)]; - System.arraycopy(responseMessage, 0, data, 0, data.length); - - return data; - } - } - return null; - } - - /** - * Generates a host challenge. - * - * @return The host challenge - */ - protected byte[] generateHostChallenge() { - byte[] hostChallenge = new byte[CHALLENGE_LENGTH]; - SecureRandom random = new SecureRandom(); - random.nextBytes(hostChallenge); - return hostChallenge; - } - - /** - * Generates the session key derivation data from the passed-in host and - * card challenges. - * - * @param hostChallenge - * The host challenge - * @param cardChallenge - * The card challenge - * @return The key derivation data - */ - protected byte[] generateKeyDerivationData(byte[] hostChallenge, - byte[] cardChallenge) { - - // Derivation data: [[4-bytes host challenge], [4-bytes card challenge]] - - byte[] keyDerivationData = new byte[CHALLENGE_LENGTH * 2]; - - // Append host challenge to derivation data - System.arraycopy(hostChallenge, 0, keyDerivationData, 0, - CHALLENGE_LENGTH); - // Append card challenge to derivation data - System.arraycopy(cardChallenge, (short) 0, keyDerivationData, - CHALLENGE_LENGTH, CHALLENGE_LENGTH); - return keyDerivationData; - } - - /** - * Generates a new DES session key from the derivation data. - * - * @param keyDerivationData - * The key derivation data - * - */ - protected void generateSessionKey(byte[] keyDerivationData) - throws Exception { - byte[] paddedData = pad(keyDerivationData, 0, keyDerivationData.length, cipher.getBlockSize()); - byte[] sessionKeyData = fixParity(cipher.doFinal(paddedData)); - // Generate new session key from derivation data - KeySpec keySpec = new DESKeySpec(sessionKeyData); - sessionKey = keyFactory.generateSecret(keySpec); - } - - /** - * Gets a short integer from a byte array. - * - * @param buffer - * The byte array - * @param offset - * The offset of the first byte in the buffer. - * @return The short integer - */ - protected short getShort(byte[] buffer, int offset) { - return (short) ((((short) buffer[offset]) << 8) | buffer[offset + 1]); - } - - /** - * Copies a short integer into a byte array. - * - * @param i - * The short integer to cpy - * @param buffer - * The byte array - * @param offset - * The offset in the buffer where to copy the short integer - */ - protected void copyShort(short i, byte[] buffer, int offset) { - buffer[offset] = (byte) ((i >> 8) & 0x00ff); - buffer[offset + 1] = (byte) (i & 0x00ff); - } - - /** - * Prints the common usage message. - * - */ - protected static void commonUsage() { - System.out - .println("[-?] [-h ] [-p ] -k <8-bytes DES static key> "); - } - - /** - * Parses the common CLI arguments. - * - * @param args - * The arguments - * @return The offset in the arguments array just after the common arguments - */ - protected static int parseCommonArgs(String[] args) { - int i = 0; - for (; i < args.length && args[i].startsWith("-"); i++) { - if (args[i].equals("-?")) { - commonUsage(); - System.exit(0); - } else if (args[i].equals("-h")) { - if (++i < args.length) { - hostName = args[i]; - } else { - commonUsage(); - System.exit(2); - } - } else if (args[i].equals("-p")) { - if (++i < args.length) { - port = Integer.valueOf(args[i]).intValue(); - } else { - commonUsage(); - System.exit(2); - } - } else if (args[i].equals("-k")) { - if (++i < args.length) { - if ((args[i].length() / 2) < LENGTH_DES_BYTE) { - commonUsage(); - System.exit(1); - } - staticKeyData = parseByteArray(args[i]); - } else { - commonUsage(); - System.exit(2); - } - } else if (args[i].equals("--")) { - i++; - break; - } else { - commonUsage(); - System.exit(2); - } - } - if (staticKeyData == null) { - return -1; - } - return i; - } - - private static byte[] parseByteArray(String s) { - byte[] array = new byte[s.length() / 2]; - for (int i = 0; i < s.length(); i += 2) { - array[i / 2] = (byte) Integer.parseInt(s.substring(i, i + 2), 16); - } - return array; - } - - private byte[] pad(byte[] msg, int offset, int length, int blockLength) { - // Add 1 to add 0x80 at the end. - int paddedLength = length + 1; - int numBlocks = (int) (paddedLength / blockLength); - int remBytes = paddedLength - (numBlocks * blockLength); - if (remBytes > 0) { - numBlocks++; - } - byte[] paddedMsg = new byte[numBlocks * blockLength]; - System.arraycopy(msg, offset, paddedMsg, 0, length); - paddedMsg[length] = (byte) 0x80; - // Fill message with zeroes to fit blocks - for (int i = (length + 1); i < paddedMsg.length; i++) { - paddedMsg[i] = (byte) 0x00; - } - return paddedMsg; - } - - private byte[] fixParity(byte[] keyData) { - for (int i = 0; i < keyData.length; i++) { - short parity = 0; - keyData[i] &= 0xFE; - for (int j = 1; j < 8; j++) { - if ((keyData[i] & ((byte) (1 << j))) != 0) { - parity++; - } - } - if ((parity % 2) == 0) { - keyData[i] |= 1; - } - } - return keyData; - } - - /** - * This class implements an algorithm equivalent to - * javacard.security.Signature.ALG_DES_MAC8_ISO9797_M2 - * - */ - private class Mac { - - /** - * The cipher used to encrypt the message and derive the MAC - */ - private Cipher cipher; - - public Mac(SecretKey key) - throws Exception { - cipher = Cipher.getInstance("DES/CBC/NoPadding"); - cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0})); - } - - /** - * Checks the message signature. - * - * @param buffer - * The message buffer - * @param offset - * The offset of the MAC in the buffer - * @return true if the message signature is correct; false otherwise - */ - protected boolean checkMAC(byte[] buffer, int offset) throws Exception { - // Generate the MAC for the response - byte[] paddedMsg = pad(buffer, 0, offset, cipher.getBlockSize()); - byte[] encryptedMsg = cipher.doFinal(paddedMsg); - byte[] hostMAC = new byte[MAC_LENGTH]; - System.arraycopy(encryptedMsg, encryptedMsg.length - MAC_LENGTH, hostMAC, 0, MAC_LENGTH); - byte[] cardMAC = new byte[MAC_LENGTH]; - System.arraycopy(buffer, offset, cardMAC, 0, MAC_LENGTH); - // Verify message signature - return Arrays.equals(hostMAC, cardMAC); - } - - /** - * Generates a message MAC: generates the MAC and appends the MAC - * to the message. - * - * @param buffer - * The APDU buffer - * @param offset - * The offset of the MAC in the buffer - * @return The resulting length of the request message - * @throws Exception - */ - protected short generateMAC(byte[] buffer, int offset) - throws Exception { - // Sign request message and append the MAC to the request message - byte[] paddedMsg = pad(buffer, 0, offset, cipher.getBlockSize()); - byte[] encryptedMsg = cipher.doFinal(paddedMsg); - System.arraycopy(encryptedMsg, encryptedMsg.length - MAC_LENGTH, buffer, offset, MAC_LENGTH); - return (short) (offset + MAC_LENGTH); - } - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/TransitTerminal.java b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/TransitTerminal.java deleted file mode 100644 index 24c5c617..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/com/sun/javacard/clientsamples/transit/TransitTerminal.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. - */ - -package com.sun.javacard.clientsamples.transit; - -/** - * This class implements a transit terminal. - * - * It sends transit system entry and exit events to the on-card applet for - * processing. - */ -public class TransitTerminal extends Terminal { - - /** - * Creates a transit terminal. - * - * @param hostName - * The hostname where the cref or jcwde tools are running. - * @param hostPort - * The port used by the cref or jcwde tools - * @param staticKeyData - * The static DES key - secret shared by the on-card and off-card - * applications - * @throws Exception - */ - TransitTerminal(String hostName, int hostPort, byte[] staticKeyData) - throws Exception { - super(hostName, hostPort, staticKeyData); - } - - /** - * Sends a transit system entry event to the on-card applet for processing. - * - * @param entryStationId - * The entry station id - * @throws Exception - */ - private void processEntry(short entryStationId) throws Exception { - - // Request Message: [2-bytes Entry Station ID] - - byte[] requestMessage = new byte[2]; - - copyShort(entryStationId, requestMessage, 0); - - // Response Message: [[8-bytes UID], [2-bytes Correlation ID]] - - byte[] responseMessage = processRequest(PROCESS_ENTRY, requestMessage); - - if (responseMessage != null) { - - // Retrieve the UID - byte[] uid = new byte[UID_LENGTH]; - System.arraycopy(responseMessage, 0, uid, 0, UID_LENGTH); - - // Retrieve the correlation Id - short correlationId = getShort(responseMessage, 2); - - System.out.println("processEntry: [" + entryStationId + "] => " - + "[ " + new String(uid) + ", " + correlationId + "]"); - } else { - - System.out.println("processEntry: [" + entryStationId + "] => " - + "error"); - } - } - - /** - * Sends a transit system exit event to the on-card applet for processing. - * - * @param transitFee - * The transit fee to be debited from the on-card account. - * @throws Exception - */ - private void processExit(byte transitFee) throws Exception { - - // Request Message: [1-byte Transit Fee] - - byte[] requestMessage = new byte[1]; - - requestMessage[0] = transitFee; - - // Response Message: [[8-bytes UID], [2-bytes Correlation ID]] - - byte[] responseMessage = processRequest(PROCESS_EXIT, requestMessage); - - if (responseMessage != null) { - - // Retrieve the UID - byte[] uid = new byte[UID_LENGTH]; - System.arraycopy(responseMessage, 0, uid, 0, UID_LENGTH); - - // Retrieve the correlation Id - short correlationId = getShort(responseMessage, 2); - - System.out.println("processEntry: [" + transitFee + "] => " + "[ " - + new String(uid) + ", " + correlationId + "]"); - } else { - - System.out.println("processEntry: [" + transitFee + "] => " - + "error"); - } - } - - /** - * Prints the usage. - * - */ - private static void usage() { - commonUsage(); - System.out - .println(": ([PROCESS_ENTRY ]|[PROCESS_EXIT ])*"); - } - - /** - * Parses and runs the CLI command. - * - * @param args - * The CLI arguments: : ([PROCESS_ENTRY ]|[PROCESS_EXIT ])* - * @throws Exception - */ - public static void main(String[] args) throws Exception { - int i = parseCommonArgs(args); - if (i <= 0) { - usage(); - System.exit(3); - } - - TransitTerminal terminal = new TransitTerminal(hostName, port, - staticKeyData); - - terminal.powerUp(); - terminal.selectApplet(); - terminal.initializeSession(); - - for (; i < args.length; i++) { - if (args[i].equals("PROCESS_ENTRY")) { - if (++i < args.length) { - short entryStationId = new Short(args[i]).shortValue(); - terminal.processEntry(entryStationId); - } else { - usage(); - System.exit(3); - } - } else if (args[i].equals("PROCESS_EXIT")) { - if (++i < args.length) { - byte transitFee = new Byte(args[i]).byteValue(); - terminal.processExit(transitFee); - } else { - usage(); - System.exit(3); - } - } else { - usage(); - System.exit(3); - } - } - - terminal.powerDown(); - - System.exit(0); - } -} diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/jcclient.properties b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/jcclient.properties deleted file mode 100644 index fb356c6d..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/src_client/jcclient.properties +++ /dev/null @@ -1,31 +0,0 @@ -# -# @(#)jcclient.properties 1.3 06/03/02 -# - -# -# This file specifies parameters for com.sun.javacard.clientlib.ApduIOCardAccessor -# -# To be accessible at runtime, this file must be located in one of the directories -# listed in the CLASSPATH -# - -# connection = TCP | SERIAL | PCSC -connection = TCP - - -# if connection == TCP | SERIAL -# protocol = T0 | T1 -protocol = T1 - - -# if connection == TCP -# TCP_HOST = -# TCP_PORT = -TCP_HOST = localhost -TCP_PORT = 9025 - - -# if conection == SERIAL -# SERIAL_PORT = -SERIAL_PORT = COM1 - diff --git a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/usage.xml b/JCMathLib/ext/java_card_kit-2_2_2-win/samples/usage.xml deleted file mode 100644 index 6a37e159..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2-win/samples/usage.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Usage: build_demos [options] - Where options include: - -32bit_t1 produce a 32-bit mask and T=1 cref for demos - -32bit_t0 produce a 32-bit mask and T=0 cref for demos - -16bit_t0 produce a 16-bit mask and T=0 cref for demos - -help print out this message - -clean remove all produced files - - - - - - - - Usage: build_samples [options]" - Where options include:" - -help print out this message" - -clean remove all produced files" - - - diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/io/javacard/io.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/io/javacard/io.exp deleted file mode 100644 index 931133af..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/io/javacard/io.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/lang/javacard/lang.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/lang/javacard/lang.exp deleted file mode 100644 index f3498186..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/lang/javacard/lang.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/rmi/javacard/rmi.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/rmi/javacard/rmi.exp deleted file mode 100644 index 209cdf37..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/java/rmi/javacard/rmi.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp deleted file mode 100644 index 9e9351bf..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/service/javacard/service.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/service/javacard/service.exp deleted file mode 100644 index 8fbef2f6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/framework/service/javacard/service.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/security/javacard/security.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/security/javacard/security.exp deleted file mode 100644 index d3279d48..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacard/security/javacard/security.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/apdu/javacard/apdu.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/apdu/javacard/apdu.exp deleted file mode 100644 index c9183d4f..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/apdu/javacard/apdu.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/biometry/javacard/biometry.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/biometry/javacard/biometry.exp deleted file mode 100644 index fb46fa30..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/biometry/javacard/biometry.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/crypto/javacard/crypto.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/crypto/javacard/crypto.exp deleted file mode 100644 index a9968bb6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/crypto/javacard/crypto.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/external/javacard/external.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/external/javacard/external.exp deleted file mode 100644 index 4af91e53..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/external/javacard/external.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/math/javacard/math.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/math/javacard/math.exp deleted file mode 100644 index 89a1ac6c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/math/javacard/math.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/tlv/javacard/tlv.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/tlv/javacard/tlv.exp deleted file mode 100644 index 58495fb0..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/tlv/javacard/tlv.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/intx/javacard/intx.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/intx/javacard/intx.exp deleted file mode 100644 index 881a9612..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/intx/javacard/intx.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/javacard/util.exp b/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/javacard/util.exp deleted file mode 100644 index 3ce0d16b..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/javacard/util.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/apdutool b/JCMathLib/ext/java_card_kit-2_2_2/bin/apdutool deleted file mode 100644 index 128e724c..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/apdutool +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.apdutool.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/capdump b/JCMathLib/ext/java_card_kit-2_2_2/bin/capdump deleted file mode 100644 index 3877c3a1..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/capdump +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.capdump.CapDump "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/capgen b/JCMathLib/ext/java_card_kit-2_2_2/bin/capgen deleted file mode 100644 index f054c6ba..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/capgen +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcasm.cap.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/converter b/JCMathLib/ext/java_card_kit-2_2_2/bin/converter deleted file mode 100644 index e99bb8ec..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/converter +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Converter "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/cref b/JCMathLib/ext/java_card_kit-2_2_2/bin/cref deleted file mode 100644 index b0d8ac8c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/bin/cref and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/exp2text b/JCMathLib/ext/java_card_kit-2_2_2/bin/exp2text deleted file mode 100644 index 6350face..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/exp2text +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Exp2Text "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/jcwde b/JCMathLib/ext/java_card_kit-2_2_2/bin/jcwde deleted file mode 100644 index f59a861b..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/jcwde +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcwde.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/libjpcsclite.so b/JCMathLib/ext/java_card_kit-2_2_2/bin/libjpcsclite.so deleted file mode 100644 index 4ffb8b18..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/bin/libjpcsclite.so and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/scriptgen b/JCMathLib/ext/java_card_kit-2_2_2/bin/scriptgen deleted file mode 100644 index 3a1e3109..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/scriptgen +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.scriptgen.Main "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifycap b/JCMathLib/ext/java_card_kit-2_2_2/bin/verifycap deleted file mode 100644 index 6d4ae0b7..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifycap +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.Verifier "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyexp b/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyexp deleted file mode 100644 index 91205156..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyexp +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyExp "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyrev b/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyrev deleted file mode 100644 index c231efb1..00000000 --- a/JCMathLib/ext/java_card_kit-2_2_2/bin/verifyrev +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -JAVA_HOME=${JAVA_HOME:-/usr/j2se} - -bin_home=`dirname $0` -JC_HOME=${JC_HOME:-$bin_home/..} - -JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH - -JFLAGS="-classpath $JC_PATH" -$JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyRev "$@" diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/apduio.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/apduio.jar deleted file mode 100644 index ab57e262..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/apduio.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/apdutool.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/apdutool.jar deleted file mode 100644 index c4ad9f29..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/apdutool.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/api.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/api.jar deleted file mode 100644 index 98e07b2c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/api.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/api_16.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/api_16.jar deleted file mode 100644 index 6213631a..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/api_16.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/capdump.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/capdump.jar deleted file mode 100644 index 00f38c5c..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/capdump.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/converter.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/converter.jar deleted file mode 100644 index 3728ebe4..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/converter.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/installer.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/installer.jar deleted file mode 100644 index 43004d52..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/installer.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/javacardframework.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/javacardframework.jar deleted file mode 100644 index 35762c41..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/javacardframework.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcclientsamples.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/jcclientsamples.jar deleted file mode 100644 index c1698910..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcclientsamples.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcrmiclientframework.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/jcrmiclientframework.jar deleted file mode 100644 index c0fdaad1..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcrmiclientframework.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde.jar deleted file mode 100644 index 1f6d0177..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde_16.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde_16.jar deleted file mode 100644 index 76de86b6..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/jcwde_16.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/offcardverifier.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/offcardverifier.jar deleted file mode 100644 index e6b00a9d..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/offcardverifier.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-2_2_2/lib/scriptgen.jar b/JCMathLib/ext/java_card_kit-2_2_2/lib/scriptgen.jar deleted file mode 100644 index e1b50c56..00000000 Binary files a/JCMathLib/ext/java_card_kit-2_2_2/lib/scriptgen.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/COPYRIGHT.html b/JCMathLib/ext/java_card_kit-3_0_3-win/COPYRIGHT.html deleted file mode 100644 index 66af699d..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/COPYRIGHT.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - Copyright - - -
Copyright © 1998, 2010, -Oracle and/or its affiliates. All rights reserved.
-
-

This software and related documentation are provided under a license -agreement containing restrictions on use and disclosure and are -protected by intellectual property laws. Except as expressly permitted -in your license agreement or allowed by law, you may not use, copy, -reproduce, translate, broadcast, modify, license, transmit, distribute, -exhibit, perform, publish, or display any part, in any form, or by any -means. Reverse engineering, disassembly, or decompilation of this -software, unless required by law for interoperability, is prohibited.

-

The information contained herein is subject to change without notice -and is not warranted to be error-free. If you find any errors, please -report them to us in writing.

-

If this is software or related software documentation that is -delivered to the U.S. Government or anyone licensing it on behalf of -the U.S. Government, the following notice is applicable:

-

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related -documentation and technical data delivered to U.S. Government customers -are "commercial computer software" or "commercial technical data" -pursuant to the applicable Federal Acquisition Regulation and -agency-specific supplemental regulations. As such, the use, -duplication, disclosure, modification, and adaptation shall be subject -to the restrictions and license terms set forth in the applicable -Government contract, and, to the extent applicable by the terms of the -Government contract, the additional rights set forth in FAR 52.227-19, -Commercial Computer Software License (December 2007). Oracle USA, Inc., -500 Oracle Parkway, Redwood City, CA 94065.

-

This software or hardware is developed for general use in a variety -of information management applications. It is not developed or intended -for use in any inherently dangerous applications, including -applications which may create a risk of personal injury. If you use -this software or hardware in dangerous applications, then you shall be -responsible to take all appropriate fail-safe, backup, redundancy, and -other measures to ensure the safe use. Oracle Corporation and its -affiliates disclaim any liability for any damages caused by use of this -software or hardware in dangerous applications.

-

Oracle and Java are registered trademarks of Oracle Corporation -and/or its -affiliates. Oracle and Java are registered trademarks of Oracle and/or -its affiliates. Other names may be trademarks of their respective -owners.

-

AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks -or registered trademarks of Advanced Micro Devices. Intel and Intel -Xeon are trademarks or registered trademarks of Intel Corporation. All -SPARC trademarks are used under license and are trademarks or -registered trademarks of SPARC International, Inc. UNIX is a registered -trademark licensed through X/Open Company, Ltd.

-

This software or hardware and documentation may provide access to or -information on content, products, and services from third parties. -Oracle Corporation and its affiliates are not responsible for and -expressly disclaim all warranties of any kind with respect to -third-party content, products, and services. Oracle Corporation and its -affiliates will not be responsible for any loss, costs, or damages -incurred due to your access to or use of third-party content, products, -or services.
-

-
-Copyright © 1998, 2010, Oracle -et/ou ses affiliés. -Tous droits réservés. - -

Ce logiciel et la documentation qui l’accompagne sont -protégés par les -lois sur la propriété intellectuelle. Ils sont -concédés sous licence et soumis à -des restrictions d’utilisation et de divulgation. Sauf disposition de -votre contrat de licence ou -de la loi, vous ne pouvez pas copier, reproduire, traduire, diffuser, -modifier, breveter, -transmettre, distribuer, exposer, exécuter, publier ou afficher -le logiciel, même partiellement, sous quelque forme -et par quelque procédé que ce soit. Par ailleurs, il est -interdit de -procéder à toute ingénierie inverse du logiciel, -de le désassembler ou de le décompiler, -excepté à des fins d’interopérabilité avec -des logiciels tiers ou tel que prescrit par -la loi.

-

Les informations fournies dans ce document sont susceptibles de -modification sans préavis. -Par ailleurs, Oracle Corporation ne garantit pas qu’elles soient -exemptes d’erreurs et vous invite, -le cas échéant, à lui en faire part par -écrit.

-

Si ce logiciel, ou -la documentation qui l’accompagne, est concédé sous -licence au Gouvernement des Etats-Unis, ou à -toute entité qui délivre la licence de ce logiciel ou -l’utilise pour le -compte du Gouvernement des Etats-Unis, la notice suivante s’applique:

-

U.S. GOVERNMENT RIGHTS. Programs, -software, databases, and related documentation and technical data -delivered to U.S. Government customers are -"commercial computer software" or "commercial technical data" pursuant -to the applicable Federal Acquisition -Regulation and agency-specific supplemental regulations. As such, the -use, duplication, disclosure, modification, and -adaptation shall be subject to the restrictions and license terms set -forth in -the applicable Government contract, and, to the extent applicable by -the terms of the -Government contract, the additional rights set forth in FAR 52.227-19, -Commercial Computer Software -License (December 2007). Oracle America, Inc., 500 Oracle Parkway, -Redwood City, CA -94065.

-

Ce logiciel ou matériel a été -développé pour un usage général dans le -cadre d’applications de gestion des informations. Ce logiciel ou -matériel n’est pas conçu ni -n’est destiné à être utilisé dans des -applications à risque, notamment dans des applications -pouvant causer des dommages corporels. Si vous utilisez ce logiciel ou -matériel dans -le cadre d’applications dangereuses, il est de votre -responsabilité de prendre toutes les mesures -de secours, de sauvegarde, de redondance et autres mesures -nécessaires à son utilisation -dans des conditions optimales de sécurité. Oracle -Corporation et ses affiliés déclinent toute -responsabilité -quant aux dommages causés par l’utilisation de ce logiciel ou -matériel pour ce type -d’applications.

-

Oracle et Java sont des marques déposées d’Oracle -Corporation et/ou de ses affiliés.Tout -autre nom mentionné peut correspondre à des marques -appartenant à d’autres propriétaires qu’Oracle.

-

AMD, Opteron, -le logo AMD et le logo AMD Opteron sont des marques ou des -marques déposées d’Advanced Micro Devices. Intel et Intel -Xeon sont des marques ou -des marques déposées d’Intel Corporation. Toutes les -marques SPARC sont utilisées sous licence et -sont des marques ou des marques déposées de SPARC -International, Inc. UNIX est une -marque déposée concédée sous licence par -X/Open Company, Ltd.

-

Ce logiciel ou matériel et -la documentation qui l’accompagne peuvent fournir des informations ou -des liens donnant accès à -des contenus, des produits et des services émanant de tiers. -Oracle Corporation et -ses affiliés déclinent toute responsabilité ou -garantie expresse quant aux contenus, produits ou services -émanant de tiers. En aucun cas, Oracle Corporation et ses -affiliés ne sauraient -être tenus pour responsables des pertes subies, des coûts -occasionnés ou des dommages causés -par l’accès à des contenus, produits ou services tiers, -ou à leur utilisation.
-

-

-
- - diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/RELEASENOTES-CL.html b/JCMathLib/ext/java_card_kit-3_0_3-win/RELEASENOTES-CL.html deleted file mode 100644 index f1b57ba3..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/RELEASENOTES-CL.html +++ /dev/null @@ -1,634 +0,0 @@ - - - - - - - Release Notes - Classic Edition Development Kit, Java Card -Patform, Version 3.0.3 - - - -
- - - - - - - -
-

Release Notes

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

Development Kit for the Java Card 3 Platform
-

-
-

Version 3.0.3, Classic Edition
-

-
-

November 2010
-

-
-
-
- -

Table of Contents

- - -

1. Overview

-

These release notes describe the development kit for the Java Card 3 -Platform, Version 3.0.3, Classic Edition. This version -of the development kit is a maintenance release and includes bug fixes. -It also supports a new tool, the trimming tool, which is -designed to minimize the code footprint of an application before it is -deployed to a smartcard. The trimming tool is available in a separate -download bundle for licensees only.
-

-

Java Card technology combines a subset of the Java programming -language with a runtime environment optimized for smart cards and -similar small-memory embedded devices. The goal of Java Card technology -is to bring many of the benefits of the Java programming language to -the resource-constrained world of smart cards. The Java Card API is -compatible with international standards such as ISO 7816, and -industry-specific standards such as Europay, Master Card, and Visa -(EMV).
-

-

Java Card platform version 3.0.3 is the latest evolution of Java -Card technology. This development kit is based on version 3.0.1 of the -Java Card specifications, which includes their errata sheets located at -http://www.oracle.com/technetwork/java/javacard/jc-classic-spec-errata-140181.html. -The -Java -Card -3 -platform -consists -of version 3.0 and 3.0.1 of the -specifications and versions 3.0.1, 3.0.2, and 3.0.3 of the development -kit.
-

-

The Java Card platform is available in two -editions, both of which are backward compatible with previous versions -and share key security features:
-

-
    -
  • Classic Edition is based on an evolution of the Java Card -Platform, -Version 2.2.2, architecture. This edition targets more -resource-constrained devices than the Connected Edition. These release -notes are for the Classic Edition.
    -
  • -
  • Connected Edition contains a new architecture compared to the -Java -Card technology released in version 2.2.2, which is now knows as the -"Classic Edition." The Connected Edition enables the integration of -smart cards within IP networks and web services architectures. To do -so., it features a significantly enhanced runtime environment and -virtual machine (VM), and it includes new network-oriented features, -such as support for Java Servlet APIs and Java Card applets with -extended and advanced capabilities.
    -
  • -
- - -

2. Prerequisites

-

Required Operating System

-
    -
  • This release is targeted for use on the Microsoft Windows XP SP3 -operating system.
    -
  • -
-

Required Software

-

The following software must be installed for the Java Card -development -kit to work:

- -

Note: Do not -install any software in a directory that -contains a space in its name. For example, do not install software in -any subdirectory of c:\program files because of the space -in the program files element
-

-

Note: The trimming tool -bundle and the bundle containing the specifications must -be -downloaded separately.The bundle containing the trimming tool MUST be -installed into a directory separate from this development kit directory.

-
    -
-

Contents of This Release

-

This release contains both binary and source -code. Note that neither the new trimming tool nor the Java Card -specifications are included in this -development kit release bundle. 

-

Note: This release fixes -the off-card verifier verification problem, recently reported by THALES -Information Systems Security, which is related to verification of -multiple execution paths with changed local variable types.

-

This release contains features required to support classic Java Card -applet applications on the card. Specifically, this release includes -the following:

-
    -
  • Java Card runtime environment (cref.exe)
  • -
  • Uninstaller tool
    -
  • -
  • Normalizer tool (normalizer.bat)
    -
  • -
  • APDU tool (apdutool.bat)
  • -
  • capdump tool
    -
  • -
  • capgen tool
    -
  • -
  • Converter tool (converter.bat)
  • -
  • exp2text tool
    -
  • -
  • on-card installer
  • -
  • maskgen tool
    -
  • -
  • off-card verifier tool
    -
  • -
  • scriptgen tool
    -
  • -
  • optional Ant tasks
    -
  • -
  • Sample applications
  • -
  • User's guide for this release in Development Kit User's Guide for -the Java Card Platform, Version 3.0.3, Classic Edition
  • -
-

Note: The debugging tool jcwde, which was in previous -releases, is no longer included. To develop and debug your classic -applets, you might want to use the Connected Edition development kit -and the NetBeans IDE, version 6.8 or higher, along with its Java Card -technology-specific plugin.

-
- -

3. Installation Instructions

-

For a more thorough description of the installation, contents and -use of the development kit, see Development -User's -Guide, -Java -Card -Platform, Version 3.0.3, Classic Edition -included in the download bundle for this release.

-

An automatic installer tool can be used to unpack the download file -containing this release. During download, you can choose to let the -installer tool unpack the download file into a directory of your choice -on your system or you can save the download file itself to your system.
-

-

Note: Do not -install the development kit software in any -directory that has a space in its name. For example, on a Windows -platform, do not install software in the c:\program files -directory, or any subdirectory of c:\program files, -because the program files element contains a space.
-

-

Note: Do not -install the trimming tool bundle into the directory containing this -development kit. The trimming tool must be installed into a separate -folder that is not within the installed development kit's folder. -

-

Note: Do not install this -version of the Java Card -development kit or trimming tool into an existing directory for an -older version. You must first uninstall the -previously installed version of the Java Card -development kit or trimming tool prior to installing this version into -the old -directory. Installing into the same directory without first -uninstalling could result in unpredictable behavior.

-

To install the Java Card development kit and associated software, -follow these steps:

-
    -
  1. Install the JDK version 6, Update 10 or later. This JDK -is -available from: http://www.oracle.com/technetwork/java/javase/downloads/index.html. - - - -
  2. -
  3. Install Apache Ant version 1.6.5 or later. The latest -version is available at: http://ant.apache.org/. - - - -
  4. -
  5. Install the GCC compiler. -The compiler Minimal GNU for Windows (MinGW), version 5.1.4 is -required.  It is available at http://sourceforge.net/projects/mingw, -while -its -installation -information is at http://www.mingw.org.
  6. -
  7. Download the Java Card development kit. Download and -store the development kit Java Archive (JAR) file in a -directory of your choice.
  8. -
  9. Run the development kit installer or use the command line. -Double -click -the -JAR -file -on -your system. If -the -JDK -is installed correctly, the jar file is recognized as an executable -jar and the automatic installer will -launch to step you through the remainder of the installation process.
    -
  10. -
-

Alternatively, you can use the command -line to unpack the JAR file using the following command:

-
-
java -jar Bundle-Filename
-
-
-Where Bundle-Filename is the downloaded development kit -JAR file.
-

By default, the development kit is installed in C:\JCDK3.0.3_ClassicEdition_RR -and its associated sub-directories. You can specify a different -directory if you wish.
-

-

The directory C:\JCDK3.0.3_ClassicEdition_RR (or -the alternate directory you specify during installation) is referred to -as JC_CLASSIC_HOME in these -release notes. When the development -kit installation is complete, JC_CLASSIC_HOME -contains the following:
-

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
JC_CLASSIC_HOME - These -release -notes.
-Copyright files.
-
docsJCDevKitUG-Classic-3_0_3.pdf  - - - - Development Kit User's Guide -for -the Java Card Platform, Version 3.0.3, Classic Edition.
-
docs\htmlThe HTML version of Development Kit User's Guide -for -the Java Card Platform, Version 3.0.3, Classic Edition.
-
docs\apduioJavadoc -tool files for use with APDU I/O described in the user's guide.
docs\rmiclientJavadoc -tool files for use with optional RMI implementation described in the -user's guide.
docs\apiJavadoc tool files for the API.
-
api_export_filesContains java, javacard, and javacardx directories of API -export files.
-
bin Development kit executable files.
samples\classic_applets Samples of basic classic applets, such as HelloWorld.
-
samples\reference_appsSamples of more robust classic -applets.
-
lib Configuration and JAR files for the API, tools.
-Third-party -libraries.
src Development kit source files. AVAILABLE ONLY IF YOU HAVE A -SOURCE BUNDLE.
Uninstaller\uninstaller.jarUninstalls the development kit.
-
legalLicense files.
-
-
- - -

4. Setting System Variables and Paths

-System variables and paths must be set before -running the development kit. See the Development -Kit -User's -Guide more details on how to set them. -Note that if you choose to set the variables -and paths each time you run the development kit rather than -permanently in your system, you can place the appropriate commands in a -batch file. -
    -
  • JAVA_HOME. You must set the JAVA_HOME -system variable to the JDK root directory before running the -development kit -
      -
    • To temporarily set JAVA_HOME from the command -line, enter the -command: set JAVA_HOME=c:\path before running the -development kit. For example, if the Java platform software is stored -in your c:\jdk6 directory, enter set JAVA_HOME=c:\jdk6 -before running the development kit.
    • -
    -
  • -
  • JC_CLASSIC_HOMEYou must set the  JC_CLASSIC_HOME -system variable to the directory in which the development kit is -installed before running the development kit.  
  • -
      -
    • To temporarily set JC_CLASSIC_HOME from the -command -line, enter the -command: set JC_CLASSIC_HOME=c:\path before -running the -development kit. For example, if the Java Card development kit is -stored -in your c:\JCDK3.0.3_ClassicEdition_RR -directory, enter set JC_CLASSIC_HOME=c:\JCDK3.0.3_ClassicEdition_RR -before running the development kit. 
    • -
    -
-
    -
  • Apache Ant. You -must set the ANT_HOME -system variable to the Apache Ant directory -before running the samples.
    -
  • -
      -
    • To temporarily set ANT_HOME from the command -line, enter the -command: set PATH=c:\path before running the -development kit. For example, if Apache Ant is stored -in your c:\ant\apache-ant1.6.5 -directory, enter set ANT_HOME=c:\ant\apache-ant1.6.5 -before running the development kit.
      -
    • -
    -
-
    -
  • MinGW. You must set the -path to the location of MinGW before running the -development kit. Note that the path has to -point to the \bin subdirectory of the MinGW installation -directory -where -the - - - - - - - - - - - - - - - - - - - - - - - - - - - gcc.exe file is located.  -
      -
    • To temporarily set the path to MinGW, enter the command set -PATH=c:\MinGW_path;%PATH%. For example, if MinGW is -installed in c:\MinGW, enter the command set -PATH=c:\MinGW\bin;%PATH% before running the development kit.
    • -
    -
  • -
-

Configuring the Java Card Runtime -Environment for the Samples
-

-

Note that the Java Card RE (cref) -implementation -is -not -optimized -for -memory -or -performance -and, therefore, requires -more memory than an actual optimized implementation on a card. To run -the Java Card RE, you can use the default executable, cref.bat, using the command -line as follows:
-

-

JC_CLASSIC_HOME\bin\cref.bat
-

- - -

5. Known Bugs

-For issues related to the new -trimming -tool, see its release notes in the separate trimming tool download -bundle.
-
- - - - - - - - - - - - - - -
6903384
-
Converter fails to generate cap -file if an applet imports some.other.package.Shareable interface.
-
6994105
-
Transaction does't work in -RandomData.generateData() with the ALG_PSEUDO_RANDOM algorithm.
6997670Verifier error with -debug: -Invalid variable count for non-abstract method XXX in class XYZ.
-
- -
-

6. Product Information and Feedback
-

-

The public Java Card technology web site is http://www.oracle.com/technetwork/java/javacard. -The -developer -collaboration -web -site -also -contains -information -about -Java -Card -technology -at -http://kenai.com/projects/javacard/pages/HOME.

-

If you are a Licensee, visit the product web site at https://java-partner.sun.com/portal/service/ent/platform/javacardgroup -This site has the most up-to-date information on the following:

-
    -
  • Product news and reviews
  • -
  • Release notes and product documentation
  • -
  • Technical support contact information
  • -
-

We greatly appreciate your feedback on this reference -Implementation. Please send all feedback to -jc3-ri-feedback@sun.com.

- -
-
-

Copyright © 1998, 2010, Oracle -and/or -its affiliates. All rights reserved.
-

- - diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/Uninstaller/uninstaller.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/Uninstaller/uninstaller.jar deleted file mode 100644 index 901ef2cf..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/Uninstaller/uninstaller.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/io/javacard/io.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/io/javacard/io.exp deleted file mode 100644 index 931133af..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/io/javacard/io.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/lang/javacard/lang.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/lang/javacard/lang.exp deleted file mode 100644 index f3498186..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/lang/javacard/lang.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/rmi/javacard/rmi.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/rmi/javacard/rmi.exp deleted file mode 100644 index 209cdf37..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/java/rmi/javacard/rmi.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/javacard/framework.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/javacard/framework.exp deleted file mode 100644 index 50b66e0c..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/javacard/framework.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/service/javacard/service.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/service/javacard/service.exp deleted file mode 100644 index 8fbef2f6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/framework/service/javacard/service.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/security/javacard/security.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/security/javacard/security.exp deleted file mode 100644 index 994455e6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacard/security/javacard/security.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/apdu/javacard/apdu.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/apdu/javacard/apdu.exp deleted file mode 100644 index c9183d4f..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/apdu/javacard/apdu.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/biometry/javacard/biometry.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/biometry/javacard/biometry.exp deleted file mode 100644 index fb46fa30..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/biometry/javacard/biometry.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/crypto/javacard/crypto.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/crypto/javacard/crypto.exp deleted file mode 100644 index 7146e93e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/crypto/javacard/crypto.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/external/javacard/external.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/external/javacard/external.exp deleted file mode 100644 index 4af91e53..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/external/javacard/external.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/math/javacard/math.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/math/javacard/math.exp deleted file mode 100644 index 89a1ac6c..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/math/javacard/math.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp deleted file mode 100644 index 58495fb0..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/tlv/javacard/tlv.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp deleted file mode 100644 index 881a9612..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/intx/javacard/intx.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/javacard/util.exp b/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/javacard/util.exp deleted file mode 100644 index 3ce0d16b..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/api_export_files/javacardx/framework/util/javacard/util.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/apdutool.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/apdutool.bat deleted file mode 100644 index 5bf369ee..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/apdutool.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute apdutool's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.apdutool.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capdump.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capdump.bat deleted file mode 100644 index a6d5221c..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capdump.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute capdump's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.capdump.CapDump %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capgen.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capgen.bat deleted file mode 100644 index 31aa8985..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/capgen.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute capgen's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.jcasm.cap.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/converter.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/converter.bat deleted file mode 100644 index c6ba6b04..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/converter.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute converter's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.converter.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref.bat deleted file mode 100644 index d0f442f0..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref.bat +++ /dev/null @@ -1,44 +0,0 @@ - -@echo off -rem -rem in Java Card 2 there was only cref.exe, but now we provide cref_t0.exe, -rem cref_t1.exe, and cref_tdual.exe. -rem -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem this batch file is provided as a easy way to call the new .exe's. -rem -rem "cref.bat args" will call "cref_tdual.exe args" -rem -rem "cref.bat -t0 args" will call "cref_t0.exe args" -rem "cref.bat -t1 args" will call "cref_t1.exe args" -rem "cref.bat -tdual args" will call "cref_tdual.exe args" -rem -setlocal -set list= -set target=cref_tdual -:loop -if "%1"=="" goto done -if "%1"=="-t0" ( - set target=cref_t0 - shift - goto loop -) -if "%1"=="-t1" ( - set target=cref_t1 - shift - goto loop -) -if "%1"=="-tdual" ( - set target=cref_tdual - shift - goto loop -) -set list=%list% %1 -shift -goto loop -:done -call %JC_CLASSIC_HOME%\bin\%target%.exe %list% -endlocal - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t0.exe b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t0.exe deleted file mode 100644 index 8080f5c6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t0.exe and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t1.exe b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t1.exe deleted file mode 100644 index 591f4a23..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_t1.exe and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_tdual.exe b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_tdual.exe deleted file mode 100644 index 8495dd87..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/cref_tdual.exe and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/exp2text.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/exp2text.bat deleted file mode 100644 index a2a97d27..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/exp2text.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute exp2text's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.converter.Exp2Text %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/normalizer.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/normalizer.bat deleted file mode 100644 index 90aa0cdc..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/normalizer.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute normalizer's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.normalizer.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/packager.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/packager.bat deleted file mode 100644 index 93ae8718..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/packager.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute packager's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.packager.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/scriptgen.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/scriptgen.bat deleted file mode 100644 index 3cff5ea0..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/scriptgen.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute scriptgen's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.scriptgen.Main %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifycap.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifycap.bat deleted file mode 100644 index 1191d283..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifycap.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute verifycap's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.offcardverifier.Verifier %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyexp.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyexp.bat deleted file mode 100644 index 75240f78..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyexp.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute verifyexp's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.offcardverifier.VerifyExp %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyrev.bat b/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyrev.bat deleted file mode 100644 index 7b51ce1f..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/bin/verifyrev.bat +++ /dev/null @@ -1,31 +0,0 @@ - -@echo off -setlocal -set JC_CLASSIC_HOME=%~dp0\.. -rem Print warning if no JAVA_HOME set -if not defined JAVA_HOME goto nojavahome - -rem set classpath to all jars - -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\ant-contrib-1.0b3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\asm-all-3.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\bcel-5.2.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-cli-1.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-codec-1.3.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-httpclient-3.0.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\commons-logging-1.1.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\jctasks.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\tools.jar;%JC_CLASSPATH% -set JC_CLASSPATH=%JC_CLASSIC_HOME%\lib\api_classic.jar;%JC_CLASSPATH% - -rem execute verifyrev's Main class -"%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.offcardverifier.VerifyRev %* -goto done -:nojavahome -echo JAVA_HOME is not set - please set it to point to JDK 1.6 -:done -endlocal - -rem Send the error code to the command interpreter -cmd /c Exit /B %errorlevel% - \ No newline at end of file diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/document.css b/JCMathLib/ext/java_card_kit-3_0_3-win/document.css deleted file mode 100644 index 825371ce..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/document.css +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * SCCS: %W% %E% - */ - - -/* font tag overwrite */ -font { - font-family:Arial, Helvetica, FreeSans, "Luxi-sans", "Nimbus Sans L", sans-serif; - font-size:14px; -} -/* font family */ -body, input, select, textarea, button { - font-family:Arial, Helvetica, FreeSans, "Luxi-sans", "Nimbus Sans L", sans-serif; - font-size:100%; -} -code, kbd, tt, pre { - font-family:Monaco, Courier, "Courier New"; - font-size:110%; -} -/* generic */ -body { - color:#000; -} -a { - color:#666; - text-decoration:none -} -a.href { - color:#666; - text-decoration:none -} -a.hover { - color:#F00; - text-decoration:none -} -a.visited { - color:#999; - text-decoration:none -} -a.link { - color:#F00; - text-decoration:none -} - -ol, ul { - margin:1ex; - padding-left:1ex; -} -li { - margin:1ex; - padding-left:0ex -} -dl { - margin:1.6ex; - padding-left:0ex; -} -dt { - margin:1ex; - padding-left:0ex -} - -tr {vertical-align:top;} - -table tr th { - background:#E5E5E6; - font-size:90%; - text-align:left; - vertical-align:top; - padding-left:1ex; -} -caption { - font-weight:bold; - font-size:85%; -} -/* hr */ -hr.light { - background:#E3E3E3; - color:#E3E3E3; - height:2px; - padding:0; - border:0 -} -hr.red { - background:#F00; - color:#F00; - height:2px; - padding:0; - border:0 -} - -div.MastheadPane { - height: 45px; - width: 100%; - top: 0; - right: 0; - bottom: auto; - left: 0; - overflow: hidden; - border-bottom: 3px #F00; - margin: 0; - text-decoration:none; -} -div.MastheadDateBuild { - height: 90px; - width: 100%; - top: 0; - right: 0; - bottom: auto; - left: 0; - overflow: visible; - border-bottom: 3px #F00; - text-decoration:none; -} -.MastheadPane tr td { - background:#fff; - background-color:#FFF; - padding: 0px; - margin: 0px; -} -.MastheadPane tr th { - background:#fff; - background-color:#FFF; - padding: 0px; - margin: 0px; -} -.MastheadDateBuild tr th { - background:#fff; - background-color:#FFF; - padding: 0px; - margin: 0px; -} -.MastheadDateBuild tr td { - background:#fff; - background-color:#FFF; - padding: 0px; - margin: 0px; -} - -table.MastheadTable { - width: 100%; - border-collapse:collapse; - padding: 0px; - margin: 0px; - background:#FFF; - background-color:#FFF -} -table.MastheadDateBuild { - width: 100%; - border-collapse:collapse; - margin: 0px; - padding: 0px; - background:#FFF; -} -div.MastheadPane a { - color: rgb(127, 127, 127); - background:#FFF; -} - -th.smallLogo { - width: 130px; - align: right; -} -td.smallLogo { - width: 130px; - align: right; -} -td.javaLogo { - width: 100px; - text-align: right; -} -.smallLogo img { - padding-right: 15px; -} -tr.breadcrumbbar { - margin: 0px; - height: 15px; -} -tr.titlebar { - height: 55px; - padding: 0px; - background-color:#FFF; -} -h4.contentpage-doctitle { - color: rgb(127, 127, 127); - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - font-size: 120%; - font-weight: bold; - text-align: left; - padding: 0px; - width: auto; -} - -p.breadcrumb a { - color: rgb(255, 0, 0); - font-weight: bold; -} -p.breadcrumb { - margin-bottom: 20px -} -div.MainContent a:visited { - color: rgb(127, 127, 127) -} -div.MainContent a { - color: rgb(0, 0, 0); - text-decoration:none -} -div.embeddedtoc { - margin: 0ex; -} -.embeddedtoc a { - color:#666; - text-decoration:none -} -.embeddedtoc a.href { - color:#666; - text-decoration:none -} -.embeddedtoc a.hover { - color:#F00; - text-decoration:none -} -.embeddedtoc a.visited { - color:#999; - text-decoration:none -} -.embeddedtoc a.link { - color:#666; - text-decoration:none -} -.embeddedtoc p { - margin-top: -1ex; -} -.embeddedtoc p.level1 a { - color: (127,127,127); - font-size: 100%; -} -.embeddedtoc p.level2 a { - color: rgb(127,127,127); - font-size: 90%; - margin-left: 3ex; -} -.embeddedtoc p.level3 a { - color: rgb(127,127,127); - font-size: 85%; - margin-left: 6ex; -} -.embeddedtoc p.level4 a { - color: rgb(127,127,127); - font-size: 85%; - margin-left: 9ex; -} -.embeddedtoc p.level5 a { - color: rgb(70,70,70); - font-size: 85%; - margin-left: 12ex; -} -div.BodyStyle { - width: 100%; - top: 100px; - right: 0; - bottom: 20px; - left: 0px; - margin: 0px; - overflow: hidden; - font-family:Arial, Helvetica, FreeSans, "Luxi-sans", "Nimbus Sans L", sans-serif; -} -BodyStyle a.href { - text-decoration:none -} -BodyStyle a.hover { - color:#F00 -} -BodyStyle a.visited { - color:#999 -} -BodyStyle a.link { - color:#666 -} - -p.navtop, p.navtop a { - font-size:85%; -} - -body { - padding: 1.5em; - margin: 0; - background-color: white; - font-size:14px; -} -h1+p, h2+p, h3+p, h4+p, h5+p { - margin-top: 0; -} -code, pre { - color: black; -} -pre { - background-color: #efefef; - border: 1px solid #ccc; - padding: 0.5em; - overflow: hidden; - font-size: 110%; -} -a img { - border-style: none; -} -div.TitleDiv { - margin-top: 30px; -} -h2.DocTitle { - color: rgb(127, 127, 127); - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - font-size: 115%; - font-weight: bold; - text-align: left; - text-decoration: none; - text-indent: 0px; - text-transform: none -} -h3.SubTitle { - color: rgb(127, 127, 127); - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - font-size: 90%; - font-weight: bold; - text-align: left; - text-decoration: none; - text-indent: 0px; - text-transform: none -} -h4.TitleDate { - color: rgb(127, 127, 127); - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - font-size: 80%; - font-weight: bold; - text-align: left; - text-decoration: none; - text-indent: 0px; - text-transform: none -} -.BodyStyle tr thead th { - text-align:left; - background-color:#fefefe; -} -.BodyStyle h1 { - margin-top: 1.25em; - margin-bottom: 0.5em; - color: rgb(127, 127, 127); -} -.BodyStyle h2 { - font-size: 125%; - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - margin-top: 1.25em; - margin-bottom: 0.5em; - color: rgb(127, 127, 127); -} -.BodyStyle h3 { - font-size: 115%; - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - margin-top: 1.25em; - color: rgb(127, 127, 127); - margin-bottom: 0.5em; -} -.BodyStyle h4 { - font-size: 105%; - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - margin-top: 1.25em; - margin-bottom: 0.5em; - color: rgb(127, 127, 127); -} -.BodyStyle h5 { - font-size: 95%; - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - margin-top: 1.25em; - margin-bottom: 0.5em; - color: rgb(127, 127, 127); -} -.BodyStyle h6 { - font-size: 85%; - font-family: "Univers LT Std", Univers, Arial, Helvetica, sans-serif; - margin-top: 1.25em; - margin-bottom: 0.5em; - color: rgb(127, 127, 127); -} -.BodyStyle table { - font-size:100%; - border-color:#CCC; - width:100%; - border:solid; - border-left:none; - border-right:none; - border-top:none; - border-bottom:medium; - border-width:medium; - -} diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/legal/Distribution_ReadME.txt b/JCMathLib/ext/java_card_kit-3_0_3-win/legal/Distribution_ReadME.txt deleted file mode 100644 index 37560c92..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/legal/Distribution_ReadME.txt +++ /dev/null @@ -1,21 +0,0 @@ -DistributionREADME - -DISTRIBUTION BY DEVELOPERS. Subject to the terms and conditions of the Software License Agreement and the obligations, restrictions, and exceptions set forth below, You may reproduce and distribute the portions of Software identified below ("Redistributable"), provided that: - -(a) You distribute Redistributable complete and unmodified and only bundled as part of Your Programs, - -(b) Your Programs add significant and primary functionality to the Redistributable, - -(c) You do not distribute additional software intended to replace any -component(s) of the Redistributable, - -(d) You do not remove or alter any proprietary legends or notices contained in or on the Redistributable. - -(e) You only distribute the Redistributable subject to a license agreement that protects Oracle's interests consistent with the terms contained in this -Agreement, and - -(f) You agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Redistributable. - -The following files are Redistributables: - -Java Card Development Kit 3.0.3 diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/legal/THIRDPARTYREADME.txt b/JCMathLib/ext/java_card_kit-3_0_3-win/legal/THIRDPARTYREADME.txt deleted file mode 100644 index 1c5c2c04..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/legal/THIRDPARTYREADME.txt +++ /dev/null @@ -1,1246 +0,0 @@ -DO NOT TRANSLATE OR LOCALIZE - -*************************************************************************** - -%%The following software may be included in this product: -ASM - -Use of any of this software is governed by the terms of the license below: - -Copyright (c) 2000-2005 INRIA, France Telecom -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. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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. - -*************************************************************************** - -%%The following software may be included in this product: -Izpack - -Use of any of this software is governed by the terms of the license below: - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this -License, each Contributor hereby grants to You a perpetual, worldwide, -non-exclusive, no-charge, royalty-free, irrevocable copyright license to -reproduce, prepare Derivative Works of, publicly display, publicly perform, -sublicense, and distribute the Work and such Derivative Works in Source or -Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, -each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) patent -license to make, have made, use, offer to sell, sell, import, and otherwise -transfer the Work, where such license applies only to those patent claims -licensable by such Contributor that are necessarily infringed by their -Contribution(s) alone or by combination of their Contribution(s) with the Work -to which such Contribution(s) was submitted. If You institute patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Work or a Contribution incorporated within the Work -constitutes direct or contributory patent infringement, then any patent licenses -granted to You under this License for that Work shall terminate as of the date -such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or -Derivative Works thereof in any medium, with or without modifications, and in -Source or Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works a copy -of this License; and - - 2. You must cause any modified files to carry prominent notices stating that -You changed the files; and - - 3. You must retain, in the Source form of any Derivative Works that You -distribute, all copyright, patent, trademark, and attribution notices from the -Source form of the Work, excluding those notices that do not pertain to any part -of the Derivative Works; and - - 4. If the Work includes a "NOTICE" text file as part of its distribution, -then any Derivative Works that You distribute must include a readable copy of -the attribution notices contained within such NOTICE file, excluding those -notices that do not pertain to any part of the Derivative Works, in at least one -of the following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. - -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any -Contribution intentionally submitted for inclusion in the Work by You to the -Licensor shall be under the terms and conditions of this License, without any -additional terms or conditions. Notwithstanding the above, nothing herein shall -supersede or modify the terms of any separate license agreement you may have -executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, -trademarks, service marks, or product names of the Licensor, except as required -for reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in -writing, Licensor provides the Work (and each Contributor provides its -Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied, including, without limitation, any warranties -or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any risks -associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in -tort (including negligence), contract, or otherwise, unless required by -applicable law (such as deliberate and grossly negligent acts) or agreed to in -writing, shall any Contributor be liable to You for damages, including any -direct, indirect, special, incidental, or consequential damages of any character -arising as a result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, work stoppage, -computer failure or malfunction, or any and all other commercial damages or -losses), even if such Contributor has been advised of the possibility of such -damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or -Derivative Works thereof, You may choose to offer, and charge a fee for, -acceptance of support, warranty, indemnity, or other liability obligations -and/or rights consistent with this License. However, in accepting such -obligations, You may act only on Your own behalf and on Your sole -responsibility, not on behalf of any other Contributor, and only if You agree to -indemnify, defend, and hold each Contributor harmless for any liability incurred -by, or claims asserted against, such Contributor by reason of your accepting any -such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -*************************************************************************** - -%%The following software may be included in this product: -Apache BCEL (Byte Code Engineering Library) - -Use of any of this software is governed by the terms of the license below: - -* Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "[]" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright [yyyy] [name of copyright owner] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -*************************************************************************** - -%%The following software may be included in this product: -Jetty HTTP Server - -Use of any of this software is governed by the terms of the license below: - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -Additional License(s) - -All source files carry one of three copyrights: - -Copyright (c) 1999 The Apache Software Foundation. All rights reserved. -Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved. -Copyright (c) 1996 Optimus Solutions Pty. Ltd. All rights reserved. - -One file is under the LGPL. This appears to be an oversight and it's -in an optional "extras" -component that we don't ship. - -*************************************************************************** - -%%The following software may be included in this product: -Apache Jakarta Commons - -Use of any of this software is governed by the terms of the license below: - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*************************************************************************** - -%%The following software may be included in this product: -Ant - -Use of any of this software is governed by the terms of the license below: - -License -The Apache Software License Version 2.0 - -The Apache Software License Version 2.0 applies to all releases of Ant starting -with ant 1.6.1 - -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "[]" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright [yyyy] Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -You can download the original license file here. - -The License is accompanied by a NOTICE - - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Ant distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - This product includes also software developed by : - - the W3C consortium (http://www.w3c.org) , - - the SAX project (http://www.saxproject.org) - - Please read the different LICENSE files present in the root directory of - this distribution. - - The names "Ant" and "Apache Software Foundation" must not be used to - endorse or promote products derived from this software without prior - written permission. For written permission, please contact - apache@apache.org. - -The Apache Software License, Version 1.1 - -The Apache Software License, Version 1.1, applies to all versions of up to ant -1.6.0 included. - -/* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 2000-2003 The Apache Software Foundation. All - * rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, 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. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Ant" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, 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. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see . - * - */ - - -Additional License(s) - -none - -*************************************************************************** - -%%The following software may be included in this product: -SAX - -Use of any of this software is governed by the terms of the license below: - -There is not a license - it is in the public domain - -Copyright Disclaimers - -This page includes statements to that effect by David Megginson, who would have -been able to claim copyright for the original work. - -SAX 1.0 - -Version 1.0 of the Simple API for XML (SAX), created collectively by the -membership of the XML-DEV mailing list, is hereby released into the public -domain. - -No one owns SAX: you may use it freely in both commercial and non-commercial -applications, bundle it with your software distribution, include it on a CD-ROM, -list the source code in a book, mirror the documentation at your own web site, -or use it in any other way you see fit. - -SAX 2.0 - -I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and -release all of the SAX 2.0 source code, compiled code, and documentation -contained in this distribution into the Public Domain. SAX comes with NO -WARRANTY or guarantee of fitness for any purpose. - - David Megginson, david@megginson.com - 2000-05-05 - -Additional License(s) - -Public domain software - -*************************************************************************** - -%%The following software may be included in this product: -Ant-Contrib - -Use of any of this software is governed by the terms of the license below: - -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001-2003 Ant-Contrib project. 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. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The name Ant-Contrib must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact - * ant-contrib-developers@lists.sourceforge.net. - * - * 5. Products derived from this software may not be called "Ant-Contrib" - * nor may "Ant-Contrib" appear in their names without prior written - * permission of the Ant-Contrib project. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 ANT-CONTRIB PROJECT OR ITS - * CONTRIBUTORS 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. - * ==================================================================== - */ - -*************************************************************************** - - diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/ant-contrib-1.0b3.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/ant-contrib-1.0b3.jar deleted file mode 100644 index 06253766..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/ant-contrib-1.0b3.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_classic.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_classic.jar deleted file mode 100644 index a7d5bb5e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_classic.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_connected.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_connected.jar deleted file mode 100644 index 14812ba6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/api_connected.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/asm-all-3.1.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/asm-all-3.1.jar deleted file mode 100644 index 5f37af52..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/asm-all-3.1.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/bcel-5.2.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/bcel-5.2.jar deleted file mode 100644 index 2fa90ceb..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/bcel-5.2.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-cli-1.0.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-cli-1.0.jar deleted file mode 100644 index 22a004e1..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-cli-1.0.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-codec-1.3.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-codec-1.3.jar deleted file mode 100644 index 957b6752..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-codec-1.3.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-httpclient-3.0.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-httpclient-3.0.jar deleted file mode 100644 index 54a9300e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-httpclient-3.0.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-logging-1.1.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-logging-1.1.jar deleted file mode 100644 index 2ff9bbd9..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/commons-logging-1.1.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/jctasks.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/jctasks.jar deleted file mode 100644 index 5026df38..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/jctasks.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/logging.properties b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/logging.properties deleted file mode 100644 index 5f34c9d5..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/logging.properties +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) 2010, 2010, Oracle and/or its affiliates. All rights reserved. - -# Properties file which configures the operation of the JDK -# logging facility. - -# The system will look for this config file, first using -# a System property specified at startup: -# -# >java -Djava.util.logging.config.file=myLoggingConfigFilePath -# -# If this property is not specified, then the config file is -# retrieved from its default location at: -# -# JDK_HOME/jre/lib/logging.properties - -# Global logging properties. -# ------------------------------------------ -# The set of handlers to be loaded upon startup. -# Comma-separated list of class names. -# java.util.logging.ConsoleHandler -handlers=com.sun.javacard.tools.util.JCConsoleHandler, java.util.logging.FileHandler - -# Default global logging level. -# Loggers and Handlers may override this level -.level=ALL - -# Loggers -# ------------------------------------------ -# Loggers are usually attached to packages. -# Here, the level for each package is specified. -# The global level is used by default, so levels -# specified here simply act as an override. -#com.sun.javacard.offcardinstaller=ALL - -# Handlers -# ----------------------------------------- - -com.sun.javacard.tools.util.JCConsoleHandler.level=ALL -com.sun.javacard.tools.util.JCConsoleHandler.formatter=com.sun.javacard.tools.util.JCToolsFormatter -com.sun.javacard.tools.util.JCConsoleHandler.filter=com.sun.javacard.tools.util.ConsoleFilter - -# --- FileHandler --- -# Override of global logging level -java.util.logging.FileHandler.level=ALL - -# Naming style for the output file: -# (The output file is placed in the directory -# defined by the "user.home" System property.) -java.util.logging.FileHandler.pattern=%h/java%u.log - -# Limiting size of output file in bytes: -java.util.logging.FileHandler.limit=50000 - -# Number of output files to cycle through, by appending an -# integer to the base file name: -java.util.logging.FileHandler.count=10 - -# Style of output (Simple or XML): -java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter - -java.util.logging.FileHandler.append=true - -#--------------print class method info -printCurrentClassAndMethod = false diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/tools.jar b/JCMathLib/ext/java_card_kit-3_0_3-win/lib/tools.jar deleted file mode 100644 index f5c9b235..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/lib/tools.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori.gif deleted file mode 100644 index 10eab907..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_interval.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_interval.gif deleted file mode 100644 index 3230819a..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_interval.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_small.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_small.gif deleted file mode 100644 index fdb90305..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/Java_clr_hori_small.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/downicon.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/downicon.gif deleted file mode 100644 index d178dd6e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/downicon.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/oracle.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/oracle.gif deleted file mode 100644 index 4a988273..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/oracle.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/smallOracleLogo.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/smallOracleLogo.gif deleted file mode 100644 index d06d49db..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/smallOracleLogo.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/topicon.gif b/JCMathLib/ext/java_card_kit-3_0_3-win/shared/topicon.gif deleted file mode 100644 index f4dfbf3f..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3-win/shared/topicon.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/COPYRIGHT.html b/JCMathLib/ext/java_card_kit-3_0_3/COPYRIGHT.html deleted file mode 100644 index 66af699d..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3/COPYRIGHT.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - Copyright - - -
Copyright © 1998, 2010, -Oracle and/or its affiliates. All rights reserved.
-
-

This software and related documentation are provided under a license -agreement containing restrictions on use and disclosure and are -protected by intellectual property laws. Except as expressly permitted -in your license agreement or allowed by law, you may not use, copy, -reproduce, translate, broadcast, modify, license, transmit, distribute, -exhibit, perform, publish, or display any part, in any form, or by any -means. Reverse engineering, disassembly, or decompilation of this -software, unless required by law for interoperability, is prohibited.

-

The information contained herein is subject to change without notice -and is not warranted to be error-free. If you find any errors, please -report them to us in writing.

-

If this is software or related software documentation that is -delivered to the U.S. Government or anyone licensing it on behalf of -the U.S. Government, the following notice is applicable:

-

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related -documentation and technical data delivered to U.S. Government customers -are "commercial computer software" or "commercial technical data" -pursuant to the applicable Federal Acquisition Regulation and -agency-specific supplemental regulations. As such, the use, -duplication, disclosure, modification, and adaptation shall be subject -to the restrictions and license terms set forth in the applicable -Government contract, and, to the extent applicable by the terms of the -Government contract, the additional rights set forth in FAR 52.227-19, -Commercial Computer Software License (December 2007). Oracle USA, Inc., -500 Oracle Parkway, Redwood City, CA 94065.

-

This software or hardware is developed for general use in a variety -of information management applications. It is not developed or intended -for use in any inherently dangerous applications, including -applications which may create a risk of personal injury. If you use -this software or hardware in dangerous applications, then you shall be -responsible to take all appropriate fail-safe, backup, redundancy, and -other measures to ensure the safe use. Oracle Corporation and its -affiliates disclaim any liability for any damages caused by use of this -software or hardware in dangerous applications.

-

Oracle and Java are registered trademarks of Oracle Corporation -and/or its -affiliates. Oracle and Java are registered trademarks of Oracle and/or -its affiliates. Other names may be trademarks of their respective -owners.

-

AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks -or registered trademarks of Advanced Micro Devices. Intel and Intel -Xeon are trademarks or registered trademarks of Intel Corporation. All -SPARC trademarks are used under license and are trademarks or -registered trademarks of SPARC International, Inc. UNIX is a registered -trademark licensed through X/Open Company, Ltd.

-

This software or hardware and documentation may provide access to or -information on content, products, and services from third parties. -Oracle Corporation and its affiliates are not responsible for and -expressly disclaim all warranties of any kind with respect to -third-party content, products, and services. Oracle Corporation and its -affiliates will not be responsible for any loss, costs, or damages -incurred due to your access to or use of third-party content, products, -or services.
-

-
-Copyright © 1998, 2010, Oracle -et/ou ses affiliés. -Tous droits réservés. - -

Ce logiciel et la documentation qui l’accompagne sont -protégés par les -lois sur la propriété intellectuelle. Ils sont -concédés sous licence et soumis à -des restrictions d’utilisation et de divulgation. Sauf disposition de -votre contrat de licence ou -de la loi, vous ne pouvez pas copier, reproduire, traduire, diffuser, -modifier, breveter, -transmettre, distribuer, exposer, exécuter, publier ou afficher -le logiciel, même partiellement, sous quelque forme -et par quelque procédé que ce soit. Par ailleurs, il est -interdit de -procéder à toute ingénierie inverse du logiciel, -de le désassembler ou de le décompiler, -excepté à des fins d’interopérabilité avec -des logiciels tiers ou tel que prescrit par -la loi.

-

Les informations fournies dans ce document sont susceptibles de -modification sans préavis. -Par ailleurs, Oracle Corporation ne garantit pas qu’elles soient -exemptes d’erreurs et vous invite, -le cas échéant, à lui en faire part par -écrit.

-

Si ce logiciel, ou -la documentation qui l’accompagne, est concédé sous -licence au Gouvernement des Etats-Unis, ou à -toute entité qui délivre la licence de ce logiciel ou -l’utilise pour le -compte du Gouvernement des Etats-Unis, la notice suivante s’applique:

-

U.S. GOVERNMENT RIGHTS. Programs, -software, databases, and related documentation and technical data -delivered to U.S. Government customers are -"commercial computer software" or "commercial technical data" pursuant -to the applicable Federal Acquisition -Regulation and agency-specific supplemental regulations. As such, the -use, duplication, disclosure, modification, and -adaptation shall be subject to the restrictions and license terms set -forth in -the applicable Government contract, and, to the extent applicable by -the terms of the -Government contract, the additional rights set forth in FAR 52.227-19, -Commercial Computer Software -License (December 2007). Oracle America, Inc., 500 Oracle Parkway, -Redwood City, CA -94065.

-

Ce logiciel ou matériel a été -développé pour un usage général dans le -cadre d’applications de gestion des informations. Ce logiciel ou -matériel n’est pas conçu ni -n’est destiné à être utilisé dans des -applications à risque, notamment dans des applications -pouvant causer des dommages corporels. Si vous utilisez ce logiciel ou -matériel dans -le cadre d’applications dangereuses, il est de votre -responsabilité de prendre toutes les mesures -de secours, de sauvegarde, de redondance et autres mesures -nécessaires à son utilisation -dans des conditions optimales de sécurité. Oracle -Corporation et ses affiliés déclinent toute -responsabilité -quant aux dommages causés par l’utilisation de ce logiciel ou -matériel pour ce type -d’applications.

-

Oracle et Java sont des marques déposées d’Oracle -Corporation et/ou de ses affiliés.Tout -autre nom mentionné peut correspondre à des marques -appartenant à d’autres propriétaires qu’Oracle.

-

AMD, Opteron, -le logo AMD et le logo AMD Opteron sont des marques ou des -marques déposées d’Advanced Micro Devices. Intel et Intel -Xeon sont des marques ou -des marques déposées d’Intel Corporation. Toutes les -marques SPARC sont utilisées sous licence et -sont des marques ou des marques déposées de SPARC -International, Inc. UNIX est une -marque déposée concédée sous licence par -X/Open Company, Ltd.

-

Ce logiciel ou matériel et -la documentation qui l’accompagne peuvent fournir des informations ou -des liens donnant accès à -des contenus, des produits et des services émanant de tiers. -Oracle Corporation et -ses affiliés déclinent toute responsabilité ou -garantie expresse quant aux contenus, produits ou services -émanant de tiers. En aucun cas, Oracle Corporation et ses -affiliés ne sauraient -être tenus pour responsables des pertes subies, des coûts -occasionnés ou des dommages causés -par l’accès à des contenus, produits ou services tiers, -ou à leur utilisation.
-

-

-
- - diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/io/javacard/io.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/io/javacard/io.exp deleted file mode 100644 index 931133af..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/io/javacard/io.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/lang/javacard/lang.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/lang/javacard/lang.exp deleted file mode 100644 index f3498186..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/lang/javacard/lang.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/rmi/javacard/rmi.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/rmi/javacard/rmi.exp deleted file mode 100644 index 209cdf37..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/java/rmi/javacard/rmi.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/javacard/framework.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/javacard/framework.exp deleted file mode 100644 index 50b66e0c..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/javacard/framework.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/service/javacard/service.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/service/javacard/service.exp deleted file mode 100644 index 8fbef2f6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/framework/service/javacard/service.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/security/javacard/security.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/security/javacard/security.exp deleted file mode 100644 index 994455e6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacard/security/javacard/security.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/apdu/javacard/apdu.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/apdu/javacard/apdu.exp deleted file mode 100644 index c9183d4f..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/apdu/javacard/apdu.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/biometry/javacard/biometry.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/biometry/javacard/biometry.exp deleted file mode 100644 index fb46fa30..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/biometry/javacard/biometry.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/crypto/javacard/crypto.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/crypto/javacard/crypto.exp deleted file mode 100644 index 7146e93e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/crypto/javacard/crypto.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/external/javacard/external.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/external/javacard/external.exp deleted file mode 100644 index 4af91e53..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/external/javacard/external.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/math/javacard/math.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/math/javacard/math.exp deleted file mode 100644 index 89a1ac6c..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/math/javacard/math.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/tlv/javacard/tlv.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/tlv/javacard/tlv.exp deleted file mode 100644 index 58495fb0..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/tlv/javacard/tlv.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/intx/javacard/intx.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/intx/javacard/intx.exp deleted file mode 100644 index 881a9612..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/intx/javacard/intx.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/javacard/util.exp b/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/javacard/util.exp deleted file mode 100644 index 3ce0d16b..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/javacard/util.exp and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/legal/Distribution_ReadME.txt b/JCMathLib/ext/java_card_kit-3_0_3/legal/Distribution_ReadME.txt deleted file mode 100644 index 37560c92..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3/legal/Distribution_ReadME.txt +++ /dev/null @@ -1,21 +0,0 @@ -DistributionREADME - -DISTRIBUTION BY DEVELOPERS. Subject to the terms and conditions of the Software License Agreement and the obligations, restrictions, and exceptions set forth below, You may reproduce and distribute the portions of Software identified below ("Redistributable"), provided that: - -(a) You distribute Redistributable complete and unmodified and only bundled as part of Your Programs, - -(b) Your Programs add significant and primary functionality to the Redistributable, - -(c) You do not distribute additional software intended to replace any -component(s) of the Redistributable, - -(d) You do not remove or alter any proprietary legends or notices contained in or on the Redistributable. - -(e) You only distribute the Redistributable subject to a license agreement that protects Oracle's interests consistent with the terms contained in this -Agreement, and - -(f) You agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Redistributable. - -The following files are Redistributables: - -Java Card Development Kit 3.0.3 diff --git a/JCMathLib/ext/java_card_kit-3_0_3/legal/THIRDPARTYREADME.txt b/JCMathLib/ext/java_card_kit-3_0_3/legal/THIRDPARTYREADME.txt deleted file mode 100644 index 1c5c2c04..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3/legal/THIRDPARTYREADME.txt +++ /dev/null @@ -1,1246 +0,0 @@ -DO NOT TRANSLATE OR LOCALIZE - -*************************************************************************** - -%%The following software may be included in this product: -ASM - -Use of any of this software is governed by the terms of the license below: - -Copyright (c) 2000-2005 INRIA, France Telecom -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. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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. - -*************************************************************************** - -%%The following software may be included in this product: -Izpack - -Use of any of this software is governed by the terms of the license below: - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this -License, each Contributor hereby grants to You a perpetual, worldwide, -non-exclusive, no-charge, royalty-free, irrevocable copyright license to -reproduce, prepare Derivative Works of, publicly display, publicly perform, -sublicense, and distribute the Work and such Derivative Works in Source or -Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, -each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) patent -license to make, have made, use, offer to sell, sell, import, and otherwise -transfer the Work, where such license applies only to those patent claims -licensable by such Contributor that are necessarily infringed by their -Contribution(s) alone or by combination of their Contribution(s) with the Work -to which such Contribution(s) was submitted. If You institute patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Work or a Contribution incorporated within the Work -constitutes direct or contributory patent infringement, then any patent licenses -granted to You under this License for that Work shall terminate as of the date -such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or -Derivative Works thereof in any medium, with or without modifications, and in -Source or Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works a copy -of this License; and - - 2. You must cause any modified files to carry prominent notices stating that -You changed the files; and - - 3. You must retain, in the Source form of any Derivative Works that You -distribute, all copyright, patent, trademark, and attribution notices from the -Source form of the Work, excluding those notices that do not pertain to any part -of the Derivative Works; and - - 4. If the Work includes a "NOTICE" text file as part of its distribution, -then any Derivative Works that You distribute must include a readable copy of -the attribution notices contained within such NOTICE file, excluding those -notices that do not pertain to any part of the Derivative Works, in at least one -of the following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. - -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any -Contribution intentionally submitted for inclusion in the Work by You to the -Licensor shall be under the terms and conditions of this License, without any -additional terms or conditions. Notwithstanding the above, nothing herein shall -supersede or modify the terms of any separate license agreement you may have -executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, -trademarks, service marks, or product names of the Licensor, except as required -for reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in -writing, Licensor provides the Work (and each Contributor provides its -Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied, including, without limitation, any warranties -or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any risks -associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in -tort (including negligence), contract, or otherwise, unless required by -applicable law (such as deliberate and grossly negligent acts) or agreed to in -writing, shall any Contributor be liable to You for damages, including any -direct, indirect, special, incidental, or consequential damages of any character -arising as a result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, work stoppage, -computer failure or malfunction, or any and all other commercial damages or -losses), even if such Contributor has been advised of the possibility of such -damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or -Derivative Works thereof, You may choose to offer, and charge a fee for, -acceptance of support, warranty, indemnity, or other liability obligations -and/or rights consistent with this License. However, in accepting such -obligations, You may act only on Your own behalf and on Your sole -responsibility, not on behalf of any other Contributor, and only if You agree to -indemnify, defend, and hold each Contributor harmless for any liability incurred -by, or claims asserted against, such Contributor by reason of your accepting any -such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -*************************************************************************** - -%%The following software may be included in this product: -Apache BCEL (Byte Code Engineering Library) - -Use of any of this software is governed by the terms of the license below: - -* Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "[]" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright [yyyy] [name of copyright owner] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -*************************************************************************** - -%%The following software may be included in this product: -Jetty HTTP Server - -Use of any of this software is governed by the terms of the license below: - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -Additional License(s) - -All source files carry one of three copyrights: - -Copyright (c) 1999 The Apache Software Foundation. All rights reserved. -Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved. -Copyright (c) 1996 Optimus Solutions Pty. Ltd. All rights reserved. - -One file is under the LGPL. This appears to be an oversight and it's -in an optional "extras" -component that we don't ship. - -*************************************************************************** - -%%The following software may be included in this product: -Apache Jakarta Commons - -Use of any of this software is governed by the terms of the license below: - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*************************************************************************** - -%%The following software may be included in this product: -Ant - -Use of any of this software is governed by the terms of the license below: - -License -The Apache Software License Version 2.0 - -The Apache Software License Version 2.0 applies to all releases of Ant starting -with ant 1.6.1 - -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "[]" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright [yyyy] Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -You can download the original license file here. - -The License is accompanied by a NOTICE - - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Ant distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - This product includes also software developed by : - - the W3C consortium (http://www.w3c.org) , - - the SAX project (http://www.saxproject.org) - - Please read the different LICENSE files present in the root directory of - this distribution. - - The names "Ant" and "Apache Software Foundation" must not be used to - endorse or promote products derived from this software without prior - written permission. For written permission, please contact - apache@apache.org. - -The Apache Software License, Version 1.1 - -The Apache Software License, Version 1.1, applies to all versions of up to ant -1.6.0 included. - -/* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * - * Copyright (C) 2000-2003 The Apache Software Foundation. All - * rights reserved. - * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, 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. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Ant" and "Apache Software Foundation" must not be used to - * endorse or promote products derived from this software without prior - * written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, 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. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation. For more information on the - * Apache Software Foundation, please see . - * - */ - - -Additional License(s) - -none - -*************************************************************************** - -%%The following software may be included in this product: -SAX - -Use of any of this software is governed by the terms of the license below: - -There is not a license - it is in the public domain - -Copyright Disclaimers - -This page includes statements to that effect by David Megginson, who would have -been able to claim copyright for the original work. - -SAX 1.0 - -Version 1.0 of the Simple API for XML (SAX), created collectively by the -membership of the XML-DEV mailing list, is hereby released into the public -domain. - -No one owns SAX: you may use it freely in both commercial and non-commercial -applications, bundle it with your software distribution, include it on a CD-ROM, -list the source code in a book, mirror the documentation at your own web site, -or use it in any other way you see fit. - -SAX 2.0 - -I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and -release all of the SAX 2.0 source code, compiled code, and documentation -contained in this distribution into the Public Domain. SAX comes with NO -WARRANTY or guarantee of fitness for any purpose. - - David Megginson, david@megginson.com - 2000-05-05 - -Additional License(s) - -Public domain software - -*************************************************************************** - -%%The following software may be included in this product: -Ant-Contrib - -Use of any of this software is governed by the terms of the license below: - -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001-2003 Ant-Contrib project. 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. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The name Ant-Contrib must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact - * ant-contrib-developers@lists.sourceforge.net. - * - * 5. Products derived from this software may not be called "Ant-Contrib" - * nor may "Ant-Contrib" appear in their names without prior written - * permission of the Ant-Contrib project. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 ANT-CONTRIB PROJECT OR ITS - * CONTRIBUTORS 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. - * ==================================================================== - */ - -*************************************************************************** - - diff --git a/JCMathLib/ext/java_card_kit-3_0_3/lib/api_classic.jar b/JCMathLib/ext/java_card_kit-3_0_3/lib/api_classic.jar deleted file mode 100644 index a7d5bb5e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/lib/api_classic.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/lib/api_connected.jar b/JCMathLib/ext/java_card_kit-3_0_3/lib/api_connected.jar deleted file mode 100644 index 14812ba6..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/lib/api_connected.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/lib/logging.properties b/JCMathLib/ext/java_card_kit-3_0_3/lib/logging.properties deleted file mode 100644 index 5f34c9d5..00000000 --- a/JCMathLib/ext/java_card_kit-3_0_3/lib/logging.properties +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) 2010, 2010, Oracle and/or its affiliates. All rights reserved. - -# Properties file which configures the operation of the JDK -# logging facility. - -# The system will look for this config file, first using -# a System property specified at startup: -# -# >java -Djava.util.logging.config.file=myLoggingConfigFilePath -# -# If this property is not specified, then the config file is -# retrieved from its default location at: -# -# JDK_HOME/jre/lib/logging.properties - -# Global logging properties. -# ------------------------------------------ -# The set of handlers to be loaded upon startup. -# Comma-separated list of class names. -# java.util.logging.ConsoleHandler -handlers=com.sun.javacard.tools.util.JCConsoleHandler, java.util.logging.FileHandler - -# Default global logging level. -# Loggers and Handlers may override this level -.level=ALL - -# Loggers -# ------------------------------------------ -# Loggers are usually attached to packages. -# Here, the level for each package is specified. -# The global level is used by default, so levels -# specified here simply act as an override. -#com.sun.javacard.offcardinstaller=ALL - -# Handlers -# ----------------------------------------- - -com.sun.javacard.tools.util.JCConsoleHandler.level=ALL -com.sun.javacard.tools.util.JCConsoleHandler.formatter=com.sun.javacard.tools.util.JCToolsFormatter -com.sun.javacard.tools.util.JCConsoleHandler.filter=com.sun.javacard.tools.util.ConsoleFilter - -# --- FileHandler --- -# Override of global logging level -java.util.logging.FileHandler.level=ALL - -# Naming style for the output file: -# (The output file is placed in the directory -# defined by the "user.home" System property.) -java.util.logging.FileHandler.pattern=%h/java%u.log - -# Limiting size of output file in bytes: -java.util.logging.FileHandler.limit=50000 - -# Number of output files to cycle through, by appending an -# integer to the base file name: -java.util.logging.FileHandler.count=10 - -# Style of output (Simple or XML): -java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter - -java.util.logging.FileHandler.append=true - -#--------------print class method info -printCurrentClassAndMethod = false diff --git a/JCMathLib/ext/java_card_kit-3_0_3/lib/tools.jar b/JCMathLib/ext/java_card_kit-3_0_3/lib/tools.jar deleted file mode 100644 index f5c9b235..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/lib/tools.jar and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori.gif deleted file mode 100644 index 10eab907..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_interval.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_interval.gif deleted file mode 100644 index 3230819a..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_interval.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_small.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_small.gif deleted file mode 100644 index fdb90305..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/Java_clr_hori_small.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/downicon.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/downicon.gif deleted file mode 100644 index d178dd6e..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/downicon.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/oracle.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/oracle.gif deleted file mode 100644 index 4a988273..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/oracle.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/smallOracleLogo.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/smallOracleLogo.gif deleted file mode 100644 index d06d49db..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/smallOracleLogo.gif and /dev/null differ diff --git a/JCMathLib/ext/java_card_kit-3_0_3/shared/topicon.gif b/JCMathLib/ext/java_card_kit-3_0_3/shared/topicon.gif deleted file mode 100644 index f4dfbf3f..00000000 Binary files a/JCMathLib/ext/java_card_kit-3_0_3/shared/topicon.gif and /dev/null differ diff --git a/JCMathLib/jcbuild.xml b/JCMathLib/jcbuild.xml deleted file mode 100644 index 4016b5be..00000000 --- a/JCMathLib/jcbuild.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JCMathLib/src/opencrypto/jcmathlib/Base_Helper.java b/JCMathLib/src/opencrypto/jcmathlib/Base_Helper.java deleted file mode 100644 index 35267954..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/Base_Helper.java +++ /dev/null @@ -1,88 +0,0 @@ -package opencrypto.jcmathlib; - -/** - * - * @author Petr Svenda - */ -public class Base_Helper { - final ResourceManager rm; - - /** - * Helper flag which signalizes that code is executed inside simulator - * (during tests). Is used to address simulator specific behaviour - * workaround if required. - */ - public boolean bIsSimulator = false; - - public Base_Helper(ResourceManager resman) { - rm = resman; - } - - /** - * Lock/reserve provided object for subsequent use. Used to protect - * corruption of pre-allocated shared objects in different, potentially - * nested, operations. Must be unlocked later on. - * - * @param objToLock array to be locked - * @throws SW_ALREADYLOCKED if already locked (is already in use by other - * operation) - */ -/* - public void lock(Object objToLock) { - rm.locker.lock(objToLock); - } -*/ - public void lock(byte[] objToLock) { - rm.locker.lock(objToLock); - } - - /** - * Unlock/release object from use. Used to protect corruption of - * pre-allocated objects used in different nested operations. Must be locked - * before. - * - * @param objToUnlock object to unlock - * @throws SW_NOTLOCKED_BIGNAT if was not locked before (inconsistence in - * lock/unlock sequence) - */ -/* - public void unlock(Object objToUnlock) { - rm.locker.unlock(objToUnlock); - } -*/ - public void unlock(byte[] objToUnlock) { - rm.locker.unlock(objToUnlock); - } - - /** - * Unlocks all locked objects - */ - public void unlockAll() { - rm.locker.unlockAll(); - } - - /** - * Check if provided object is logically locked - * - * @param objToUnlock object to be checked - * @return true of array is logically locked, false otherwise - */ -/* - public boolean isLocked(Object objToUnlock) { - return rm.locker.isLocked(objToUnlock); - } -*/ - /** - * Allocates new byte[] array with provided length either in RAM or EEPROM - * based on an allocator type. Method updates internal counters of bytes - * allocated with specific allocator. Use {@code getAllocatedInRAM()} or - * {@code getAllocatedInEEPROM} for counters readout. - * - * @param length length of array - * @param allocatorType type of allocator - * @return allocated array - */ - public byte[] allocateByteArray(short length, byte allocatorType) { - return rm.memAlloc.allocateByteArray(length, allocatorType); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/Bignat.java b/JCMathLib/src/opencrypto/jcmathlib/Bignat.java deleted file mode 100644 index 349995fe..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/Bignat.java +++ /dev/null @@ -1,1933 +0,0 @@ -/** - * Credits: Based on Bignat library from OV-chip project https://ovchip.cs.ru.nl/OV-chip_2.0 by Radboud University Nijmegen - */ -package opencrypto.jcmathlib; - -import javacard.framework.ISOException; -import javacard.framework.JCSystem; -import javacard.framework.Util; -import javacardx.crypto.Cipher; - -/** - * - * @author Vasilios Mavroudis and Petr Svenda - */ -public class Bignat { - private final Bignat_Helper bnh; - /** - * Configuration flag controlling re-allocation of internal array. If true, internal Bignat buffer can be enlarged during clone - * operation if required (keep false to prevent slow reallocations) - */ - boolean ALLOW_RUNTIME_REALLOCATION = false; - - /** - * Configuration flag controlling clearing of shared Bignats on lock as prevention of unwanted leak of sensitive information from previous operation. - * If true, internal storage array is erased once Bignat is locked for use - */ - boolean ERASE_ON_LOCK = false; - /** - * Configuration flag controlling clearing of shared Bignats on unlock as - * prevention of unwanted leak of sensitive information to next operation. - * If true, internal storage array is erased once Bignat is unlocked from use - */ - boolean ERASE_ON_UNLOCK = false; - - /** - * Factor for converting digit size into short length. 1 for the short/short - * converting, 4 for the int/long configuration. - * - */ - public static final short size_multiplier = 1; - - /** - * Bitmask for extracting a digit out of a longer int/short value. short - * 0xff for the short/short configuration, long 0xffffffffL the int/long - * configuration. - */ - public static final short digit_mask = 0xff; - - /** - * Bitmask for the highest bit in a digit. short 0x80 for the short/short - * configuration, long 0x80000000 for the int/long configuration. - * - */ - public static final short digit_first_bit_mask = 0x80; - - /** - * Bitmask for the second highest bit in a digit. short 0x40 for the - * short/short configuration, long 0x40000000 for the int/long - * configuration. - * - */ - public static final short digit_second_bit_mask = 0x40; - - /** - * Bitmask for the two highest bits in a digit. short 0xC0 for the - * short/short configuration, long 0xC0000000 for the int/long - * configuration. - * - */ - public static final short digit_first_two_bit_mask = 0xC0; - - /** - * Size in bits of one digit. 8 for the short/short configuration, 32 for - * the int/long configuration. - */ - public static final short digit_len = 8; - - /** - * Size in bits of a double digit. 16 for the short/short configuration, 64 - * for the int/long configuration. - */ - private static final short double_digit_len = 16; - - /** - * Bitmask for erasing the sign bit in a double digit. short 0x7fff for the - * short/short configuration, long 0x7fffffffffffffffL for the int/long - * configuration. - */ - private static final short positive_double_digit_mask = 0x7fff; - - /** - * Bitmask for the highest bit in a double digit. - */ - public static final short highest_digit_bit = (short) (1L << (digit_len - 1)); - - /** - * The base as a double digit. The base is first value that does not fit - * into a single digit. 2^8 for the short/short configuration and 2^32 for - * the int/long configuration. - */ - public static final short bignat_base = (short) (1L << digit_len); - - /** - * Bitmask with just the highest bit in a double digit. - */ - public static final short highest_double_digit_bit = (short) (1L << (double_digit_len - 1)); - - /** - * Digit array. Elements have type byte. - */ - - /** - * Internal storage array for this Bignat. The current version uses byte array with - * intermediate values stored which can be quickly processed with - */ - private byte[] value; - private short size = -1; // Current size of stored Bignat. Current number is encoded in first {@code size} of value array, starting from value[0] - private short max_size = -1; // Maximum size of this Bignat. Corresponds to value.length - private byte allocatorType = JCSystem.MEMORY_TYPE_PERSISTENT; // Memory storage type for value buffer - - private boolean bLocked = false; // Logical flag to store info if this Bignat is currently used for some operation. Used as a prevention of unintentional parallel use of same temporary pre-allocated Bignats. - - /** - * Construct a Bignat of size {@code size} in shorts. Allocated in EEPROM or RAM based on - * {@code allocatorType}. JCSystem.MEMORY_TYPE_PERSISTENT, in RAM otherwise. - * - * @param size the size of the new Bignat in bytes - * @param allocatorType type of allocator storage - * JCSystem.MEMORY_TYPE_PERSISTENT => EEPROM (slower writes, but RAM is saved) - * JCSystem.MEMORY_TYPE_TRANSIENT_RESET => RAM - * JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT => RAM - * @param bignatHelper {@code Bignat_Helper} class with helper objects - */ - public Bignat(short size, byte allocatorType, Bignat_Helper bignatHelper) { - this.bnh = bignatHelper; - allocate_storage_array(size, allocatorType); - } - - /** - * Construct a Bignat with provided array used as internal storage as well as initial value. - * No copy of array is made. If this Bignat is used in operation which modifies the Bignat value, - * content of provided array is changed. - * @param valueBuffer internal storage - * @param bignatHelper {@code Bignat_Helper} class with all relevant settings and helper objects - */ - public Bignat(byte[] valueBuffer, Bignat_Helper bignatHelper) { - this.bnh = bignatHelper; - this.size = (short) valueBuffer.length; - this.max_size = (short) valueBuffer.length; - this.allocatorType = -1; // no allocator - this.value = valueBuffer; - } - - /** - * Lock/reserve this bignat for subsequent use. - * Used to protect corruption of pre-allocated temporary Bignats used in different, - * potentially nested operations. Must be unlocked by {@code unlock()} later on. - * @throws SW_ALREADYLOCKED_BIGNAT if already locked (is already in use by other operation) - */ - public void lock() { - if (!bLocked) { - bLocked = true; - if (ERASE_ON_LOCK) { - erase(); - } - } - else { - // this Bignat is already locked, raise exception (incorrect sequence of locking and unlocking) - ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED); - } - } - /** - * Unlock/release this bignat from use. Used to protect corruption - * of pre-allocated temporary Bignats used in different nested operations. - * Must be locked before. - * - * @throws SW_NOTLOCKED_BIGNAT if was not locked before (inconsistence in lock/unlock sequence) - */ - public void unlock() { - if (bLocked) { - bLocked = false; - if (ERASE_ON_UNLOCK) { - erase(); - } - } else { - // this Bignat is not locked, raise exception (incorrect sequence of locking and unlocking) - ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED); - } - } - - /** - * Return current state of logical lock of this object - * @return true if object is logically locked (reserved), false otherwise - */ - public boolean isLocked() { - return bLocked; - } - - /** - * Return this Bignat as byte array. For the short/short configuration - * simply the digit array is returned. For other configurations a new short - * array is allocated and returned. Modifying the returned short array - * therefore might or might not change this bignat. - * IMPORTANT: this function returns directly the underlying storage array. - * Current value of this Bignat can be stored in smaller number of bytes. - * Use {@code getLength()} method to obtain actual size. - * - * @return this bignat as byte array - */ - public byte[] as_byte_array() { - return value; - } - - /** - * Serialize this Bignat value into a provided buffer - * @param buffer target buffer - * @param bufferOffset start offset in buffer - * @return number of bytes copied - */ - public short copy_to_buffer(byte[] buffer, short bufferOffset) { - Util.arrayCopyNonAtomic(value, (short) 0, buffer, bufferOffset, size); - return size; - } - - - /** - * Return the size in digits. Provides access to the internal {@link #size} - * field. - *

- * The return value is adjusted by {@link #set_size}. - * - * @return size in digits. - */ - public short length() { - return size; - } - - /** - * Sets internal size of Bignat. Previous value are kept so value is either non-destructively trimmed or enlarged. - * @param newSize new size of Bignat. Must be in range of [0, max_size] where max_size was provided during object creation - */ - public void set_size(short newSize) { - if (newSize < 0 || newSize > max_size) { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER); - } - else { - this.size = newSize; - } - } - - /** - * Resize internal length of this Bignat to maximum size given during object - * creation. If required, object is also zeroized - * - * @param bZeroize if true, all bytes of internal array are also set to - * zero. If false, previous value is kept. - */ - public void resize_to_max(boolean bZeroize) { - set_size(max_size); - if (bZeroize) { - zero(); - } - } - - /** - * Create Bignat with different number of bytes used. Will cause longer number - * to shrink (loss of the more significant bytes) and shorter to be prepended with zeroes - * - * @param new_size new size in bytes - */ - void deep_resize(short new_size) { - if (new_size > this.max_size) { - if (ALLOW_RUNTIME_REALLOCATION) { - allocate_storage_array(new_size, this.allocatorType); - } else { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_REALLOCATIONNOTALLOWED); // Reallocation to longer size not permitted - } - } - - if (new_size == this.size) { - // No need to resize enything, same length - } - else { - short this_start, other_start, len; - bnh.lock(bnh.fnc_deep_resize_tmp); - if (this.size >= new_size) { - this_start = (short) (this.size - new_size); - other_start = 0; - len = new_size; - - // Shrinking/cropping - Util.arrayCopyNonAtomic(value, this_start, bnh.fnc_deep_resize_tmp, (short) 0, len); - Util.arrayCopyNonAtomic(bnh.fnc_deep_resize_tmp, (short) 0, value, (short) 0, len); // Move bytes in item array towards beggining - // Erase rest of allocated array with zeroes (just as sanitization) - short toErase = (short) (this.max_size - new_size); - if (toErase > 0) { - Util.arrayFillNonAtomic(value, new_size, toErase, (byte) 0); - } - } else { - this_start = 0; - other_start = (short) (new_size - this.size); - len = this.size; - // Enlarging => Insert zeroes at begging, move bytes in item array towards the end - Util.arrayCopyNonAtomic(value, this_start, bnh.fnc_deep_resize_tmp, (short) 0, len); - // Move bytes in item array towards end - Util.arrayCopyNonAtomic(bnh.fnc_deep_resize_tmp, (short) 0, value, other_start, len); - // Fill begin of array with zeroes (just as sanitization) - if (other_start > 0) { - Util.arrayFillNonAtomic(value, (short) 0, other_start, (byte) 0); - } - } - bnh.unlock(bnh.fnc_deep_resize_tmp); - - set_size(new_size); - } - } - - - /** - * Appends zeros in the suffix to reach the defined byte length - * Essentially multiplies the number with 16 (HEX) - * @param targetLength required length including appended zeroes - * @param outBuffer output buffer for value with appended zeroes - * @param outOffset start offset inside outBuffer for write - */ - public void append_zeros(short targetLength, byte[] outBuffer, short outOffset) { - Util.arrayCopyNonAtomic(value, (short) 0, outBuffer, outOffset, this.size); //copy the value - Util.arrayFillNonAtomic(outBuffer, (short) (outOffset + this.size), (short) (targetLength - this.size), (byte) 0); //append zeros - } - /** - * Prepends zeros before the value of this Bignat up to target length. - * - * @param targetLength required length including prepended zeroes - * @param outBuffer output buffer for value with prepended zeroes - * @param outOffset start offset inside outBuffer for write - */ - public void prepend_zeros(short targetLength, byte[] outBuffer, short outOffset) { - short other_start = (short) (targetLength - this.size); - if (other_start > 0) { - Util.arrayFillNonAtomic(outBuffer, outOffset, other_start, (byte) 0); //fill prefix with zeros - } - Util.arrayCopyNonAtomic(value, (short) 0, outBuffer, (short) (outOffset + other_start), this.size); //copy the value - } - - /** - * Remove leading zeroes (if any) from Bignat value and decrease size accordingly - */ - public void shrink() { - short i = 0; - for (i = 0; i < this.length(); i++) { // Find first non-zero byte - if (this.value[i] != 0) { - break; - } - } - - short new_size = (short)(this.size-i); - if (new_size < 0) { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDRESIZE); - } - this.deep_resize(new_size); - } - - - /** - * Stores zero in this object for currently used subpart given by internal size. - */ - public void zero() { - Util.arrayFillNonAtomic(value, (short) 0, this.size, (byte) 0); - } - /** - * Stores zero in this object for whole internal buffer regardless of current size. - */ - public void zero_complete() { - Util.arrayFillNonAtomic(value, (short) 0, (short) value.length, (byte) 0); - } - - /** - * Erase value stored inside this Bignat - */ - public void erase() { - zero_complete(); - } - - - /** - * Stores one in this object. Keeps previous size of this Bignat - * (1 is prepended with required number of zeroes). - */ - public void one() { - this.zero(); - value[(short) (size - 1)] = 1; - } - /** - * Stores two in this object. Keeps previous size of this Bignat (2 is - * prepended with required number of zeroes). - */ - public void two() { - this.zero(); - value[(short) (size - 1)] = 0x02; - } - - public void three() { - this.zero(); - value[(short) (size - 1)] = 0x03; - } - - public void four() { - this.zero(); - value[(short) (size - 1)] = 0x04; - } - - public void five() { - this.zero(); - value[(short) (size - 1)] = 0x05; - } - public void eight() { - this.zero(); - value[(short) (size - 1)] = 0x08; - } - - public void ten() { - this.zero(); - value[(short) (size - 1)] = 0x0A; - } - - public void twentyfive() { - this.zero(); - value[(short)(size-1)] = 0x19; - } - - public void twentyseven() { - this.zero(); - value[(short)(size-1)] = 0x1B; - } - - public void athousand() { - this.zero(); - value[(short)(size-2)] = (byte)0x03; - value[(short)(size-1)] = (byte)0xE8; - } - - - - - /** - * Copies {@code other} into this. No size requirements. If {@code other} - * has more digits then the superfluous leading digits of {@code other} are - * asserted to be zero. If this bignat has more digits than its leading - * digits are correctly initilized to zero. This function will not change size - * attribute of this object. - * - * @param other - * Bignat to copy into this object. - */ - public void copy(Bignat other) { - short this_start, other_start, len; - if (this.size >= other.size) { - this_start = (short) (this.size - other.size); - other_start = 0; - len = other.size; - } else { - this_start = 0; - other_start = (short) (other.size - this.size); - len = this.size; - // Verify here that other have leading zeroes up to other_start - for (short i = 0; i < other_start; i ++) { - if (other.value[i] != 0) { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDCOPYOTHER); - } - } - } - - if (this_start > 0) { - // if this bignat has more digits than its leading digits are initilized to zero - Util.arrayFillNonAtomic(this.value, (short) 0, this_start, (byte) 0); - } - Util.arrayCopyNonAtomic(other.value, other_start, this.value, this_start, len); - } - - /** - * Copies content of {@code other} into this and set size of this to {@code other}. - * The size attribute (returned by length()) is updated. If {@code other} - * is longer than maximum capacity of this, internal buffer is reallocated if enabled - * (ALLOW_RUNTIME_REALLOCATION), otherwise exception is thrown. - * @param other - * Bignat to clone into this object. - */ - public void clone(Bignat other) { - // Reallocate array only if current array cannot store the other value and reallocation is enabled by ALLOW_RUNTIME_REALLOCATION - if (this.max_size < other.length()) { - // Reallocation necessary - if (ALLOW_RUNTIME_REALLOCATION) { - allocate_storage_array(other.length(), this.allocatorType); - } - else { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_REALLOCATIONNOTALLOWED); - } - } - - // copy value from other into proper place in this (this can be longer than other so rest of bytes wil be filled with 0) - other.copy_to_buffer(this.value, (short) 0); - if (this.max_size > other.length()) { - Util.arrayFillNonAtomic(this.value, other.length(), (short) (this.max_size - other.length()), (byte) 0); - } - this.size = other.length(); - } - - /** - * Equality check. Requires that this object and other have the same size or are padded with zeroes. - * Returns true if all digits (except for leading zeroes) are equal. - * - * - * @param other Bignat to compare - * @return true if this and other have the same value, false otherwise. - */ - public boolean same_value(Bignat other) { - short hashLen; - // Compare using hash engine - // The comparison is made with hash of point values instead of directly values. - // This way, offset of first mismatching byte is not leaked via timing side-channel. - bnh.lock(bnh.fnc_same_value_array1); - bnh.lock(bnh.fnc_same_value_hash); - if (this.length() == other.length()) { - // Same length, we can hash directly from BN values - bnh.hashEngine.doFinal(this.value, (short) 0, this.length(), bnh.fnc_same_value_hash, (short) 0); - hashLen = bnh.hashEngine.doFinal(other.value, (short) 0, other.length(), bnh.fnc_same_value_array1, (short) 0); - } - else { - // Different length of bignats - can be still same if prepended with zeroes - // Find the length of longer one and padd other one with starting zeroes - if (this.length() < other.length()) { - this.prepend_zeros(other.length(), bnh.fnc_same_value_array1, (short) 0); - bnh.hashEngine.doFinal(bnh.fnc_same_value_array1, (short) 0, other.length(), bnh.fnc_same_value_hash, (short) 0); - hashLen = bnh.hashEngine.doFinal(other.value, (short) 0, other.length(), bnh.fnc_same_value_array1, (short) 0); - } - else { - other.prepend_zeros(this.length(), bnh.fnc_same_value_array1, (short) 0); - bnh.hashEngine.doFinal(bnh.fnc_same_value_array1, (short) 0, this.length(), bnh.fnc_same_value_hash, (short) 0); - hashLen = bnh.hashEngine.doFinal(this.value, (short) 0, this.length(), bnh.fnc_same_value_array1, (short) 0); - } - } - - boolean bResult = Util.arrayCompare(bnh.fnc_same_value_hash, (short) 0, bnh.fnc_same_value_array1, (short) 0, hashLen) == 0; - - bnh.unlock(bnh.fnc_same_value_array1); - bnh.unlock(bnh.fnc_same_value_hash); - - return bResult; - } - - - /** - * Addition of big integers x and y stored in byte arrays with specified offset and length. - * The result is stored into x array argument. - * @param x array with first bignat - * @param xOffset start offset in array of {@code x} - * @param xLength length of {@code x} - * @param y array with second bignat - * @param yOffset start offset in array of {@code y} - * @param yLength length of {@code y} - * @return true if carry of most significant byte occurs, false otherwise - */ - public static boolean add(byte[] x, short xOffset, short xLength, byte[] y, - short yOffset, short yLength) { - short result = 0; - short i = (short) (xLength + xOffset - 1); - short j = (short) (yLength + yOffset - 1); - - for (; i >= xOffset && j >= 0; i--, j--) { - result = (short) (result + (short) (x[i] & digit_mask) + (short) (y[j] & digit_mask)); - - x[i] = (byte) (result & digit_mask); - result = (short) ((result >> digit_len) & digit_mask); - } - while (result > 0 && i >= xOffset) { - result = (short) (result + (short) (x[i] & digit_mask)); - x[i] = (byte) (result & digit_mask); - result = (short) ((result >> digit_len) & digit_mask); - i--; - } - - return result != 0; - } - - /** - * Subtracts big integer y from x specified by offset and length. - * The result is stored into x array argument. - * @param x array with first bignat - * @param xOffset start offset in array of {@code x} - * @param xLength length of {@code x} - * @param y array with second bignat - * @param yOffset start offset in array of {@code y} - * @param yLength length of {@code y} - * @return true if carry of most significant byte occurs, false otherwise - */ - public static boolean subtract(byte[] x, short xOffset, short xLength, byte[] y, - short yOffset, short yLength) { - short i = (short) (xLength + xOffset - 1); - short j = (short) (yLength + yOffset - 1); - short carry = 0; - short subtraction_result = 0; - - for (; i >= xOffset && j >= yOffset; i--, j--) { - subtraction_result = (short) ((x[i] & digit_mask) - (y[j] & digit_mask) - carry); - x[i] = (byte) (subtraction_result & digit_mask); - carry = (short) (subtraction_result < 0 ? 1 : 0); - } - for (; i >= xOffset && carry > 0; i--) { - if (x[i] != 0) { - carry = 0; - } - x[i] -= 1; - } - - return carry > 0; - } - - /** - * Substract provided other bignat from this bignat. - * @param other bignat to be substracted from this - */ - public void subtract(Bignat other) { - this.times_minus(other, (short) 0, (short) 1); - } - - /** - * Scaled subtraction. Subtracts {@code mult * 2^(}{@link #digit_len} - * {@code * shift) * other} from this. - *

- * That is, shifts {@code mult * other} precisely {@code shift} digits to - * the left and subtracts that value from this. {@code mult} must be less - * than {@link #bignat_base}, that is, it must fit into one digit. It is - * only declared as short here to avoid negative values. - *

- * {@code mult} has type short. - *

- * No size constraint. However, an assertion is thrown, if the result would - * be negative. {@code other} can have more digits than this object, but - * then sufficiently many leading digits must be zero to avoid the - * underflow. - *

- * Used in division. - * - * @param other - * Bignat to subtract from this object - * @param shift - * number of digits to shift {@code other} to the left - * @param mult - * of type short, multiple of {@code other} to subtract from this - * object. Must be below {@link #bignat_base}. - */ - public void times_minus(Bignat other, short shift, short mult) { - short akku = 0; - short subtraction_result; - short i = (short) (this.size - 1 - shift); - short j = (short) (other.size - 1); - for (; i >= 0 && j >= 0; i--, j--) { - akku = (short) (akku + (short) (mult * (other.value[j] & digit_mask))); - subtraction_result = (short) ((value[i] & digit_mask) - (akku & digit_mask)); - - value[i] = (byte) (subtraction_result & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - if (subtraction_result < 0) { - akku++; - } - } - - // deal with carry as long as there are digits left in this - while (i >= 0 && akku != 0) { - subtraction_result = (short) ((value[i] & digit_mask) - (akku & digit_mask)); - value[i] = (byte) (subtraction_result & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - if (subtraction_result < 0) { - akku++; - } - i--; - } - } - - /** - * Quick function for decrement of this bignat value by 1. Faster than {@code substract(Bignat.one())} - */ - public void decrement_one() { - short tmp = 0; - for (short i = (short) (this.size - 1); i >= 0; i--) { - tmp = (short) (this.value[i] & 0xff); - this.value[i] = (byte) (tmp - 1); - if (tmp != 0) { - break; // CTO - } - else { - // need to modify also one byte up, continue with cycle - } - } - } - /** - * Quick function for increment of this bignat value by 1. Faster than - * {@code add(Bignat.one())} - */ - public void increment_one() { - short tmp = 0; - for (short i = (short) (this.size - 1); i >= 0; i--) { - tmp = (short) (this.value[i] & 0xff); - this.value[i] = (byte) (tmp + 1); - if (tmp < 255) { - break; // CTO - } else { - // need to modify also one byte up (carry) , continue with cycle - } - } - } - - /** - * Index of the most significant 1 bit. - *

- * {@code x} has type short. - *

- * Utility method, used in division. - * - * @param x - * of type short - * @return index of the most significant 1 bit in {@code x}, returns - * {@link #double_digit_len} for {@code x == 0}. - */ - private static short highest_bit(short x) { - for (short i = 0; i < double_digit_len; i++) { - if (x < 0) { - return i; - } - x <<= 1; - } - return double_digit_len; - } - - /** - * Shift to the left and fill. Takes {@code high} {@code middle} {@code low} - * as 4 digits, shifts them {@code shift} bits to the left and returns the - * most significant {@link #double_digit_len} bits. - *

- * Utility method, used in division. - * - * - * @param high - * of type short, most significant {@link #double_digit_len} bits - * @param middle - * of type byte, middle {@link #digit_len} bits - * @param low - * of type byte, least significant {@link #digit_len} bits - * @param shift - * amount of left shift - * @return most significant {@link #double_digit_len} as short - */ - private static short shift_bits(short high, byte middle, byte low, - short shift) { - // shift high - high <<= shift; - - // merge middle bits - byte mask = (byte) (digit_mask << (shift >= digit_len ? 0 : digit_len - - shift)); - short bits = (short) ((short) (middle & mask) & digit_mask); - if (shift > digit_len) { - bits <<= shift - digit_len; - } - else { - bits >>>= digit_len - shift; - } - high |= bits; - - if (shift <= digit_len) { - return high; - } - - // merge low bits - mask = (byte) (digit_mask << double_digit_len - shift); - bits = (short) ((((short) (low & mask) & digit_mask) >> double_digit_len - shift)); - high |= bits; - - return high; - } - - /** - * Scaled comparison. Compares this number with {@code other * 2^(} - * {@link #digit_len} {@code * shift)}. That is, shifts {@code other} - * {@code shift} digits to the left and compares then. This bignat and - * {@code other} will not be modified inside this method. - *

- * - * As optimization {@code start} can be greater than zero to skip the first - * {@code start} digits in the comparison. These first digits must be zero - * then, otherwise an assertion is thrown. (So the optimization takes only - * effect when NO_CARD_ASSERT - * is defined.) - * - * @param other - * Bignat to compare to - * @param shift - * left shift of other before the comparison - * @param start - * digits to skip at the beginning - * @return true if this number is strictly less than the shifted - * {@code other}, false otherwise. - */ - public boolean shift_lesser(Bignat other, short shift, short start) { - short j; - - j = (short) (other.size + shift - this.size + start); - short this_short, other_short; - for (short i = start; i < this.size; i++, j++) { - this_short = (short) (this.value[i] & digit_mask); - if (j >= 0 && j < other.size) { - other_short = (short) (other.value[j] & digit_mask); - } - else { - other_short = 0; - } - if (this_short < other_short) { - return true; // CTO - } - if (this_short > other_short) { - return false; - } - } - return false; - } - - /** - * Compares this and other bignat. - * @param other other value to compare with - * @return true if this bignat is smaller, false if bigger or equal - */ - public boolean smaller(Bignat other) { - short index_this = 0; - for (short i = 0; i < this.length(); i++) { - if (this.value[i] != 0x00) { - index_this = i; - } - } - - short index_other = 0; - for (short i = 0; i < other.length(); i++) { - if (other.value[i] != 0x00) { - index_other = i; - } - } - - if ((short) (this.length() - index_this) < (short) (other.length() - index_other)) { - return true; // CTO - } - short i = 0; - while (i < this.length() && i < other.length()) { - if (((short) (this.value[i] & digit_mask)) < ((short) (other.value[i] & digit_mask))) { - return true; // CTO - } - i = (short) (1 + i); - } - - return false; - } - - - /** - * Comparison of this and other. - * - * @param other - * Bignat to compare with - * @return true if this number is strictly lesser than {@code other}, false - * otherwise. - */ - public boolean lesser(Bignat other) { - return this.shift_lesser(other, (short) 0, (short) 0); - } - - /** - * Test equality with zero. - * - * @return true if this bignat equals zero. - */ - public boolean is_zero() { - for (short i = 0; i < size; i++) { - if (value[i] != 0) { - return false; // CTO - } - } - return true; - } - - /** Check if stored bignat is odd. - * - * @return true if odd, false if even - */ - public boolean is_odd() { - if ((value[(short) (this.size - 1)] & 1) == 0) { - return false; // CTO - } - return true; - } - - /** - * Remainder and Quotient. Divide this number by {@code divisor} and store - * the remainder in this. If {@code quotient} is non-null store the quotient - * there. - *

- * There are no direct size constraints, but if {@code quotient} is - * non-null, it must be big enough for the quotient, otherwise an assertion - * is thrown. - *

- * Uses schoolbook division inside and has O^2 complexity in the difference - * of significant digits of the divident (in this number) and the divisor. - * For numbers of equal size complexity is linear. - * - * @param divisor - * must be non-zero - * @param quotient - * gets the quotient if non-null - */ - public void remainder_divide(Bignat divisor, Bignat quotient) { - // There are some size requirements, namely that quotient must - // be big enough. However, this depends on the value of the - // divisor and is therefore not stated here. - - // zero-initialize the quotient, because we are only adding to it below - if (quotient != null) { - quotient.zero(); - } - - // divisor_index is the first nonzero digit (short) in the divisor - short divisor_index = 0; - while (divisor.value[divisor_index] == 0) { - divisor_index++; - } - - // The size of this might be different from divisor. Therefore, - // for the first subtraction round we have to shift the divisor - // divisor_shift = this.size - divisor.size + divisor_index - // digits to the left. If this amount is negative, then - // this is already smaller then divisor and we are done. - // Below we do divisor_shift + 1 subtraction rounds. As an - // additional loop index we also count the rounds (from - // zero upwards) in division_round. This gives access to the - // first remaining divident digits. - short divisor_shift = (short) (this.size - divisor.size + divisor_index); - short division_round = 0; - - // We could express now a size constraint, namely that - // divisor_shift + 1 <= quotient.size - // However, in the proof protocol we divide x / v, where - // x has 2*n digits when v has n digits. There the above size - // constraint is violated, the division is however valid, because - // it will always hold that x < v * (v - 1) and therefore the - // quotient will always fit into n digits. - // System.out.format("XX this size %d div ind %d div shift %d " + - // "quo size %d\n" + - // "%s / %s\n", - // this.size, - // divisor_index, - // divisor_shift, - // quotient != null ? quotient.size : -1, - // this.to_hex_string(), - // divisor.to_hex_string()); - // The first digits of the divisor are needed in every - // subtraction round. - short first_divisor_digit = (short) (divisor.value[divisor_index] & digit_mask); - short divisor_bit_shift = (short) (highest_bit((short) (first_divisor_digit + 1)) - 1); - byte second_divisor_digit = divisor_index < (short) (divisor.size - 1) ? divisor.value[(short) (divisor_index + 1)] - : 0; - byte third_divisor_digit = divisor_index < (short) (divisor.size - 2) ? divisor.value[(short) (divisor_index + 2)] - : 0; - - // The following variables are used inside the loop only. - // Declared here as optimization. - // divident_digits and divisor_digit hold the first one or two - // digits. Needed to compute the multiple of the divisor to - // subtract from this. - short divident_digits, divisor_digit; - - // To increase precisision the first digits are shifted to the - // left or right a bit. The following variables compute the shift. - short divident_bit_shift, bit_shift; - - // Declaration of the multiple, with which the divident is - // multiplied in each round and the quotient_digit. Both are - // a single digit, but declared as a double digit to avoid the - // trouble with negative numbers. If quotient != null multiple is - // added to the quotient. This addition is done with quotient_digit. - short multiple, quotient_digit; - short numLoops = 0; - short numLoops2 = 0; - while (divisor_shift >= 0) { - numLoops++; // CTO number of outer loops is constant (for given length of divisor) - // Keep subtracting from this until - // divisor * 2^(8 * divisor_shift) is bigger than this. - while (!shift_lesser(divisor, divisor_shift, - (short) (division_round > 0 ? division_round - 1 : 0))) { - numLoops2++; // BUGBUG: CTO - number of these loops fluctuates heavily => strong impact on operation time - // this is bigger or equal than the shifted divisor. - // Need to subtract some multiple of divisor from this. - // Make a conservative estimation of the multiple to subtract. - // We estimate a lower bound to avoid underflow, and continue - // to subtract until the remainder in this gets smaller than - // the shifted divisor. - // For the estimation get first the two relevant digits - // from this and the first relevant digit from divisor. - divident_digits = division_round == 0 ? 0 - : (short) ((short) (value[(short) (division_round - 1)]) << digit_len); - divident_digits |= (short) (value[division_round] & digit_mask); - - // The multiple to subtract from this is - // divident_digits / divisor_digit, but there are two - // complications: - // 1. divident_digits might be negative, - // 2. both might be very small, in which case the estimated - // multiple is very inaccurate. - if (divident_digits < 0) { - // case 1: shift both one bit to the right - // In standard java (ie. in the test frame) the operation - // for >>= and >>>= seems to be done in integers, - // even if the left hand side is a short. Therefore, - // for a short left hand side there is no difference - // between >>= and >>>= !!! - // Do it the complicated way then. - divident_digits = (short) ((divident_digits >>> 1) & positive_double_digit_mask); - divisor_digit = (short) ((first_divisor_digit >>> 1) & positive_double_digit_mask); - } else { - // To avoid case 2 shift both to the left - // and add relevant bits. - divident_bit_shift = (short) (highest_bit(divident_digits) - 1); - // Below we add one to divisor_digit to avoid underflow. - // Take therefore the highest bit of divisor_digit + 1 - // to avoid running into the negatives. - bit_shift = divident_bit_shift <= divisor_bit_shift ? divident_bit_shift - : divisor_bit_shift; - - divident_digits = shift_bits( - divident_digits, - division_round < (short) (this.size - 1) ? value[(short) (division_round + 1)] - : 0, - division_round < (short) (this.size - 2) ? value[(short) (division_round + 2)] - : 0, bit_shift); - divisor_digit = shift_bits(first_divisor_digit, - second_divisor_digit, third_divisor_digit, - bit_shift); - - } - - // add one to divisor to avoid underflow - multiple = (short) (divident_digits / (short) (divisor_digit + 1)); - - // Our strategy to avoid underflow might yield multiple == 0. - // We know however, that divident >= divisor, therefore make - // sure multiple is at least 1. - if (multiple < 1) { - multiple = 1; - } - - times_minus(divisor, divisor_shift, multiple); - - // build quotient if desired - if (quotient != null) { - // Express the size constraint only here. The check is - // essential only in the first round, because - // divisor_shift decreases. divisor_shift must be - // strictly lesser than quotient.size, otherwise - // quotient is not big enough. Note that the initially - // computed divisor_shift might be bigger, this - // is OK, as long as we don't reach this point. - - quotient_digit = (short) ((quotient.value[(short) (quotient.size - 1 - divisor_shift)] & digit_mask) + multiple); - quotient.value[(short) (quotient.size - 1 - divisor_shift)] = (byte) (quotient_digit); - } - } - - // treat loop indices - division_round++; - divisor_shift--; - } - } - - - /** - * Add short value to this bignat - * @param other short value to add - */ - public void add(short other) { - Util.setShort(bnh.tmp_array_short, (short) 0, other); // serialize other into array - this.add_carry(bnh.tmp_array_short, (short) 0, (short) 2); // add as array - } - - /** - * Addition with carry report. Adds other to this number. If this is too - * small for the result (i.e., an overflow occurs) the method returns true. - * Further, the result in {@code this} will then be the correct result of an - * addition modulo the first number that does not fit into {@code this} ( - * {@code 2^(}{@link #digit_len}{@code * }{@link #size this.size}{@code )}), - * i.e., only one leading 1 bit is missing. If there is no overflow the - * method will return false. - *

- * - * It would be more natural to report the overflow with an - * {@link javacard.framework.UserException}, however its - * {@link javacard.framework.UserException#throwIt throwIt} method dies with - * a null pointer exception when it runs in a host test frame... - *

- * - * Asserts that the size of other is not greater than the size of this. - * - * @param other - * Bignat to add - * @param otherOffset start offset within other buffer - * @param otherLen length of other - * @return true if carry occurs, false otherwise - */ - public boolean add_carry(byte[] other, short otherOffset, short otherLen) { - short akku = 0; - short j = (short) (this.size - 1); - for (short i = (short) (otherLen - 1); i >= 0 && j >= 0; i--, j--) { - akku = (short) (akku + (short) (this.value[j] & digit_mask) + (short) (other[(short) (i + otherOffset)] & digit_mask)); - - this.value[j] = (byte) (akku & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - } - // add carry at position j - while (akku > 0 && j >= 0) { - akku = (short) (akku + (short) (this.value[j] & digit_mask)); - this.value[j] = (byte) (akku & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - j--; - } - - return akku != 0; - } - /** - * Add with carry. See {@code add_cary()} for full description - * @param other value to be added - * @return true if carry happens, false otherwise - */ - public boolean add_carry(Bignat other) { - return add_carry(other.value, (short) 0, other.size); - } - - - /** - * Addition. Adds other to this number. - *

- * Same as {@link #times_add times_add}{@code (other, 1)} but without the - * multiplication overhead. - *

- * Asserts that the size of other is not greater than the size of this. - * - * @param other - * Bignat to add - */ - public void add(Bignat other) { - add_carry(other); - } - - /** - * Add other bignat to this bignat modulo {@code modulo} value. - * @param other value to add - * @param modulo value of modulo to compute - */ - public void mod_add(Bignat other, Bignat modulo) { - short tmp_size = this.size; - if (tmp_size < other.size) { - tmp_size = other.size; - } - tmp_size++; - bnh.fnc_mod_add_tmp.lock(); - bnh.fnc_mod_add_tmp.set_size(tmp_size); - bnh.fnc_mod_add_tmp.zero(); - bnh.fnc_mod_add_tmp.copy(this); - bnh.fnc_mod_add_tmp.add(other); - bnh.fnc_mod_add_tmp.mod(modulo); - bnh.fnc_mod_add_tmp.shrink(); - this.clone(bnh.fnc_mod_add_tmp); - bnh.fnc_mod_add_tmp.unlock(); - } - - /** - * Substract other bignat from this bignat modulo {@code modulo} value. - * - * @param other value to substract - * @param modulo value of modulo to apply - */ - public void mod_sub(Bignat other, Bignat modulo) { - if (other.lesser(this)) { // CTO - this.subtract(other); - this.mod(modulo); - } else { //other>this (mod-other+this) - bnh.fnc_mod_sub_tmpOther.lock(); - bnh.fnc_mod_sub_tmpOther.clone(other); - bnh.fnc_mod_sub_tmpOther.mod(modulo); - - //fnc_mod_sub_tmpThis = new Bignat(this.length()); - bnh.fnc_mod_sub_tmpThis.lock(); - bnh.fnc_mod_sub_tmpThis.clone(this); - bnh.fnc_mod_sub_tmpThis.mod(modulo); - - bnh.fnc_mod_sub_tmp.lock(); - bnh.fnc_mod_sub_tmp.clone(modulo); - bnh.fnc_mod_sub_tmp.subtract(bnh.fnc_mod_sub_tmpOther); - bnh.fnc_mod_sub_tmpOther.unlock(); - bnh.fnc_mod_sub_tmp.add(bnh.fnc_mod_sub_tmpThis); //this will never overflow as "other" is larger than "this" - bnh.fnc_mod_sub_tmpThis.unlock(); - bnh.fnc_mod_sub_tmp.mod(modulo); - bnh.fnc_mod_sub_tmp.shrink(); - this.clone(bnh.fnc_mod_sub_tmp); - bnh.fnc_mod_sub_tmp.unlock(); - } - } - - - /** - * Scaled addition. Add {@code mult * other} to this number. {@code mult} - * must be below {@link #bignat_base}, that is, it must fit into one digit. - * It is only declared as a short here to avoid negative numbers. - *

- * Asserts (overly restrictive) that this and other have the same size. - *

- * Same as {@link #times_add_shift times_add_shift}{@code (other, 0, mult)} - * but without the shift overhead. - *

- * Used in multiplication. - * - * @param other Bignat to add - * @param mult of short, factor to multiply {@code other} with before - * addition. Must be less than {@link #bignat_base}. - */ - public void times_add(Bignat other, short mult) { - short akku = 0; - for (short i = (short) (size - 1); i >= 0; i--) { - akku = (short) (akku + (short) (this.value[i] & digit_mask) + (short) (mult * (other.value[i] & digit_mask))); - this.value[i] = (byte) (akku & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - } - } - - /** - * Scaled addition. Adds {@code mult * other * 2^(}{@link #digit_len} - * {@code * shift)} to this. That is, shifts other {@code shift} digits to - * the left, multiplies it with {@code mult} and adds then. - *

- * {@code mult} must be less than {@link #bignat_base}, that is, it must fit - * into one digit. It is only declared as a short here to avoid negative - * numbers. - *

- * Asserts that the size of this is greater than or equal to - * {@code other.size + shift + 1}. - * - * @param x Bignat to add - * @param mult of short, factor to multiply {@code other} with before - * addition. Must be less than {@link #bignat_base}. - * @param shift number of digits to shift {@code other} to the left, before - * addition. - */ - public void times_add_shift(Bignat x, short shift, short mult) { - short akku = 0; - short j = (short) (this.size - 1 - shift); - for (short i = (short) (x.size - 1); i >= 0; i--, j--) { - akku = (short) (akku + (short) (this.value[j] & digit_mask) + (short) (mult * (x.value[i] & digit_mask))); - - this.value[j] = (byte) (akku & digit_mask); - akku = (short) ((akku >> digit_len) & digit_mask); - } - // add carry at position j - akku = (short) (akku + (short) (this.value[j] & digit_mask)); - this.value[j] = (byte) (akku & digit_mask); - // BUGUG: assert no overflow - } - - /** - * Division of this bignat by provided other bignat. - * @param other value of divisor - */ - public void divide(Bignat other) { - bnh.fnc_divide_tmpThis.lock(); - bnh.fnc_divide_tmpThis.clone(this); - bnh.fnc_divide_tmpThis.remainder_divide(other, this); - this.clone(bnh.fnc_divide_tmpThis); - bnh.fnc_divide_tmpThis.unlock(); - } - - /** - * Greatest common divisor of this bignat with other bignat. Result is - * stored into this. - * - * @param other value of other bignat - */ - public void gcd(Bignat other) { - bnh.fnc_gcd_tmp.lock(); - bnh.fnc_gcd_tmpOther.lock(); - - bnh.fnc_gcd_tmpOther.clone(other); - - // TODO: optimise? - while (!other.is_zero()) { - bnh.fnc_gcd_tmp.clone(bnh.fnc_gcd_tmpOther); - this.mod(bnh.fnc_gcd_tmpOther); - bnh.fnc_gcd_tmpOther.clone(this); - this.clone(bnh.fnc_gcd_tmp); - } - - bnh.fnc_gcd_tmp.unlock(); - bnh.fnc_gcd_tmpOther.unlock(); - } - - /** - * Decides whether the arguments are coprime or not. - * - * @param a Bignat value - * @param b Bignat value - * @return true if coprime, false otherwise - */ - public boolean is_coprime(Bignat a, Bignat b) { - bnh.fnc_is_coprime_tmp.lock(); - bnh.fnc_is_coprime_tmp.clone(a); - - bnh.fnc_is_coprime_tmp.gcd(b); - return bnh.fnc_is_coprime_tmp.same_value(Bignat_Helper.ONE); - } - - /** - * Computes base^exp and stores result into this bignat - * @param base value of base - * @param exp value of exponent - */ - public void exponentiation(Bignat base, Bignat exp) { - this.one(); - bnh.fnc_exponentiation_i.lock(); - bnh.fnc_exponentiation_i.set_size(exp.length()); - bnh.fnc_exponentiation_i.zero(); - bnh.fnc_exponentiation_tmp.lock(); - bnh.fnc_exponentiation_tmp.set_size((short) (2 * this.length())); - for (; bnh.fnc_exponentiation_i.lesser(exp); bnh.fnc_exponentiation_i.increment_one()) { - bnh.fnc_exponentiation_tmp.mult(this, base); - this.copy(bnh.fnc_exponentiation_tmp); - } - bnh.fnc_exponentiation_i.unlock(); - bnh.fnc_exponentiation_tmp.unlock(); - } - - /** - * Multiplication. Automatically selects fastest available algorithm. - * Stores {@code x * y} in this. To ensure this is big - * enough for the result it is asserted that the size of this is greater - * than or equal to the sum of the sizes of {@code x} and {@code y}. - * - * @param x - * first factor - * @param y - * second factor - */ - public void mult(Bignat x, Bignat y) { - if (!bnh.FLAG_FAST_MULT_VIA_RSA || x.length() < Bignat_Helper.FAST_MULT_VIA_RSA_TRESHOLD_LENGTH) { - //if (!bnh.FLAG_FAST_MULT_VIA_RSA) { - // If not supported, use slow multiplication - // Use slow multiplication also when numbers are small => faster to do in software - mult_schoolbook(x, y); - } - else { - mult_rsa_trick(x, y, null, null); - } - } - - /** - * Slow schoolbook algorithm for multiplication - * @param x first number to multiply - * @param y second number to multiply - */ - public void mult_schoolbook(Bignat x, Bignat y) { - this.zero(); // important to keep, used in exponentiation() - for (short i = (short) (y.size - 1); i >= 0; i--) { - this.times_add_shift(x, (short) (y.size - 1 - i), (short) (y.value[i] & digit_mask)); - } - } - - /** - * Performs multiplication of two bignats x and y and stores result into - * this. RSA engine is used to speedup operation. - * @param x first value to multiply - * @param y second value to multiply - */ - public void mult_RSATrick(Bignat x, Bignat y) { - mult_rsa_trick(x, y, null, null); - } - - /** - * Performs multiplication of two bignats x and y and stores result into this. - * RSA engine is used to speedup operation for large values. - * Idea of speedup: - * We need to mutiply x.y where both x and y are 32B - * (x + y)^2 == x^2 + y^2 + 2xy - * Fast RSA engine is available (a^b mod n) - * n can be set bigger than 64B => a^b mod n == a^b - * [(x + y)^2 mod n] - [x^2 mod n] - [y^2 mod n] => 2xy where [] means single RSA operation - * 2xy / 2 => result of mult(x,y) - * Note: if multiplication is used with either x or y argument same repeatedly, - * [x^2 mod n] or [y^2 mod n] can be precomputed and passed as arguments x_pow_2 or y_pow_2 - * - * @param x first value to multiply - * @param y second value to multiply - * @param x_pow_2 if not null, array with precomputed value x^2 is expected - * @param y_pow_2 if not null, array with precomputed value y^2 is expected - */ - public void mult_rsa_trick(Bignat x, Bignat y, byte[] x_pow_2, byte[] y_pow_2) { - short xOffset; - short yOffset; - - bnh.lock(bnh.fnc_mult_resultArray1); - - // x+y - Util.arrayFillNonAtomic(bnh.fnc_mult_resultArray1, (short) 0, (short) bnh.fnc_mult_resultArray1.length, (byte) 0); - // We must copy bigger number first - if (x.size > y.size) { - // Copy x to the end of mult_resultArray - xOffset = (short) (bnh.fnc_mult_resultArray1.length - x.length()); - Util.arrayCopyNonAtomic(x.value, (short) 0, bnh.fnc_mult_resultArray1, xOffset, x.length()); - if (add(bnh.fnc_mult_resultArray1, xOffset, x.size, y.value, (short) 0, y.size)) { - xOffset--; - bnh.fnc_mult_resultArray1[xOffset] = 0x01; - } - } else { - // Copy x to the end of mult_resultArray - yOffset = (short) (bnh.fnc_mult_resultArray1.length - y.length()); - Util.arrayCopyNonAtomic(y.value, (short) 0, bnh.fnc_mult_resultArray1, yOffset, y.length()); - if (add(bnh.fnc_mult_resultArray1, yOffset, y.size, x.value, (short) 0, x.size)) { - yOffset--; - bnh.fnc_mult_resultArray1[yOffset] = 0x01; // add carry if occured - } - } - - // ((x+y)^2) - bnh.fnc_mult_cipher.doFinal(bnh.fnc_mult_resultArray1, (byte) 0, (short) bnh.fnc_mult_resultArray1.length, bnh.fnc_mult_resultArray1, (short) 0); - - // x^2 - bnh.lock(bnh.fnc_mult_resultArray2); - if (x_pow_2 == null) { - // x^2 is not precomputed - Util.arrayFillNonAtomic(bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length, (byte) 0); - xOffset = (short) (bnh.fnc_mult_resultArray2.length - x.length()); - Util.arrayCopyNonAtomic(x.value, (short) 0, bnh.fnc_mult_resultArray2, xOffset, x.length()); - bnh.fnc_mult_cipher.doFinal(bnh.fnc_mult_resultArray2, (byte) 0, (short) bnh.fnc_mult_resultArray2.length, bnh.fnc_mult_resultArray2, (short) 0); - } else { - // x^2 is precomputed - if ((short) x_pow_2.length != (short) bnh.fnc_mult_resultArray2.length) { - Util.arrayFillNonAtomic(bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length, (byte) 0); - xOffset = (short) ((short) bnh.fnc_mult_resultArray2.length - (short) x_pow_2.length); - } else { - xOffset = 0; - } - Util.arrayCopyNonAtomic(x_pow_2, (short) 0, bnh.fnc_mult_resultArray2, xOffset, (short) x_pow_2.length); - } - // ((x+y)^2) - x^2 - subtract(bnh.fnc_mult_resultArray1, (short) 0, (short) bnh.fnc_mult_resultArray1.length, bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length); - - // y^2 - if (y_pow_2 == null) { - // y^2 is not precomputed - Util.arrayFillNonAtomic(bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length, (byte) 0); - yOffset = (short) (bnh.fnc_mult_resultArray2.length - y.length()); - Util.arrayCopyNonAtomic(y.value, (short) 0, bnh.fnc_mult_resultArray2, yOffset, y.length()); - bnh.fnc_mult_cipher.doFinal(bnh.fnc_mult_resultArray2, (byte) 0, (short) bnh.fnc_mult_resultArray2.length, bnh.fnc_mult_resultArray2, (short) 0); - } else { - // y^2 is precomputed - if ((short) y_pow_2.length != (short) bnh.fnc_mult_resultArray2.length) { - Util.arrayFillNonAtomic(bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length, (byte) 0); - yOffset = (short) ((short) bnh.fnc_mult_resultArray2.length - (short) y_pow_2.length); - } else { - yOffset = 0; - } - Util.arrayCopyNonAtomic(y_pow_2, (short) 0, bnh.fnc_mult_resultArray2, yOffset, (short) y_pow_2.length); - } - - - // {(x+y)^2) - x^2} - y^2 - subtract(bnh.fnc_mult_resultArray1, (short) 0, (short) bnh.fnc_mult_resultArray1.length, bnh.fnc_mult_resultArray2, (short) 0, (short) bnh.fnc_mult_resultArray2.length); - - // we now have 2xy in mult_resultArray, divide it by 2 => shift by one bit and fill back into this - short multOffset = (short) ((short) bnh.fnc_mult_resultArray1.length - 1); - short res = 0; - short res2 = 0; - // this.length() must be different from multOffset, set proper ending condition - short stopOffset = 0; - if (this.length() > multOffset) { - stopOffset = (short) (this.length() - multOffset); // only part of this.value will be filled - } else { - stopOffset = 0; // whole this.value will be filled - } - if (stopOffset > 0) { - Util.arrayFillNonAtomic(this.value, (short) 0, stopOffset, (byte) 0); - } - for (short i = (short) (this.length() - 1); i >= stopOffset; i--) { - res = (short) (bnh.fnc_mult_resultArray1[multOffset] & 0xff); - res = (short) (res >> 1); - res2 = (short) (bnh.fnc_mult_resultArray1[(short) (multOffset - 1)] & 0xff); - res2 = (short) (res2 << 7); - this.value[i] = (byte) (short) (res | res2); - multOffset--; - } - bnh.unlock(bnh.fnc_mult_resultArray1); - bnh.unlock(bnh.fnc_mult_resultArray2); - } - - /** - * Multiplication of bignats x and y computed by modulo {@code modulo}. - * The result is stored to this. - * @param x first value to multiply - * @param y second value to multiply - * @param modulo value of modulo - */ - public void mod_mult(Bignat x, Bignat y, Bignat modulo) { - bnh.fnc_mod_mult_tmpThis.lock(); - bnh.fnc_mod_mult_tmpThis.resize_to_max(false); - // Perform fast multiplication using RSA trick - bnh.fnc_mod_mult_tmpThis.mult(x, y); - // Compute modulo - bnh.fnc_mod_mult_tmpThis.mod(modulo); - bnh.fnc_mod_mult_tmpThis.shrink(); - this.clone(bnh.fnc_mod_mult_tmpThis); - bnh.fnc_mod_mult_tmpThis.unlock(); - } - // Potential speedup for modular multiplication - // Binomial theorem: (op1 + op2)^2 - (op1 - op2)^2 = 4 * op1 * op2 mod (mod) - - - - /** - * One digit left shift. - *

- * Asserts that the first digit is zero. - */ - public void shift_left() { - // NOTE: assumes that overlapping src and dest arrays are properly handled by Util.arrayCopyNonAtomic - Util.arrayCopyNonAtomic(this.value, (short) 1, this.value, (short) 0, (short) (size - 1)); - value[(short) (size - 1)] = 0; - } - - /** - * Optimized division by value two - */ - private void divide_by_2() { - short tmp = 0; - short tmp2 = 0; - short carry = 0; - for (short i = 0; i < this.size; i++) { - tmp = (short) (this.value[i] & 0xff); - tmp2 = tmp; - tmp >>=1; // shift by 1 => divide by 2 - this.value[i] = (byte) (tmp | carry); - carry = (short) (tmp2 & 0x01); // save lowest bit - carry <<= 7; // shifted to highest position - } - } - - /** - * Inefficient modular multiplication. - * - * This bignat is assigned to {@code x * y} modulo {@code mod}. Inefficient, - * because it computes the modules with {@link #remainder_divide - * remainder_divide} in each multiplication round. To avoid overflow the - * first two digits of {@code x} and {@code mod} must be zero (which plays - * nicely with the requirements for montgomery multiplication, see - * {@link #montgomery_mult montgomery_mult}). - *

- * Asserts that {@code x} and {@code mod} have the same size. Argument - * {@code y} can be arbitrary in size. - *

- * Included here to make it possible to compute the squared montgomery factor, - * which is needed to montgomerize numbers before montgomery multiplication. - * Until now this has never been used, because the montgomery factors are - * computed on the host and then installed on the card. Or numbers are - * montgomerized on the host already. - * - * @param x first factor, first two digits must be zero - * @param y second factor - * @param mod modulus, first two digits must be zero - */ - public void mod_mult_inefficient(Bignat x, Bignat y, Bignat mod) { - short len = 0; - if (x.length() >= mod.length()) { - len = x.length(); - } else { - len = mod.length(); - } - - short magicAdd = 2; - bnh.fnc_mult_mod_tmp_x.lock(); - bnh.fnc_mult_mod_tmp_x.set_size((short) (len + magicAdd)); - bnh.fnc_mult_mod_tmp_x.copy(x); - - bnh.fnc_mult_mod_tmp_mod.lock(); - bnh.fnc_mult_mod_tmp_mod.set_size((short) (len + magicAdd)); - bnh.fnc_mult_mod_tmp_mod.copy(mod); - - bnh.fnc_mult_mod_tmpThis.lock(); - bnh.fnc_mult_mod_tmpThis.set_size((short) (this.length() + magicAdd)); - bnh.fnc_mult_mod_tmpThis.zero(); - for (short i = 0; i < y.size; i++) { - bnh.fnc_mult_mod_tmpThis.shift_left(); - bnh.fnc_mult_mod_tmpThis.times_add(bnh.fnc_mult_mod_tmp_x, (short) (y.value[i] & digit_mask)); - bnh.fnc_mult_mod_tmpThis.remainder_divide(bnh.fnc_mult_mod_tmp_mod, null); - } - bnh.fnc_mult_mod_tmp_x.unlock(); - bnh.fnc_mult_mod_tmp_mod.unlock(); - - bnh.fnc_mult_mod_tmpThis.shrink(); - this.clone(bnh.fnc_mult_mod_tmpThis); - bnh.fnc_mult_mod_tmpThis.unlock(); - } - - - // - /** - * Computes square root of provided bignat which MUST be prime using Tonelli - * Shanks Algorithm. The result (one of the two roots) is stored to this. - * @param p value to compute square root from - */ - public void sqrt_FP(Bignat p) { - PM.check(PM.TRAP_BIGNAT_SQRT_1); - //1. By factoring out powers of 2, find Q and S such that p-1=Q2^S p-1=Q*2^S and Q is odd - bnh.fnc_sqrt_p_1.lock(); - bnh.fnc_sqrt_p_1.clone(p); - PM.check(PM.TRAP_BIGNAT_SQRT_2); - bnh.fnc_sqrt_p_1.decrement_one(); - PM.check(PM.TRAP_BIGNAT_SQRT_3); - - //Compute Q - bnh.fnc_sqrt_Q.lock(); - bnh.fnc_sqrt_Q.clone(bnh.fnc_sqrt_p_1); - bnh.fnc_sqrt_Q.divide_by_2(); //Q /= 2 - PM.check(PM.TRAP_BIGNAT_SQRT_4); - - //Compute S - bnh.fnc_sqrt_S.lock(); - bnh.fnc_sqrt_S.set_size(p.length()); - bnh.fnc_sqrt_S.zero(); - bnh.fnc_sqrt_tmp.lock(); - bnh.fnc_sqrt_tmp.set_size(p.length()); - bnh.fnc_sqrt_tmp.zero(); - - PM.check(PM.TRAP_BIGNAT_SQRT_5); - while (bnh.fnc_sqrt_tmp.same_value(bnh.fnc_sqrt_Q)==false){ - bnh.fnc_sqrt_S.increment_one(); - bnh.fnc_sqrt_tmp.mod_mult(bnh.fnc_sqrt_S, bnh.fnc_sqrt_Q, p); - } - bnh.fnc_sqrt_tmp.unlock(); - PM.check(PM.TRAP_BIGNAT_SQRT_6); - bnh.fnc_sqrt_S.unlock(); - - //2. Find the first quadratic non-residue z by brute-force search - bnh.fnc_sqrt_exp.lock(); - bnh.fnc_sqrt_exp.clone(bnh.fnc_sqrt_p_1); - PM.check(PM.TRAP_BIGNAT_SQRT_7); - bnh.fnc_sqrt_exp.divide_by_2(); - - PM.check(PM.TRAP_BIGNAT_SQRT_8); - - bnh.fnc_sqrt_z.lock(); - bnh.fnc_sqrt_z.set_size(p.length()); - bnh.fnc_sqrt_z.one(); - bnh.fnc_sqrt_tmp.lock(); - bnh.fnc_sqrt_tmp.zero(); - bnh.fnc_sqrt_tmp.copy(Bignat_Helper.ONE); - - PM.check(PM.TRAP_BIGNAT_SQRT_9); - while (bnh.fnc_sqrt_tmp.same_value(bnh.fnc_sqrt_p_1)==false) { - bnh.fnc_sqrt_z.increment_one(); - bnh.fnc_sqrt_tmp.copy(bnh.fnc_sqrt_z); - bnh.fnc_sqrt_tmp.mod_exp(bnh.fnc_sqrt_exp, p); - } - PM.check(PM.TRAP_BIGNAT_SQRT_10); - bnh.fnc_sqrt_p_1.unlock(); - bnh.fnc_sqrt_tmp.unlock(); - bnh.fnc_sqrt_z.unlock(); - bnh.fnc_sqrt_exp.copy(bnh.fnc_sqrt_Q); - bnh.fnc_sqrt_Q.unlock(); - PM.check(PM.TRAP_BIGNAT_SQRT_11); - bnh.fnc_sqrt_exp.increment_one(); - PM.check(PM.TRAP_BIGNAT_SQRT_12); - bnh.fnc_sqrt_exp.divide_by_2(); - PM.check(PM.TRAP_BIGNAT_SQRT_13); - - this.mod(p); - PM.check(PM.TRAP_BIGNAT_SQRT_14); - this.mod_exp(bnh.fnc_sqrt_exp, p); - PM.check(PM.TRAP_BIGNAT_SQRT_15); - bnh.fnc_sqrt_exp.unlock(); - } // end void sqrt(Bignat p) - - - /** - * Computes and stores modulo of this bignat. - * @param modulo value of modulo - */ - public void mod(Bignat modulo) { - this.remainder_divide(modulo, null); - // NOTE: attempt made to utilize crypto co-processor in pow2Mod_RSATrick_worksOnlyAbout30pp, but doesn't work for all inputs - } - - - - /** - * Computes inversion of this bignat taken modulo {@code modulo}. - * The result is stored into this. - * @param modulo value of modulo - */ - public void mod_inv(Bignat modulo) { - bnh.fnc_mod_minus_2.lock(); - bnh.fnc_mod_minus_2.clone(modulo); - bnh.fnc_mod_minus_2.decrement_one(); - bnh.fnc_mod_minus_2.decrement_one(); - - mod_exp(bnh.fnc_mod_minus_2, modulo); - bnh.fnc_mod_minus_2.unlock(); - } - - /** - * Computes {@code res := this ** exponent mod modulo} and store results into this. - * Uses RSA engine to quickly compute this^exponent % modulo - * @param exponent value of exponent - * @param modulo value of modulo - */ - public void mod_exp(Bignat exponent, Bignat modulo) { - short tmp_size = (short)(bnh.MODULO_RSA_ENGINE_MAX_LENGTH_BITS / 8); - bnh.fnc_mod_exp_modBN.lock(); - bnh.fnc_mod_exp_modBN.set_size(tmp_size); - - short len = n_mod_exp(tmp_size, this, exponent.as_byte_array(), exponent.length(), modulo, bnh.fnc_mod_exp_modBN.value, (short) 0); - if (bnh.bIsSimulator) { - // Decrypted length can be either tmp_size or less because of leading zeroes consumed by simulator engine implementation - // Move obtained value into proper position with zeroes prepended - if (len != tmp_size) { - bnh.lock(bnh.fnc_deep_resize_tmp); - Util.arrayFillNonAtomic(bnh.fnc_deep_resize_tmp, (short) 0, (short) bnh.fnc_deep_resize_tmp.length, (byte) 0); - Util.arrayCopyNonAtomic(bnh.fnc_mod_exp_modBN.value, (short) 0, bnh.fnc_deep_resize_tmp, (short) (tmp_size - len), len); - Util.arrayCopyNonAtomic(bnh.fnc_deep_resize_tmp, (short) 0, bnh.fnc_mod_exp_modBN.value, (short) 0, tmp_size); - bnh.unlock(bnh.fnc_deep_resize_tmp); - } - } - else { - // real cards should keep whole length of block, just check - if (len != tmp_size) { - ISOException.throwIt(ReturnCodes.SW_ECPOINT_UNEXPECTED_KA_LEN); - } - } - bnh.fnc_mod_exp_modBN.mod(modulo); - bnh.fnc_mod_exp_modBN.shrink(); - this.clone(bnh.fnc_mod_exp_modBN); - bnh.fnc_mod_exp_modBN.unlock(); - } - - - public void mod_exp2(Bignat modulo) { - mod_exp(Bignat_Helper.TWO, modulo); - //this.pow2Mod_RSATrick(modulo); -/* - short tmp_size = (short) (occ.bnHelper.MOD_RSA_LENGTH / 8); - - // Idea: a = this with prepended zeroes, b = this with appended zeroes, modulo with appended zeroes - // Compute mult_RSATrick - this.prependzeros(tmp_size, occ.bnHelper.helper_BN_A.as_byte_array(), (short) 0); - occ.bnHelper.helper_BN_A.setSize(tmp_size); - this.appendzeros(tmp_size, occ.bnHelper.helper_BN_B.as_byte_array(), (short) 0); - occ.bnHelper.helper_BN_B.setSize(tmp_size); - - mult_RSATrick(occ.bnHelper.helper_BN_A, occ.bnHelper.helper_BN_B); - - // We will use prepared engine with exponent=2 and very large modulus (instead of provided modulus) - // The reason is to avoid need for setting custom modulus and re-init RSA engine - // Mod operation is computed later - occ.bnHelper.modPublicKey.setExponent(occ.bnHelper.CONST_TWO, (short) 0, (short) 1); - occ.locker.lock(occ.bnHelper.fastResizeArray); - modulo.appendzeros(tmp_size, occ.bnHelper.fastResizeArray, (short) 0); - // NOTE: ideally, we would just set RSA engine modulus to our modulo. But smallest RSA key is 512 bit while - // our values are commonly smaller (e.g., 32B for 256b ECC). Prepending leading zeroes will cause 0xf105 (CryptoException.InvalidUse) - //modulo.prependzeros(tmp_size, occ.bnHelper.fastResizeArray, (short) 0); - occ.bnHelper.modPublicKey.setModulus(occ.bnHelper.fastResizeArray, (short) 0, tmp_size); - occ.bnHelper.modCipher.init(occ.bnHelper.modPublicKey, Cipher.MODE_DECRYPT); - this.prependzeros(tmp_size, occ.bnHelper.fastResizeArray, (short) 0); - occ.bnHelper.modCipher.doFinal(occ.bnHelper.fastResizeArray, (byte) 0, tmp_size, occ.bnHelper.fastResizeArray, (short) 0); - occ.locker.unlock(occ.bnHelper.fastResizeArray); - - // We used RSA engine with large modulo => some leading values will be zero (|this^2| <= 2*|this|) - short startOffset = 0; // Find first nonzero value in resulting buffer - while (occ.bnHelper.fastResizeArray[startOffset] == 0) { - startOffset++; - } - short len = (short) (tmp_size - startOffset); - this.setSize(len); - this.from_byte_array(len, (short) 0, occ.bnHelper.fastResizeArray, startOffset); - occ.locker.unlock(occ.bnHelper.fastResizeArray); -*/ - } - /** - * Calculates {@code res := base ** exp mod mod} using RSA engine. - * Requirements: - * 1. Modulo must be either 521, 1024, 2048 or other lengths supported by RSA (see appendzeros() and mod() method) - * 2. Base must have the same size as modulo (see prependzeros()) - * @param baseLen length of base rounded to size of RSA engine - * @param base value of base (if size is not equal to baseLen then zeroes are appended) - * @param exponent array with exponent - * @param exponentLen length of exponent - * @param modulo value of modulo - * @param resultArray array for the computed result - * @param resultOffset start offset of resultArray - */ - private short n_mod_exp(short baseLen, Bignat base, byte[] exponent, short exponentLen, Bignat modulo, byte[] resultArray, short resultOffset) { - // Verify if pre-allocated engine match the required values - if (bnh.fnc_NmodE_pubKey.getSize() < (short) (modulo.length() * 8)) { - // attempt to perform modulu with higher or smaller than supported length - try change constant MODULO_ENGINE_MAX_LENGTH - ISOException.throwIt(ReturnCodes.SW_BIGNAT_MODULOTOOLARGE); - } - if (bnh.fnc_NmodE_pubKey.getSize() < (short) (base.length() * 8)) { - ISOException.throwIt(ReturnCodes.SW_BIGNAT_MODULOTOOLARGE); - } - // Potential problem: we are changing key value for publicKey already used before with occ.bnHelper.modCipher. - // Simulator and potentially some cards fail to initialize this new value properly (probably assuming that same key object will always have same value) - // Fix (if problem occure): generate new key object: RSAPublicKey publicKey = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, (short) (baseLen * 8), false); - - bnh.fnc_NmodE_pubKey.setExponent(exponent, (short) 0, exponentLen); - bnh.lock(bnh.fnc_deep_resize_tmp); - modulo.append_zeros(baseLen, bnh.fnc_deep_resize_tmp, (short) 0); - bnh.fnc_NmodE_pubKey.setModulus(bnh.fnc_deep_resize_tmp, (short) 0, baseLen); - bnh.fnc_NmodE_cipher.init(bnh.fnc_NmodE_pubKey, Cipher.MODE_DECRYPT); - base.prepend_zeros(baseLen, bnh.fnc_deep_resize_tmp, (short) 0); - // BUGBUG: Check if input is not all zeroes (causes out-of-bound exception on some cards) - short len = bnh.fnc_NmodE_cipher.doFinal(bnh.fnc_deep_resize_tmp, (short) 0, baseLen, resultArray, resultOffset); - bnh.unlock(bnh.fnc_deep_resize_tmp); - return len; - } - - /** - * Negate current Bignat modulo provided modulus - * - * @param mod value of modulus - */ - public void mod_negate(Bignat mod) { - bnh.fnc_negate_tmp.lock(); - bnh.fnc_negate_tmp.set_size(mod.length()); - bnh.fnc_negate_tmp.copy(mod); //-y=mod-y - - if (this.lesser(mod)) { // y=mod - this.mod(mod);//-y=y-mod - bnh.fnc_negate_tmp.subtract(this); - this.copy(bnh.fnc_negate_tmp); - } - bnh.fnc_negate_tmp.unlock(); - } - - /** - * Shifts stored value to right by specified number of bytes. This operation equals to multiplication by value numBytes * 256. - * @param numBytes number of bytes to shift - */ - public void shift_bytes_right(short numBytes) { - // Move whole content by numBytes offset - bnh.lock(bnh.fnc_shift_bytes_right_tmp); - Util.arrayCopyNonAtomic(this.value, (short) 0, bnh.fnc_shift_bytes_right_tmp, (short) 0, (short) (this.value.length)); - Util.arrayCopyNonAtomic(bnh.fnc_shift_bytes_right_tmp, (short) 0, this.value, numBytes, (short) ((short) (this.value.length) - numBytes)); - Util.arrayFillNonAtomic(this.value, (short) 0, numBytes, (byte) 0); - bnh.unlock(bnh.fnc_shift_bytes_right_tmp); - } - - /** - * Allocates required underlying storage array with given maximum size and - * allocator type (RAM or EEROM). Maximum size can be increased only by - * future reallocation if allowed by ALLOW_RUNTIME_REALLOCATION flag - * - * @param maxSize maximum size of this Bignat - * @param allocatorType memory allocator type. If - * JCSystem.MEMORY_TYPE_PERSISTENT then memory is allocated in EEPROM. Use - * JCSystem.CLEAR_ON_RESET or JCSystem.CLEAR_ON_DESELECT for allocation in - * RAM with corresponding clearing behaviour. - */ - private void allocate_storage_array(short maxSize, byte allocatorType) { - this.size = maxSize; - this.max_size = maxSize; - this.allocatorType = allocatorType; - this.value = bnh.allocateByteArray(this.max_size, allocatorType); - } - - /** - * Set content of Bignat internal array - * - * @param from_array_length available data in {@code from_array} - * @param this_offset offset where data should be stored - * @param from_array data array to deserialize from - * @param from_array_offset offset in {@code from_array} - * @return the number of shorts actually read, except for the case where - * deserialization finished by reading precisely {@code len} shorts, in this - * case {@code len + 1} is returned. - */ - public short from_byte_array(short from_array_length, short this_offset, byte[] from_array, short from_array_offset) { - short max - = (short) (this_offset + from_array_length) <= this.size - ? from_array_length : (short) (this.size - this_offset); - Util.arrayCopyNonAtomic(from_array, from_array_offset, value, this_offset, max); - if ((short) (this_offset + from_array_length) == this.size) { - return (short) (from_array_length + 1); - } else { - return max; - } - } - - /** - * Set content of Bignat internal array - * - * @param this_offset offset where data should be stored - * @param from_array data array to deserialize from - * @param from_array_length available data in {@code from_array} - * @param from_array_offset offset in {@code from_array} - * @return the number of shorts actually read, except for the case where - * deserialization finished by reading precisely {@code len} shorts, in this - * case {@code len + 1} is returned. - */ - public short set_from_byte_array(short this_offset, byte[] from_array, short from_array_offset, short from_array_length) { - return from_byte_array(from_array_length, this_offset, from_array, from_array_offset); - } - - /** - * Set content of Bignat internal array - * - * @param from_array data array to deserialize from - * @return the number of shorts actually read - */ - public short from_byte_array(byte[] from_array) { - return this.from_byte_array((short) from_array.length, (short) (this.value.length - from_array.length), from_array, (short) 0); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/Bignat_Helper.java b/JCMathLib/src/opencrypto/jcmathlib/Bignat_Helper.java deleted file mode 100644 index 11f7f826..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/Bignat_Helper.java +++ /dev/null @@ -1,207 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.JCSystem; -import javacard.framework.Util; -import javacard.security.KeyBuilder; -import javacard.security.KeyPair; -import javacard.security.MessageDigest; -import javacard.security.RSAPublicKey; -import javacardx.crypto.Cipher; - -/** - * - * @author Petr Svenda - */ -public class Bignat_Helper extends Base_Helper { - /** - * The size of speedup engine used for fast modulo exponent computation - * (must be larger than biggest Bignat used) - */ - public short MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 512; - /** - * The size of speedup engine used for fast multiplication of large numbers - * Must be larger than 2x biggest Bignat used - */ - public short MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 768; - - /** - * If true, fast multiplication of large numbers via RSA engine can be used. - * Is set automatically after successful allocation of required engines - */ - public boolean FLAG_FAST_MULT_VIA_RSA = false; - /** - * Threshold length in bits of an operand after which speedup with RSA - * multiplication is used. Schoolbook multiplication is used for shorter - * operands - */ - public static final short FAST_MULT_VIA_RSA_TRESHOLD_LENGTH = (short) 16; - - byte[] tmp_array_short = null; - - // - // References to underlaying shared objects - // - byte[] fnc_mult_resultArray1 = null; - byte[] fnc_deep_resize_tmp = null; - byte[] fnc_mult_resultArray2 = null; - byte[] fnc_same_value_array1 = null; - byte[] fnc_same_value_hash = null; - byte[] fnc_shift_bytes_right_tmp = null; - - // These Bignats are just pointing to some helper_BN_? so reasonable naming is preserved yet no need to actually allocated whole Bignat object - Bignat fnc_mod_exp_modBN; - - Bignat fnc_mod_add_tmp; - Bignat fnc_mod_sub_tmp; - Bignat fnc_mod_sub_tmpOther; - Bignat fnc_mod_sub_tmpThis; - - Bignat fnc_mod_mult_tmpThis; - - Bignat fnc_mult_mod_tmpThis; - Bignat fnc_mult_mod_tmp_x; - Bignat fnc_mult_mod_tmp_mod; - - Bignat fnc_divide_tmpThis; - - Bignat fnc_gcd_tmp; - Bignat fnc_gcd_tmpOther; - - Bignat fnc_is_coprime_tmp; - - Bignat fnc_exponentiation_i; - Bignat fnc_exponentiation_tmp; - - Bignat fnc_sqrt_p_1; - Bignat fnc_sqrt_Q; - Bignat fnc_sqrt_S; - Bignat fnc_sqrt_tmp; - Bignat fnc_sqrt_exp; - Bignat fnc_sqrt_z; - - Bignat fnc_mod_minus_2; - - Bignat fnc_negate_tmp; - - Bignat fnc_int_add_tmpMag; - Bignat fnc_int_multiply_mod; - Bignat fnc_int_multiply_tmpThis; - Bignat fnc_int_divide_tmpThis; - - RSAPublicKey fnc_NmodE_pubKey; - Cipher fnc_NmodE_cipher; - - public static Bignat ONE; - public static Bignat TWO; - public static Bignat THREE; - - - // Helper objects for fast multiplication of two large numbers (without modulo) - KeyPair fnc_mult_keypair = null; - RSAPublicKey fnc_mult_pubkey_pow2 = null; - Cipher fnc_mult_cipher = null; - MessageDigest hashEngine; - - static byte[] CONST_ONE = {0x01}; - static byte[] CONST_TWO = {0x02}; - - public Bignat_Helper(ResourceManager resman) { - super(resman); - } - - void initialize(short modRSAEngineMaxBits, short multRSAEngineMaxBits) { - MODULO_RSA_ENGINE_MAX_LENGTH_BITS = modRSAEngineMaxBits; - MULT_RSA_ENGINE_MAX_LENGTH_BITS = multRSAEngineMaxBits; - - fnc_deep_resize_tmp = rm.helper_BN_array1; - fnc_mult_resultArray1 = rm.helper_BN_array1; - fnc_mult_resultArray2 = rm.helper_BN_array2; - - fnc_same_value_array1 = rm.helper_BN_array1; - fnc_same_value_hash = rm.helper_BN_array2; - - fnc_shift_bytes_right_tmp = rm.helper_BN_array1; - - // BN below are just reassigned allocated helper_BN_? so that same helper_BN_? is not used in parallel (checked by lock() unlock()) - fnc_mod_add_tmp = rm.helper_BN_A; - - fnc_mod_sub_tmpThis = rm.helper_BN_A; - fnc_mod_sub_tmp = rm.helper_BN_B; - fnc_mod_sub_tmpOther = rm.helper_BN_C; - - fnc_mult_mod_tmpThis = rm.helper_BN_A; - fnc_mult_mod_tmp_mod = rm.helper_BN_B; - fnc_mult_mod_tmp_x = rm.helper_BN_C; - - fnc_exponentiation_tmp = rm.helper_BN_A; - fnc_exponentiation_i = rm.helper_BN_B; - - fnc_mod_minus_2 = rm.helper_BN_B; - - fnc_gcd_tmp = rm.helper_BN_A; - fnc_gcd_tmpOther = rm.helper_BN_B; - - fnc_is_coprime_tmp = rm.helper_BN_C; // is_coprime calls gcd internally - - fnc_negate_tmp = rm.helper_BN_B; - - fnc_sqrt_S = rm.helper_BN_A; - fnc_sqrt_exp = rm.helper_BN_A; - fnc_sqrt_p_1 = rm.helper_BN_B; - fnc_sqrt_Q = rm.helper_BN_C; - fnc_sqrt_tmp = rm.helper_BN_D; - fnc_sqrt_z = rm.helper_BN_E; - - fnc_mod_mult_tmpThis = rm.helper_BN_E; // mod_mult is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when mod_mult is called - - fnc_divide_tmpThis = rm.helper_BN_E; // divide is called from fnc_sqrt => requires helper_BN_E not being locked in fnc_sqrt when divide is called - - fnc_mod_exp_modBN = rm.helper_BN_F; // mod_exp is called from fnc_sqrt => requires helper_BN_F not being locked in fnc_sqrt when mod_exp is called - - fnc_int_add_tmpMag = rm.helper_BN_A; - fnc_int_multiply_mod = rm.helper_BN_A; - fnc_int_multiply_tmpThis = rm.helper_BN_B; - fnc_int_divide_tmpThis = rm.helper_BN_A; - - - // Allocate BN constants always in EEPROM (only reading) - ONE = new Bignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this); - ONE.one(); - TWO = new Bignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this); - TWO.two(); - THREE = new Bignat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this); - THREE.three(); - - tmp_array_short = rm.memAlloc.allocateByteArray((short) 2, JCSystem.MEMORY_TYPE_TRANSIENT_RESET); // only 2b RAM for faster add(short) - fnc_NmodE_cipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false); - fnc_NmodE_pubKey = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, MODULO_RSA_ENGINE_MAX_LENGTH_BITS, false); - - // Speedup for fast multiplication - fnc_mult_keypair = new KeyPair(KeyPair.ALG_RSA_CRT, MULT_RSA_ENGINE_MAX_LENGTH_BITS); - fnc_mult_keypair.genKeyPair(); - fnc_mult_pubkey_pow2 = (RSAPublicKey) fnc_mult_keypair.getPublic(); - //mult_privkey_pow2 = (RSAPrivateCrtKey) mult_keypair.getPrivate(); - fnc_mult_pubkey_pow2.setExponent(CONST_TWO, (short) 0, (short) CONST_TWO.length); - fnc_mult_cipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false); - - hashEngine = rm.hashEngine; - - FLAG_FAST_MULT_VIA_RSA = false; // set true only if succesfully allocated and tested below - try { // Subsequent code may fail on some real (e.g., Infineon CJTOP80K) cards - catch exception - fnc_mult_cipher.init(fnc_mult_pubkey_pow2, Cipher.MODE_ENCRYPT); - // Try operation - if doesn't work, exception SW_CANTALLOCATE_BIGNAT is emitted - Util.arrayFillNonAtomic(fnc_mult_resultArray1, (short) 0, (short) fnc_mult_resultArray1.length, (byte) 6); - fnc_mult_cipher.doFinal(fnc_mult_resultArray1, (short) 0, (short) fnc_mult_resultArray1.length, fnc_mult_resultArray1, (short) 0); - FLAG_FAST_MULT_VIA_RSA = true; - } catch (Exception ignored) { - } // discard exception - } - - /** - * Erase all values stored in helper objects - */ - void erase() { - rm.erase(); - Util.arrayFillNonAtomic(tmp_array_short, (short) 0, (short) tmp_array_short.length, (byte) 0); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ECConfig.java b/JCMathLib/src/opencrypto/jcmathlib/ECConfig.java deleted file mode 100644 index 12aae7b3..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ECConfig.java +++ /dev/null @@ -1,130 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.ISOException; - -/** - * Configure itself to proper lengths and other parameters according to intended length of ECC - * @author Petr Svenda - */ -public class ECConfig { - /** - * The size of speedup engine used for fast modulo exponent computation - * (must be larger than biggest Bignat used) - */ - public short MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 512; - /** - * The size of speedup engine used for fast multiplication of large numbers - * Must be larger than 2x biggest Bignat used - */ - public short MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 768; - /** - * The size of largest integer used in computations - */ - public short MAX_BIGNAT_SIZE = (short) 65; // ((short) (MODULO_ENGINE_MAX_LENGTH_BITS / 8) + 1); - /** - * The size of largest ECC point used - */ - public short MAX_POINT_SIZE = (short) 64; - /** - * The size of single coordinate of the largest ECC point used - */ - public short MAX_COORD_SIZE = (short) 32; // MAX_POINT_SIZE / 2 - - - public ResourceManager rm = null; - /** - * Helper structure containing all preallocated objects necessary for Bignat operations - */ - public Bignat_Helper bnh = null; - /** - * Helper structure containing all preallocated objects necessary for ECPoint operations - */ - public ECPoint_Helper ech = null; - - /** - * Creates new control structure for requested bit length with all preallocated arrays and engines - * @param maxECLength maximum length of ECPoint objects supported. The provided value is used to - * initialize properly underlying arrays and engines. - */ - public ECConfig(short maxECLength) { - - // Allocate helper objects for BN and EC - // Note: due to circular references, we need to split object creation and actual alloaction and initailiztion later (initialize()) - rm = new ResourceManager(); - bnh = new Bignat_Helper(rm); - ech = new ECPoint_Helper(rm); - - // Set proper lengths and other internal settings based on required ECC length - if (maxECLength <= (short) 256) { - setECC256Config(); - } - else if (maxECLength <= (short) 384) { - setECC384Config(); - } - else if (maxECLength <= (short) 512) { - setECC512Config(); - } - else { - ISOException.throwIt(ReturnCodes.SW_ECPOINT_INVALIDLENGTH); - } - - // Allocate shared resources and initialize mapping between shared objects and helpers - rm.initialize(MAX_POINT_SIZE, MAX_COORD_SIZE, MAX_BIGNAT_SIZE, MULT_RSA_ENGINE_MAX_LENGTH_BITS, bnh); - bnh.initialize(MODULO_RSA_ENGINE_MAX_LENGTH_BITS, MULT_RSA_ENGINE_MAX_LENGTH_BITS); - ech.initialize(); - } - - public void refreshAfterReset() { - if (rm.locker != null) { - rm.locker.refreshAfterReset(); - } - } - - void reset() { - bnh.FLAG_FAST_MULT_VIA_RSA = false; - ech.FLAG_FAST_EC_MULT_VIA_KA = false; - } - - public void setECC256Config() { - reset(); - MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 512; - MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 768; - MAX_POINT_SIZE = (short) 64; - computeDerivedLengths(); - } - public void setECC384Config() { - reset(); - MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 768; - MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 1024; - MAX_POINT_SIZE = (short) 96; - computeDerivedLengths(); - } - public void setECC512Config() { - reset(); - MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 1024; - MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 1280; - MAX_POINT_SIZE = (short) 128; - computeDerivedLengths(); - } - public void setECC521Config() { - reset(); - MODULO_RSA_ENGINE_MAX_LENGTH_BITS = (short) 1280; - MULT_RSA_ENGINE_MAX_LENGTH_BITS = (short) 1280; - MAX_POINT_SIZE = (short) 129; - computeDerivedLengths(); - } - - private void computeDerivedLengths() { - MAX_BIGNAT_SIZE = (short) ((short) (bnh.MODULO_RSA_ENGINE_MAX_LENGTH_BITS / 8) + 1); - MAX_COORD_SIZE = (short) (MAX_POINT_SIZE / 2); - } - - /** - * Unlocks all logically locked arrays and objects. Useful as recovery after premature end of some operation (e.g., due to exception) - * when some objects remains locked. - */ - void unlockAll() { - rm.unlockAll(); - rm.locker.unlockAll(); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ECCurve.java b/JCMathLib/src/opencrypto/jcmathlib/ECCurve.java deleted file mode 100644 index b5c1f3cd..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ECCurve.java +++ /dev/null @@ -1,210 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.Util; -import javacard.security.ECPrivateKey; -import javacard.security.ECPublicKey; -import javacard.security.KeyBuilder; -import javacard.security.KeyPair; - -/** - * - * @author Vasilios Mavroudis and Petr Svenda - */ -public class ECCurve { - public final short KEY_LENGTH; //Bits - public final short POINT_SIZE; //Bytes - public final short COORD_SIZE; //Bytes - - //Parameters - public byte[] p = null; - public byte[] a = null; - public byte[] b = null; - public byte[] G = null; - public byte[] r = null; - - public Bignat pBN; - public Bignat aBN; - public Bignat bBN; - - public KeyPair disposable_pair; - public ECPrivateKey disposable_priv; - - - - /** - * Creates new curve object from provided parameters. Either copy of provided - * arrays is performed (bCopyArgs == true, input arrays can be reused later for other - * purposes) or arguments are directly stored (bCopyArgs == false, usable for fixed static arrays) . - * @param bCopyArgs if true, copy of arguments is created, otherwise reference is directly stored - * @param p_arr array with p - * @param a_arr array with a - * @param b_arr array with b - * @param G_arr array with base point G - * @param r_arr array with r - */ - public ECCurve(boolean bCopyArgs, byte[] p_arr, byte[] a_arr, byte[] b_arr, byte[] G_arr, byte[] r_arr) { - //ECCurve_initialize(p_arr, a_arr, b_arr, G_arr, r_arr); - this.KEY_LENGTH = (short) (p_arr.length * 8); - this.POINT_SIZE = (short) G_arr.length; - this.COORD_SIZE = (short) ((short) (G_arr.length - 1) / 2); - - if (bCopyArgs) { - // Copy curve parameters into newly allocated arrays in EEPROM (will be only read, not written later => good performance even when in EEPROM) - this.p = new byte[(short) p_arr.length]; - this.a = new byte[(short) a_arr.length]; - this.b = new byte[(short) b_arr.length]; - this.G = new byte[(short) G_arr.length]; - this.r = new byte[(short) r_arr.length]; - - Util.arrayCopyNonAtomic(p_arr, (short) 0, p, (short) 0, (short) p.length); - Util.arrayCopyNonAtomic(a_arr, (short) 0, a, (short) 0, (short) a.length); - Util.arrayCopyNonAtomic(b_arr, (short) 0, b, (short) 0, (short) b.length); - Util.arrayCopyNonAtomic(G_arr, (short) 0, G, (short) 0, (short) G.length); - Util.arrayCopyNonAtomic(r_arr, (short) 0, r, (short) 0, (short) r.length); - } - else { - // No allocation, store directly provided arrays - this.p = p_arr; - this.a = a_arr; - this.b = b_arr; - this.G = G_arr; - this.r = r_arr; - } - - // We will not modify values of p/a/b during the lifetime of curve => allocate helper bignats directly from the array - // Additionally, these Bignats will be only read from so Bignat_Helper can be null (saving need to pass as argument to ECCurve) - this.pBN = new Bignat(this.p, null); - this.aBN = new Bignat(this.a, null); - this.bBN = new Bignat(this.b, null); - - this.disposable_pair = this.newKeyPair(null); - this.disposable_priv = (ECPrivateKey) this.disposable_pair.getPrivate(); - } - - /** - * Refresh critical information stored in RAM for performance reasons after a card reset (RAM was cleared). - */ - public void updateAfterReset() { - this.pBN.from_byte_array(this.p); - this.aBN.from_byte_array(this.a); - this.bBN.from_byte_array(this.b); - } - - /** - * Creates a new keyPair based on this curve parameters. KeyPair object is reused if provided. Fresh keyPair value is generated. - * @param existingKeyPair existing KeyPair object which is reused if required. If null, new KeyPair is allocated - * @return new or existing object with fresh key pair value - */ - KeyPair newKeyPair(KeyPair existingKeyPair) { - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_1); - ECPrivateKey privKey; - ECPublicKey pubKey; - if (existingKeyPair == null) { // Allocate if not supplied - existingKeyPair = new KeyPair(KeyPair.ALG_EC_FP, KEY_LENGTH); - } - - // Some implementation will not return valid pub key until ecKeyPair.genKeyPair() is called - // Other implementation will fail with exception if same is called => try catch and drop any exception - try { - pubKey = (ECPublicKey) existingKeyPair.getPublic(); - if (pubKey == null) { - existingKeyPair.genKeyPair(); - } - } catch (Exception e) { - } // intentionally do nothing - - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_2); - privKey = (ECPrivateKey) existingKeyPair.getPrivate(); - pubKey = (ECPublicKey) existingKeyPair.getPublic(); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_3); - - // Set required values - privKey.setFieldFP(p, (short) 0, (short) p.length); - privKey.setA(a, (short) 0, (short) a.length); - privKey.setB(b, (short) 0, (short) b.length); - privKey.setG(G, (short) 0, (short) G.length); - privKey.setR(r, (short) 0, (short) r.length); - privKey.setK((short) 1); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_4); - - pubKey.setFieldFP(p, (short) 0, (short) p.length); - pubKey.setA(a, (short) 0, (short) a.length); - pubKey.setB(b, (short) 0, (short) b.length); - pubKey.setG(G, (short) 0, (short) G.length); - pubKey.setR(r, (short) 0, (short) r.length); - pubKey.setK((short) 1); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_5); - - existingKeyPair.genKeyPair(); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_6); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_7); - - return existingKeyPair; - } - - public KeyPair newKeyPair_legacy(KeyPair existingKeyPair) { - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_1); - ECPrivateKey privKey; - ECPublicKey pubKey; - if (existingKeyPair == null) { - // We need to create required objects - privKey = (ECPrivateKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KEY_LENGTH, false); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_2); - pubKey = (ECPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC, KEY_LENGTH, false); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_3); - } - else { - // Obtain from object - privKey = (ECPrivateKey) existingKeyPair.getPrivate(); - pubKey = (ECPublicKey) existingKeyPair.getPublic(); - } - // Set required values - privKey.setFieldFP(p, (short) 0, (short) p.length); - privKey.setA(a, (short) 0, (short) a.length); - privKey.setB(b, (short) 0, (short) b.length); - privKey.setG(G, (short) 0, (short) G.length); - privKey.setR(r, (short) 0, (short) r.length); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_4); - - pubKey.setFieldFP(p, (short) 0, (short) p.length); - pubKey.setA(a, (short) 0, (short) a.length); - pubKey.setB(b, (short) 0, (short) b.length); - pubKey.setG(G, (short) 0, (short) G.length); - pubKey.setR(r, (short) 0, (short) r.length); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_5); - - if (existingKeyPair == null) { // Allocate if not supplied - existingKeyPair = new KeyPair(pubKey, privKey); - } - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_6); - existingKeyPair.genKeyPair(); - PM.check(PM.TRAP_ECCURVE_NEWKEYPAIR_7); - - return existingKeyPair; - } - - - /** - * Converts provided Bignat into temporary EC private key object. No new - * allocation is performed, returned ECPrivateKey is overwritten by next call. - * @param bn Bignat with new value - * @return ECPrivateKey initialized with provided Bignat - */ - public ECPrivateKey bignatAsPrivateKey(Bignat bn) { - disposable_priv.setS(bn.as_byte_array(), (short) 0, bn.length()); - return disposable_priv; - } - - /** - * Set new G for this curve. Also updates all dependent key values. - * @param newG buffer with new G - * @param newGOffset start offset within newG - * @param newGLen length of new G - */ - public void setG(byte[] newG, short newGOffset, short newGLen) { - Util.arrayCopyNonAtomic(newG, newGOffset, G, (short) 0, newGLen); - this.disposable_pair = this.newKeyPair(this.disposable_pair); - this.disposable_priv = (ECPrivateKey) this.disposable_pair.getPrivate(); - this.disposable_priv.setG(newG, newGOffset, newGLen); - } -} \ No newline at end of file diff --git a/JCMathLib/src/opencrypto/jcmathlib/ECExample.java b/JCMathLib/src/opencrypto/jcmathlib/ECExample.java deleted file mode 100644 index f758dfae..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ECExample.java +++ /dev/null @@ -1,45 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.APDU; -import javacard.framework.Applet; - -/** - * - * @author Petr Svenda - */ -public class ECExample extends Applet { - ECConfig ecc = null; - ECCurve curve = null; - ECPoint point1 = null; - ECPoint point2 = null; - - final static byte[] ECPOINT_TEST_VALUE = {(byte)0x04, (byte) 0x3B, (byte) 0xC1, (byte) 0x5B, (byte) 0xE5, (byte) 0xF7, (byte) 0x52, (byte) 0xB3, (byte) 0x27, (byte) 0x0D, (byte) 0xB0, (byte) 0xAE, (byte) 0xF2, (byte) 0xBC, (byte) 0xF0, (byte) 0xEC, (byte) 0xBD, (byte) 0xB5, (byte) 0x78, (byte) 0x8F, (byte) 0x88, (byte) 0xE6, (byte) 0x14, (byte) 0x32, (byte) 0x30, (byte) 0x68, (byte) 0xC4, (byte) 0xC4, (byte) 0x88, (byte) 0x6B, (byte) 0x43, (byte) 0x91, (byte) 0x4C, (byte) 0x22, (byte) 0xE1, (byte) 0x67, (byte) 0x68, (byte) 0x3B, (byte) 0x32, (byte) 0x95, (byte) 0x98, (byte) 0x31, (byte) 0x19, (byte) 0x6D, (byte) 0x41, (byte) 0x88, (byte) 0x0C, (byte) 0x9F, (byte) 0x8C, (byte) 0x59, (byte) 0x67, (byte) 0x60, (byte) 0x86, (byte) 0x1A, (byte) 0x86, (byte) 0xF8, (byte) 0x0D, (byte) 0x01, (byte) 0x46, (byte) 0x0C, (byte) 0xB5, (byte) 0x8D, (byte) 0x86, (byte) 0x6C, (byte) 0x09}; - final static byte[] SCALAR_TEST_VALUE = {(byte) 0xE8, (byte) 0x05, (byte) 0xE8, (byte) 0x02, (byte) 0xBF, (byte) 0xEC, (byte) 0xEE, (byte) 0x91, (byte) 0x9B, (byte) 0x3D, (byte) 0x3B, (byte) 0xD8, (byte) 0x3C, (byte) 0x7B, (byte) 0x52, (byte) 0xA5, (byte) 0xD5, (byte) 0x35, (byte) 0x4C, (byte) 0x4C, (byte) 0x06, (byte) 0x89, (byte) 0x80, (byte) 0x54, (byte) 0xB9, (byte) 0x76, (byte) 0xFA, (byte) 0xB1, (byte) 0xD3, (byte) 0x5A, (byte) 0x10, (byte) 0x91}; - - public ECExample() { - // Pre-allocate all helper structures - ecc = new ECConfig((short) 256); - // Pre-allocate standard SecP256r1 curve and two EC points on this curve - curve = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r); - point1 = new ECPoint(curve, ecc.ech); - point2 = new ECPoint(curve, ecc.ech); - } - - public static void install(byte[] bArray, short bOffset, byte bLength) { - new ECExample().register(); - } - - public boolean select() { - ecc.refreshAfterReset(); - return true; - } - - public void process(APDU apdu) { - if (selectingApplet()) { return; } - // NOTE: very simple EC usage example - no cla/ins, no communication with host... - point1.randomize(); // Generate first point at random - point2.setW(ECPOINT_TEST_VALUE, (short) 0, (short) ECPOINT_TEST_VALUE.length); // Set second point to predefined value - point1.add(point2); // Add two points together - point1.multiplication(SCALAR_TEST_VALUE, (short) 0, (short) SCALAR_TEST_VALUE.length); // Multiply point by large scalar - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ECPoint.java b/JCMathLib/src/opencrypto/jcmathlib/ECPoint.java deleted file mode 100644 index 06ebc841..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ECPoint.java +++ /dev/null @@ -1,583 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.ISOException; -import javacard.framework.Util; -import javacard.security.CryptoException; -import javacard.security.ECPrivateKey; -import javacard.security.ECPublicKey; -import javacard.security.KeyPair; -import javacard.security.Signature; - -/** - * - * @author Vasilios Mavroudis and Petr Svenda - */ -public class ECPoint { - private final ECPoint_Helper ech; - - private ECPublicKey thePoint; - private KeyPair thePointKeyPair; - private final ECCurve theCurve; - - /** - * Creates new ECPoint object for provided {@code curve}. Random initial point value is generated. - * The point will use helper structures from provided ECPoint_Helper object. - * @param curve point's elliptic curve - * @param ech object with preallocated helper objects and memory arrays - */ - public ECPoint(ECCurve curve, ECPoint_Helper ech) { - this.theCurve = curve; - this.ech = ech; - updatePointObjects(); - } - - /** - * Returns length of this point in bytes. - * - * @return - */ - public short length() { - return (short) (thePoint.getSize() / 8); - } - - /** - * Properly updates all point values in case of a change of an underlying curve. - * New random point value is generated. - */ - public final void updatePointObjects() { - this.thePointKeyPair = this.theCurve.newKeyPair(this.thePointKeyPair); - this.thePoint = (ECPublicKey) thePointKeyPair.getPublic(); - } - /** - * Generates new random point value. - */ - public void randomize(){ - if (this.thePointKeyPair == null) { - this.thePointKeyPair = this.theCurve.newKeyPair(this.thePointKeyPair); - this.thePoint = (ECPublicKey) thePointKeyPair.getPublic(); - } - else { - this.thePointKeyPair.genKeyPair(); - } - } - - /** - * Copy value of provided point into this. This and other point must have - * curve with same parameters, only length is checked. - * @param other point to be copied - */ - public void copy(ECPoint other) { - if (this.length() != other.length()) { - ISOException.throwIt(ReturnCodes.SW_ECPOINT_INVALIDLENGTH); - } - ech.lock(ech.uncompressed_point_arr1); - short len = other.getW(ech.uncompressed_point_arr1, (short) 0); - this.setW(ech.uncompressed_point_arr1, (short) 0, len); - ech.unlock(ech.uncompressed_point_arr1); - } - - /** - * Set this point value (parameter W) from array with value encoded as per ANSI X9.62. - * The uncompressed form is always supported. If underlying native JavaCard implementation - * of {@code ECPublickKey} supports compressed points, then this method accepts also compressed points. - * @param buffer array with serialized point - * @param offset start offset within input array - * @param length length of point - */ - public void setW(byte[] buffer, short offset, short length) { - this.thePoint.setW(buffer, offset, length); - } - - /** - * Returns current value of this point. - * @param buffer memory array where to store serailized point value - * @param offset start offset for output serialized point - * @return length of serialized point (number of bytes) - */ - public short getW(byte[] buffer, short offset) { - return thePoint.getW(buffer, offset); - } - - /** - * Returns this point value as ECPublicKey object. No copy of point is made - * before return, so change of returned object will also change this point value. - * @return point as ECPublicKey object - */ - public ECPublicKey asPublicKey() { - return this.thePoint; - } - - /** - * Returns curve associated with this point. No copy of curve is made - * before return, so change of returned object will also change curve for - * this point. - * - * @return curve as ECCurve object - */ - public ECCurve getCurve() { - return theCurve; - } - - /** - * Returns the X coordinate of this point in uncompressed form. - * @param buffer output array for X coordinate - * @param offset start offset within output array - * @return length of X coordinate (in bytes) - */ - public short getX(byte[] buffer, short offset) { - ech.lock(ech.uncompressed_point_arr1); - thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - Util.arrayCopyNonAtomic(ech.uncompressed_point_arr1, (short) 1, buffer, offset, this.theCurve.COORD_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - return this.theCurve.COORD_SIZE; - } - - /** - * Returns the Y coordinate of this point in uncompressed form. - * - * @param buffer output array for Y coordinate - * @param offset start offset within output array - * @return length of Y coordinate (in bytes) - */ - public short getY(byte[] buffer, short offset) { - ech.lock(ech.uncompressed_point_arr1); - thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - Util.arrayCopyNonAtomic(ech.uncompressed_point_arr1, (short)(1 + this.theCurve.COORD_SIZE), buffer, offset, this.theCurve.COORD_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - return this.theCurve.COORD_SIZE; - } - /** - * Returns the Y coordinate of this point in form of Bignat object. - * - * @param yCopy Bignat object which will be set with value of this point - */ - public void getY(Bignat yCopy) { - yCopy.set_size(this.getY(yCopy.as_byte_array(), (short) 0)); - } - - - - - /** - * Doubles the current value of this point. - */ - public void makeDouble() { - // doubling via add sometimes causes exception inside KeyAgreement engine - // this.add(this); - // Use bit slower, but more robust version via multiplication by 2 - this.multiplication(Bignat_Helper.TWO); - } - - /** - * Adds this (P) and provided (Q) point. Stores a resulting value into this point. - * @param other point to be added to this. - */ - public void add(ECPoint other) { - PM.check(PM.TRAP_ECPOINT_ADD_1); - - boolean samePoint = this == other || isEqual(other); - - ech.lock(ech.uncompressed_point_arr1); - this.thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - ech.fnc_add_x_p.lock(); - ech.fnc_add_x_p.set_size(this.theCurve.COORD_SIZE); - ech.fnc_add_x_p.from_byte_array(this.theCurve.COORD_SIZE, (short) 0, ech.uncompressed_point_arr1, (short) 1); - ech.fnc_add_y_p.lock(); - ech.fnc_add_y_p.set_size(this.theCurve.COORD_SIZE); - ech.fnc_add_y_p.from_byte_array(this.theCurve.COORD_SIZE, (short) 0, ech.uncompressed_point_arr1, (short) (1 + this.theCurve.COORD_SIZE)); - ech.unlock(ech.uncompressed_point_arr1); - - PM.check(PM.TRAP_ECPOINT_ADD_2); - - // l = (y_q-y_p)/(x_q-x_p)) - // x_r = l^2 - x_p -x_q - // y_r = l(x_p-x_r)-y_p - - // P+Q=R - ech.fnc_add_nominator.lock(); - ech.fnc_add_denominator.lock(); - if (samePoint) { - //lambda = (3(x_p^2)+a)/(2y_p) - //(3(x_p^2)+a) - ech.fnc_add_nominator.clone(ech.fnc_add_x_p); - ech.fnc_add_nominator.mod_exp(Bignat_Helper.TWO, this.theCurve.pBN); - ech.fnc_add_nominator.mod_mult(ech.fnc_add_nominator, Bignat_Helper.THREE, this.theCurve.pBN); - ech.fnc_add_nominator.mod_add(this.theCurve.aBN, this.theCurve.pBN); - // (2y_p) - ech.fnc_add_denominator.clone(ech.fnc_add_y_p); - ech.fnc_add_denominator.mod_mult(ech.fnc_add_y_p, Bignat_Helper.TWO, this.theCurve.pBN); - ech.fnc_add_denominator.mod_inv(this.theCurve.pBN); - - } else { - // lambda=(y_q-y_p)/(x_q-x_p) mod p - ech.lock(ech.uncompressed_point_arr1); - other.thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - ech.fnc_add_x_q.lock(); - ech.fnc_add_x_q.set_size(this.theCurve.COORD_SIZE); - ech.fnc_add_x_q.from_byte_array(other.theCurve.COORD_SIZE, (short) 0, ech.uncompressed_point_arr1, (short) 1); - ech.fnc_add_nominator.set_size(this.theCurve.COORD_SIZE); - ech.fnc_add_nominator.from_byte_array(this.theCurve.COORD_SIZE, (short) 0, ech.uncompressed_point_arr1, (short) (1 + this.theCurve.COORD_SIZE)); - ech.unlock(ech.uncompressed_point_arr1); - - PM.check(PM.TRAP_ECPOINT_ADD_3); - ech.fnc_add_nominator.mod(this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_ADD_4); - - ech.fnc_add_nominator.mod_sub(ech.fnc_add_y_p, this.theCurve.pBN); - - // (x_q-x_p) - ech.fnc_add_denominator.clone(ech.fnc_add_x_q); - ech.fnc_add_denominator.mod(this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_ADD_5); - ech.fnc_add_denominator.mod_sub(ech.fnc_add_x_p, this.theCurve.pBN); - ech.fnc_add_denominator.mod_inv(this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_ADD_6); - } - - ech.fnc_add_lambda.lock(); - ech.fnc_add_lambda.resize_to_max(false); - ech.fnc_add_lambda.zero(); - ech.fnc_add_lambda.mod_mult(ech.fnc_add_nominator, ech.fnc_add_denominator, this.theCurve.pBN); - ech.fnc_add_nominator.unlock(); - ech.fnc_add_denominator.unlock(); - PM.check(PM.TRAP_ECPOINT_ADD_7); - - // (x_p,y_p)+(x_q,y_q)=(x_r,y_r) - // lambda=(y_q-y_p)/(x_q-x_p) - - //x_r=lambda^2-x_p-x_q - ech.fnc_add_x_r.lock(); - if (samePoint) { - short len = this.multiplication_x(Bignat_Helper.TWO, ech.fnc_add_x_r.as_byte_array(), (short) 0); - ech.fnc_add_x_r.set_size(len); - } else { - ech.fnc_add_x_r.clone(ech.fnc_add_lambda); - //m_occ.ecHelper.fnc_add_x_r.mod_exp(occ.bnHelper.TWO, this.TheCurve.pBN); - ech.fnc_add_x_r.mod_exp2(this.theCurve.pBN); - ech.fnc_add_x_r.mod_sub(ech.fnc_add_x_p, this.theCurve.pBN); - ech.fnc_add_x_r.mod_sub(ech.fnc_add_x_q, this.theCurve.pBN); - ech.fnc_add_x_q.unlock(); - PM.check(PM.TRAP_ECPOINT_ADD_8); - } - //y_r=lambda(x_p-x_r)-y_p - ech.fnc_add_y_r.lock(); - ech.fnc_add_y_r.clone(ech.fnc_add_x_p); - ech.fnc_add_x_p.unlock(); - ech.fnc_add_y_r.mod_sub(ech.fnc_add_x_r, this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_ADD_9); - ech.fnc_add_y_r.mod_mult(ech.fnc_add_y_r, ech.fnc_add_lambda, this.theCurve.pBN); - ech.fnc_add_lambda.unlock(); - PM.check(PM.TRAP_ECPOINT_ADD_10); - ech.fnc_add_y_r.mod_sub(ech.fnc_add_y_p, this.theCurve.pBN); - ech.fnc_add_y_p.unlock(); - PM.check(PM.TRAP_ECPOINT_ADD_11); - - ech.lock(ech.uncompressed_point_arr1); - ech.uncompressed_point_arr1[0] = (byte)0x04; - // If x_r.length() and y_r.length() is smaller than this.TheCurve.COORD_SIZE due to leading zeroes which were shrinked before, then we must add these back - ech.fnc_add_x_r.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) 1); - ech.fnc_add_x_r.unlock(); - ech.fnc_add_y_r.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) (1 + this.theCurve.COORD_SIZE)); - ech.fnc_add_y_r.unlock(); - PM.check(PM.TRAP_ECPOINT_ADD_12); - this.setW(ech.uncompressed_point_arr1, (short) 0, this.theCurve.POINT_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - PM.check(PM.TRAP_ECPOINT_ADD_13); - } - - /** - * Multiply value of this point by provided scalar. Stores the result into - * this point. - * - * @param scalar value of scalar for multiplication - */ - public void multiplication(byte[] scalar, short scalarOffset, short scalarLen) { - ech.fnc_multiplication_scalar.lock(); - ech.fnc_multiplication_scalar.set_size(scalarLen); - ech.fnc_multiplication_scalar.from_byte_array(scalarLen, (short) 0, scalar, scalarOffset); - multiplication(ech.fnc_multiplication_scalar); - ech.fnc_multiplication_scalar.unlock(); - } - /** - * Multiply value of this point by provided scalar. Stores the result into this point. - * @param scalar value of scalar for multiplication - */ - public void multiplication(Bignat scalar) { - PM.check(PM.TRAP_ECPOINT_MULT_1); - - ech.fnc_multiplication_x.lock(); - short len = this.multiplication_x(scalar, ech.fnc_multiplication_x.as_byte_array(), (short) 0); - ech.fnc_multiplication_x.set_size(len); - PM.check(PM.TRAP_ECPOINT_MULT_2); - - //Y^2 = X^3 + XA + B = x(x^2+A)+B - ech.fnc_multiplication_y_sq.lock(); - ech.fnc_multiplication_y_sq.clone(ech.fnc_multiplication_x); - PM.check(PM.TRAP_ECPOINT_MULT_3); - ech.fnc_multiplication_y_sq.mod_exp(Bignat_Helper.TWO, this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_MULT_4); - ech.fnc_multiplication_y_sq.mod_add(this.theCurve.aBN, this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_MULT_5); - ech.fnc_multiplication_y_sq.mod_mult(ech.fnc_multiplication_y_sq, ech.fnc_multiplication_x, this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_MULT_6); - ech.fnc_multiplication_y_sq.mod_add(this.theCurve.bBN, this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_MULT_7); - ech.fnc_multiplication_y1.lock(); - ech.fnc_multiplication_y1.clone(ech.fnc_multiplication_y_sq); - ech.fnc_multiplication_y_sq.unlock(); - PM.check(PM.TRAP_ECPOINT_MULT_8); - ech.fnc_multiplication_y1.sqrt_FP(this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_MULT_9); - - // Construct public key with - ech.lock(ech.uncompressed_point_arr1); - ech.uncompressed_point_arr1[0] = 0x04; - ech.fnc_multiplication_x.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) 1); - ech.fnc_multiplication_x.unlock(); - ech.fnc_multiplication_y1.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) (1 + theCurve.COORD_SIZE)); - this.setW(ech.uncompressed_point_arr1, (short) 0, theCurve.POINT_SIZE); //So that we can convert to pub key - PM.check(PM.TRAP_ECPOINT_MULT_10); - - // Check if public point corresponds to the "secret" (i.e., our scalar) - ech.lock(ech.fnc_multiplication_resultArray); - if (!SignVerifyECDSA(this.theCurve.bignatAsPrivateKey(scalar), this.asPublicKey(), this.ech.fnc_SignVerifyECDSA_signEngine, ech.fnc_multiplication_resultArray)) { //If verification fails, then pick the - ech.fnc_multiplication_y2.lock(); - ech.fnc_multiplication_y2.clone(this.theCurve.pBN); //y_2 = p - y_1 - ech.fnc_multiplication_y2.mod_sub(ech.fnc_multiplication_y1, this.theCurve.pBN); - ech.fnc_multiplication_y2.copy_to_buffer(ech.uncompressed_point_arr1, (short) (1 + theCurve.COORD_SIZE)); - ech.fnc_multiplication_y2.unlock(); - } - ech.unlock(ech.fnc_multiplication_resultArray); - ech.fnc_multiplication_y1.unlock(); - - PM.check(PM.TRAP_ECPOINT_MULT_11); - - this.setW(ech.uncompressed_point_arr1, (short)0, theCurve.POINT_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - - PM.check(PM.TRAP_ECPOINT_MULT_12); - } - - /** - * Multiplies this point value with provided scalar and stores result into provided array. - * No modification of this point is performed. - * @param scalar value of scalar for multiplication - * @param outBuffer output array for resulting value - * @param outBufferOffset offset within output array - * @return length of resulting value (in bytes) - */ - public short multiplication_x(Bignat scalar, byte[] outBuffer, short outBufferOffset) { - return multiplication_x_KA(scalar, outBuffer, outBufferOffset); - } - - - /** - * Multiplies this point value with provided scalar and stores result into - * provided array. No modification of this point is performed. - * Native KeyAgreement engine is used. - * - * @param scalar value of scalar for multiplication - * @param outBuffer output array for resulting value - * @param outBufferOffset offset within output array - * @return length of resulting value (in bytes) - */ - private short multiplication_x_KA(Bignat scalar, byte[] outBuffer, short outBufferOffset) { - // NOTE: potential problem on real cards (j2e) - when small scalar is used (e.g., Bignat.TWO), operation sometimes freezes - PM.check(PM.TRAP_ECPOINT_MULT_X_1); - theCurve.disposable_priv.setS(scalar.as_byte_array(), (short) 0, scalar.length()); - PM.check(PM.TRAP_ECPOINT_MULT_X_2); - - ech.fnc_multiplication_x_keyAgreement.init(theCurve.disposable_priv); - PM.check(PM.TRAP_ECPOINT_MULT_X_3); - - ech.lock(ech.uncompressed_point_arr1); - short len = this.getW(ech.uncompressed_point_arr1, (short) 0); - PM.check(PM.TRAP_ECPOINT_MULT_X_4); - len = ech.fnc_multiplication_x_keyAgreement.generateSecret(ech.uncompressed_point_arr1, (short) 0, len, outBuffer, outBufferOffset); - ech.unlock(ech.uncompressed_point_arr1); - PM.check(PM.TRAP_ECPOINT_MULT_X_5); - // Return always length of whole coordinate X instead of len - some real cards returns shorter value equal to SHA-1 output size although PLAIN results is filled into buffer (GD60) - return this.theCurve.COORD_SIZE; - } - - /** - * Computes negation of this point. - */ - public void negate() { - PM.check(PM.TRAP_ECPOINT_NEGATE_1); - - // Operation will dump point into uncompressed_point_arr, negate Y and restore back - ech.fnc_negate_yBN.lock(); - ech.lock(ech.uncompressed_point_arr1); - thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - PM.check(PM.TRAP_ECPOINT_NEGATE_2); - ech.fnc_negate_yBN.set_size(this.theCurve.COORD_SIZE); - ech.fnc_negate_yBN.from_byte_array(this.theCurve.COORD_SIZE, (short) 0, ech.uncompressed_point_arr1, (short) (1 + this.theCurve.COORD_SIZE)); - PM.check(PM.TRAP_ECPOINT_NEGATE_3); - ech.fnc_negate_yBN.mod_negate(this.theCurve.pBN); - PM.check(PM.TRAP_ECPOINT_NEGATE_4); - - // Restore whole point back - ech.fnc_negate_yBN.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) (1 + this.theCurve.COORD_SIZE)); - ech.fnc_negate_yBN.unlock(); - this.setW(ech.uncompressed_point_arr1, (short) 0, this.theCurve.POINT_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - PM.check(PM.TRAP_ECPOINT_NEGATE_5); - } - - /** - * Restore point from X coordinate. Stores one of the two results into this point. - * - * @param xCoord byte array containing the X coordinate - * @param xOffset offset in the byte array - * @param xLen length of the X coordinate - */ - public void from_x(byte[] xCoord, short xOffset, short xLen) { - ech.fnc_from_x_x.lock(); - ech.fnc_from_x_x.set_size(xLen); - ech.fnc_from_x_x.from_byte_array(xLen, (short) 0, xCoord, xOffset); - from_x(ech.fnc_from_x_x); - ech.fnc_from_x_x.unlock(); - } - - /** - * Restore point from X coordinate. Stores one of the two results into this point. - * - * @param x the x coordinate - */ - private void from_x(Bignat x) { - //Y^2 = X^3 + XA + B = x(x^2+A)+B - ech.fnc_from_x_y_sq.lock(); - ech.fnc_from_x_y_sq.clone(x); - ech.fnc_from_x_y_sq.mod_exp(Bignat_Helper.TWO, this.theCurve.pBN); - ech.fnc_from_x_y_sq.mod_add(this.theCurve.aBN, this.theCurve.pBN); - ech.fnc_from_x_y_sq.mod_mult(ech.fnc_from_x_y_sq, x, this.theCurve.pBN); - ech.fnc_from_x_y_sq.mod_add(this.theCurve.bBN, this.theCurve.pBN); - ech.fnc_from_x_y.lock(); - ech.fnc_from_x_y.clone(ech.fnc_from_x_y_sq); - ech.fnc_from_x_y_sq.unlock(); - ech.fnc_from_x_y.sqrt_FP(this.theCurve.pBN); - - // Construct public key with - ech.lock(ech.uncompressed_point_arr1); - ech.uncompressed_point_arr1[0] = 0x04; - x.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) 1); - ech.fnc_from_x_y.prepend_zeros(this.theCurve.COORD_SIZE, ech.uncompressed_point_arr1, (short) (1 + theCurve.COORD_SIZE)); - ech.fnc_from_x_y.unlock(); - this.setW(ech.uncompressed_point_arr1, (short) 0, theCurve.POINT_SIZE); - ech.unlock(ech.uncompressed_point_arr1); - } - - /** - * Returns true if Y coordinate is even; false otherwise. - * - * @return true if Y coordinate is even; false otherwise - */ - public boolean is_y_even() { - ech.fnc_is_y.lock(); - ech.lock(ech.uncompressed_point_arr1); - thePoint.getW(ech.uncompressed_point_arr1, (short) 0); - boolean result = ech.uncompressed_point_arr1[(short)(theCurve.POINT_SIZE - 1)] % 2 == 0; - ech.unlock(ech.uncompressed_point_arr1); - ech.fnc_is_y.unlock(); - return result; - } - - /** - * Compares this and provided point for equality. The comparison is made using hash of both values to prevent leak of position of mismatching byte. - * @param other second point for comparison - * @return true if both point are exactly equal (same length, same value), false otherwise - */ - public boolean isEqual(ECPoint other) { - boolean bResult = false; - if (this.length() != other.length()) { - return false; - } - else { - // The comparison is made with hash of point values instead of directly values. - // This way, offset of first mismatching byte is not leaked via timing side-channel. - // Additionally, only single array is required for storage of plain point values thus saving some RAM. - ech.lock(ech.uncompressed_point_arr1); - ech.lock(ech.fnc_isEqual_hashArray); - //ech.lock(ech.fnc_isEqual_hashEngine); - short len = this.getW(ech.uncompressed_point_arr1, (short) 0); - ech.fnc_isEqual_hashEngine.doFinal(ech.uncompressed_point_arr1, (short) 0, len, ech.fnc_isEqual_hashArray, (short) 0); - len = other.getW(ech.uncompressed_point_arr1, (short) 0); - len = ech.fnc_isEqual_hashEngine.doFinal(ech.uncompressed_point_arr1, (short) 0, len, ech.uncompressed_point_arr1, (short) 0); - bResult = Util.arrayCompare(ech.fnc_isEqual_hashArray, (short) 0, ech.uncompressed_point_arr1, (short) 0, len) == 0; - //ech.unlock(ech.fnc_isEqual_hashEngine); - ech.unlock(ech.fnc_isEqual_hashArray); - ech.unlock(ech.uncompressed_point_arr1); - } - - return bResult; - } - - static byte[] msg = {(byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03}; - public static boolean SignVerifyECDSA(ECPrivateKey privateKey, ECPublicKey publicKey, Signature signEngine, byte[] tmpSignArray) { - signEngine.init(privateKey, Signature.MODE_SIGN); - short signLen = signEngine.sign(msg, (short) 0, (short) msg.length, tmpSignArray, (short) 0); - signEngine.init(publicKey, Signature.MODE_VERIFY); - return signEngine.verify(msg, (short) 0, (short) msg.length, tmpSignArray, (short) 0, signLen); - } - - - // - // ECKey methods - // - public void setFieldFP(byte[] bytes, short s, short s1) throws CryptoException { - thePoint.setFieldFP(bytes, s, s1); - } - - public void setFieldF2M(short s) throws CryptoException { - thePoint.setFieldF2M(s); - } - - public void setFieldF2M(short s, short s1, short s2) throws CryptoException { - thePoint.setFieldF2M(s, s1, s2); - } - - public void setA(byte[] bytes, short s, short s1) throws CryptoException { - thePoint.setA(bytes, s, s1); - } - - public void setB(byte[] bytes, short s, short s1) throws CryptoException { - thePoint.setB(bytes, s, s1); - } - - public void setG(byte[] bytes, short s, short s1) throws CryptoException { - thePoint.setG(bytes, s, s1); - } - - public void setR(byte[] bytes, short s, short s1) throws CryptoException { - thePoint.setR(bytes, s, s1); - } - - public void setK(short s) { - thePoint.setK(s); - } - - public short getField(byte[] bytes, short s) throws CryptoException { - return thePoint.getField(bytes, s); - } - - public short getA(byte[] bytes, short s) throws CryptoException { - return thePoint.getA(bytes, s); - } - - public short getB(byte[] bytes, short s) throws CryptoException { - return thePoint.getB(bytes, s); - } - - public short getG(byte[] bytes, short s) throws CryptoException { - return thePoint.getG(bytes, s); - } - - public short getR(byte[] bytes, short s) throws CryptoException { - return thePoint.getR(bytes, s); - } - - public short getK() throws CryptoException { - return thePoint.getK(); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ECPoint_Helper.java b/JCMathLib/src/opencrypto/jcmathlib/ECPoint_Helper.java deleted file mode 100644 index 452f1824..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ECPoint_Helper.java +++ /dev/null @@ -1,104 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.security.KeyAgreement; -import javacard.security.MessageDigest; -import javacard.security.Signature; - -/** - * - * @author Petr Svenda - */ -public class ECPoint_Helper extends Base_Helper { - // Selected constants missing from older JC API specs - public static final byte KeyAgreement_ALG_EC_SVDP_DH_PLAIN = (byte) 3; - public static final byte KeyAgreement_ALG_EC_SVDP_DH_PLAIN_XY = (byte) 6; - public static final byte Signature_ALG_ECDSA_SHA_256 = (byte) 33; - - /** - * If true, fast multiplication of ECPoints via KeyAgreement can be used. Is - * set automatically after successful allocation of required engines - */ - public boolean FLAG_FAST_EC_MULT_VIA_KA = false; - - byte[] uncompressed_point_arr1; - byte[] fnc_isEqual_hashArray; - byte[] fnc_multiplication_resultArray; - - // These Bignats are just pointing to some helperEC_BN_? so reasonable naming is preserved yet no need to actually allocated whole Bignat object - Bignat fnc_add_x_r; // frequent write - Bignat fnc_add_y_r; // frequent write - Bignat fnc_add_x_p; // one init, then just read - Bignat fnc_add_y_p; // one init, then just read - Bignat fnc_add_x_q; // one init, then just read - Bignat fnc_add_lambda; // write mod_mul (but only final result) - Bignat fnc_add_nominator; // frequent write - Bignat fnc_add_denominator; // frequent write - - Bignat fnc_multiplication_x; // result write - Bignat fnc_multiplication_y_sq; // frequent write - Bignat fnc_multiplication_scalar; // write once, read - Bignat fnc_multiplication_y1; // mostly just read, write inside sqrt_FP - Bignat fnc_multiplication_y2; // mostly just read, result write - Bignat fnc_negate_yBN; // mostly just read, result write - - Bignat fnc_from_x_x; - Bignat fnc_from_x_y_sq; - Bignat fnc_from_x_y; - - Bignat fnc_is_y; - - KeyAgreement fnc_multiplication_x_keyAgreement; - Signature fnc_SignVerifyECDSA_signEngine; - MessageDigest fnc_isEqual_hashEngine; - - public ECPoint_Helper(ResourceManager rm) { - super(rm); - - FLAG_FAST_EC_MULT_VIA_KA = false; // set true only if succesfully allocated and tested below - try { - //fnc_multiplication_x_keyAgreement = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DHC, false); - //fnc_SignVerifyECDSA_signEngine = Signature.getInstance(Signature.ALG_ECDSA_SHA, false); - //fnc_multiplication_x_keyAgreement = KeyAgreement.getInstance(Consts.KeyAgreement_ALG_EC_SVDP_DH_PLAIN_XY, false); - fnc_multiplication_x_keyAgreement = KeyAgreement.getInstance(KeyAgreement_ALG_EC_SVDP_DH_PLAIN, false); - fnc_SignVerifyECDSA_signEngine = Signature.getInstance(Signature_ALG_ECDSA_SHA_256, false); - FLAG_FAST_EC_MULT_VIA_KA = true; - } catch (Exception ignored) { - } // Discard any exception - } - - void initialize() { - // Important: assignment of helper BNs is made according to two criteria: - // 1. Correctness: same BN must not be assigned to overlapping operations (guarded by lock/unlock) - // 2. Memory tradeoff: we like to put as few BNs into RAM as possible. So most frequently used BNs for write should be in RAM - // and at the same time we like to have as few BNs in RAM as possible. - // So think twice before changing the assignments! - fnc_add_x_r = rm.helperEC_BN_B; - fnc_add_y_r = rm.helperEC_BN_C; - fnc_add_x_p = rm.helperEC_BN_D; - fnc_add_y_p = rm.helperEC_BN_E; - fnc_add_x_q = rm.helperEC_BN_F; - fnc_add_nominator = rm.helperEC_BN_B; - fnc_add_denominator = rm.helperEC_BN_C; - fnc_add_lambda = rm.helperEC_BN_A; - - fnc_multiplication_scalar = rm.helperEC_BN_F; - fnc_multiplication_x = rm.helperEC_BN_B; - fnc_multiplication_y_sq = rm.helperEC_BN_C; - fnc_multiplication_y1 = rm.helperEC_BN_D; - fnc_multiplication_y2 = rm.helperEC_BN_B; - fnc_multiplication_resultArray = rm.helper_BN_array1; - - fnc_negate_yBN = rm.helperEC_BN_C; - - Bignat fnc_from_x_x; - Bignat fnc_from_x_y_sq; - Bignat fnc_from_x_y; - - fnc_is_y = rm.helperEC_BN_C; - - fnc_isEqual_hashArray = rm.helper_hashArray; - fnc_isEqual_hashEngine = rm.hashEngine; - - uncompressed_point_arr1 = rm.helper_uncompressed_point_arr1; - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/OCUnitTests.java b/JCMathLib/src/opencrypto/jcmathlib/OCUnitTests.java deleted file mode 100644 index c47d151f..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/OCUnitTests.java +++ /dev/null @@ -1,864 +0,0 @@ -package opencrypto.jcmathlib; - - -import javacard.framework.APDU; -import javacard.framework.Applet; -import javacard.framework.CardRuntimeException; -import javacard.framework.ISO7816; -import javacard.framework.ISOException; -import javacard.framework.JCSystem; -import javacard.framework.PINException; -import javacard.framework.SystemException; -import javacard.framework.TransactionException; -import javacard.framework.Util; -import javacard.security.CryptoException; - -/** - * -* @author Vasilios Mavroudis and Petr Svenda - */ -public class OCUnitTests extends Applet { - // Main instruction CLAss - public final static byte CLA_OC_UT = (byte) 0xB0; // OpenCrypto Unit Tests - - // INStructions - // Card Management - public final static byte INS_SETUP = (byte) 0x01; - public final static byte INS_STATUS = (byte) 0x02; - public final static byte INS_CLEANUP = (byte) 0x03; - //public final static byte INS_TESTRSAMULT = (byte) 0x04; - public final static byte INS_FREEMEMORY = (byte) 0x06; - public final static byte INS_GET_ALLOCATOR_STATS = (byte) 0x07; - public final static byte INS_GET_PROFILE_LOCKS = (byte) 0x08; - - //BigNatural and BigInteger Operations - public final static byte INS_INT_STR = (byte) 0x09; - public final static byte INS_INT_ADD = (byte) 0x10; - public final static byte INS_INT_SUB = (byte) 0x11; - public final static byte INS_INT_MUL = (byte) 0x12; - public final static byte INS_INT_DIV = (byte) 0x13; - //public final static byte INS_INT_EXP = (byte) 0x14; - public final static byte INS_INT_MOD = (byte) 0x15; - - public final static byte INS_BN_STR = (byte) 0x20; - public final static byte INS_BN_ADD = (byte) 0x21; - public final static byte INS_BN_SUB = (byte) 0x22; - public final static byte INS_BN_MUL = (byte) 0x23; - public final static byte INS_BN_EXP = (byte) 0x24; - public final static byte INS_BN_MOD = (byte) 0x25; - public final static byte INS_BN_SQRT = (byte) 0x26; - public final static byte INS_BN_MUL_SCHOOL = (byte) 0x27; - - public final static byte INS_BN_ADD_MOD = (byte) 0x30; - public final static byte INS_BN_SUB_MOD = (byte) 0x31; - public final static byte INS_BN_MUL_MOD = (byte) 0x32; - public final static byte INS_BN_EXP_MOD = (byte) 0x33; - public final static byte INS_BN_INV_MOD = (byte) 0x34; - public final static byte INS_BN_POW2_MOD = (byte) 0x35; - - //EC Operations - public final static byte INS_EC_GEN = (byte) 0x40; - public final static byte INS_EC_DBL = (byte) 0x41; - public final static byte INS_EC_ADD = (byte) 0x42; - public final static byte INS_EC_MUL = (byte) 0x43; - public final static byte INS_EC_NEG = (byte) 0x44; - public final static byte INS_EC_SETCURVE_G = (byte) 0x45; - public final static byte INS_EC_COMPARE = (byte) 0x46; - - public final static byte INS_PERF_SETSTOP = (byte) 0xf5; - - - static boolean bIsSimulator = false; - static boolean bTEST_256b_CURVE = true; - static boolean bTEST_512b_CURVE = false; - - short[] m_memoryInfo = null; - short m_memoryInfoOffset = 0; - - ECConfig m_ecc = null; - - ECCurve m_testCurve = null; - - ECPoint m_testPoint1 = null; - ECPoint m_testPoint2 = null; - - byte[] m_customG = null; - ECCurve m_testCurveCustom = null; - ECPoint m_testPointCustom = null; - - Bignat m_testBN1; - Bignat m_testBN2; - Bignat m_testBN3; - - Integer m_testINT1; - Integer m_testINT2; - - public OCUnitTests() { - m_memoryInfo = new short[(short) (7 * 3)]; // Contains RAM and EEPROM memory required for basic library objects - m_memoryInfoOffset = snapshotAvailableMemory((short) 1, m_memoryInfo, m_memoryInfoOffset); - if (bTEST_256b_CURVE) { - m_ecc = new ECConfig((short) 256); - } - if (bTEST_512b_CURVE) { - m_ecc = new ECConfig((short) 512); - } - m_memoryInfoOffset = snapshotAvailableMemory((short) 2, m_memoryInfo, m_memoryInfoOffset); - - - // Pre-allocate test objects (no new allocation for every tested operation) - if (bTEST_256b_CURVE) { - m_testCurve = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r); - m_memoryInfoOffset = snapshotAvailableMemory((short) 3, m_memoryInfo, m_memoryInfoOffset); - // m_testCurveCustom and m_testPointCustom will have G occasionally changed so we need separate ECCurve - m_customG = new byte[(short) SecP256r1.G.length]; - Util.arrayCopyNonAtomic(SecP256r1.G, (short) 0, m_customG, (short) 0, (short) SecP256r1.G.length); - m_testCurveCustom = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, m_customG, SecP256r1.r); - } - if (bTEST_512b_CURVE) { - m_testCurve = new ECCurve(false, P512r1.p, P512r1.a, P512r1.b, P512r1.G, P512r1.r); - // m_testCurveCustom and m_testPointCustom will have G occasionally changed so we need separate ECCurve - m_customG = new byte[(short) P512r1.G.length]; - Util.arrayCopyNonAtomic(P512r1.G, (short) 0, m_customG, (short) 0, (short) P512r1.G.length); - m_testCurveCustom = new ECCurve(false, P512r1.p, P512r1.a, P512r1.b, m_customG, P512r1.r); - } - - m_memoryInfoOffset = snapshotAvailableMemory((short) 5, m_memoryInfo, m_memoryInfoOffset); - m_testPoint1 = new ECPoint(m_testCurve, m_ecc.ech); - m_memoryInfoOffset = snapshotAvailableMemory((short) 6, m_memoryInfo, m_memoryInfoOffset); - m_testPoint2 = new ECPoint(m_testCurve, m_ecc.ech); - m_testPointCustom = new ECPoint(m_testCurveCustom, m_ecc.ech); - - // Testing Bignat objects used in tests - m_memoryInfoOffset = snapshotAvailableMemory((short) 7, m_memoryInfo, m_memoryInfoOffset); - byte memoryType = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - m_testBN1 = new Bignat(m_ecc.MAX_BIGNAT_SIZE, memoryType, m_ecc.bnh); - m_memoryInfoOffset = snapshotAvailableMemory((short) 8, m_memoryInfo, m_memoryInfoOffset); - m_testBN2 = new Bignat(m_ecc.MAX_BIGNAT_SIZE, memoryType, m_ecc.bnh); - m_testBN3 = new Bignat(m_ecc.MAX_BIGNAT_SIZE, memoryType, m_ecc.bnh); - - short intLen = 4; - m_testINT1 = new Integer(intLen, m_ecc.bnh); - m_testINT2 = new Integer(intLen, m_ecc.bnh); - } - - public static void install(byte[] bArray, short bOffset, byte bLength) { - // GP-compliant JavaCard applet registration - //new UnitTests().register(bArray, (short) (bOffset + 1), bArray[bOffset]); - if (bLength == 0) { - bIsSimulator = true; - } - new OCUnitTests().register(); - } - - public boolean select() { - updateAfterReset(); - return true; - } - public void process(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - - // Good practice: Return 9000 on SELECT - if (selectingApplet()) { - return; - } - - // Check CLA byte - if (apdubuf[ISO7816.OFFSET_CLA] != CLA_OC_UT) { - ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); - } - - // Process Input - short dataLen = apdu.setIncomingAndReceive(); // returns length of data field - - try { - switch (apdubuf[ISO7816.OFFSET_INS]) { - case INS_CLEANUP: - m_ecc.unlockAll(); - break; - case INS_FREEMEMORY: - if (!bIsSimulator) { - JCSystem.requestObjectDeletion(); - } - break; - case INS_PERF_SETSTOP: - PM.m_perfStop = Util.makeShort(apdubuf[ISO7816.OFFSET_CDATA], apdubuf[(short) (ISO7816.OFFSET_CDATA + 1)]); - break; - case INS_GET_ALLOCATOR_STATS: - short offset = 0; - Util.setShort(apdubuf, offset, m_ecc.rm.memAlloc.getAllocatedInRAM()); - offset += 2; - Util.setShort(apdubuf, offset, m_ecc.rm.memAlloc.getAllocatedInEEPROM()); - offset += 2; - for (short i = 0; i < (short) m_memoryInfo.length; i++) { - Util.setShort(apdubuf, offset, m_memoryInfo[i]); - offset += 2; - } - apdu.setOutgoingAndSend((short) 0, offset); - break; - case INS_GET_PROFILE_LOCKS: - Util.arrayCopyNonAtomic(m_ecc.rm.locker.profileLockedObjects, (short) 0, apdubuf, (short) 0, (short) m_ecc.rm.locker.profileLockedObjects.length); - apdu.setOutgoingAndSend((short) 0, (short) m_ecc.rm.locker.profileLockedObjects.length); - break; - - //============================================================== - case INS_EC_GEN: - test_EC_GEN(apdu); - break; - case INS_EC_SETCURVE_G: - test_EC_SETCURVE_G(apdu, dataLen); - break; - case INS_EC_DBL: - test_EC_DBL(apdu); - break; - - case INS_EC_ADD: - test_EC_ADD(apdu); - break; - - case INS_EC_MUL: - test_EC_MUL(apdu); - break; - - case INS_EC_NEG: - test_EC_NEG(apdu); - break; - - case INS_EC_COMPARE: - test_EC_COMPARE(apdu); - break; - - //============================================================== - case INS_BN_STR: - test_BN_STR(apdu, dataLen); - break; - - case INS_BN_ADD: - test_BN_ADD(apdu, dataLen); - break; - - case INS_BN_SUB: - test_BN_SUB(apdu, dataLen); - break; - - case INS_BN_MUL: - test_BN_MUL(apdu, dataLen, true); - break; - case INS_BN_MUL_SCHOOL: - test_BN_MUL(apdu, dataLen, false); - break; - - case INS_BN_EXP: - test_BN_EXP(apdu, dataLen); - break; - case INS_BN_SQRT: - test_BN_SQRT(apdu, dataLen); - break; - - case INS_BN_MOD: - test_BN_MOD(apdu, dataLen); - break; - - case INS_BN_ADD_MOD: - test_BN_ADD_MOD(apdu, dataLen); - break; - - case INS_BN_SUB_MOD: - test_BN_SUB_MOD(apdu, dataLen); - break; - - case INS_BN_MUL_MOD: - test_BN_MUL_MOD(apdu, dataLen); - break; - - case INS_BN_EXP_MOD: - test_BN_EXP_MOD(apdu, dataLen); - break; - - case INS_BN_POW2_MOD: - test_BN_POW2_MOD(apdu, dataLen); - break; - - case INS_BN_INV_MOD: - test_BN_INV_MOD(apdu, dataLen); - break; - - // --------------------------------------- - case INS_INT_STR: - test_INT_STR(apdu, dataLen); - break; - - case INS_INT_ADD: - test_INT_ADD(apdu, dataLen); - break; - - case INS_INT_SUB: - test_INT_SUB(apdu, dataLen); - break; - - case INS_INT_MUL: - test_INT_MUL(apdu, dataLen); - break; - - case INS_INT_DIV: - test_INT_DIV(apdu, dataLen); - break; - - //case (byte) Configuration.INS_INT_EXP: - // test_INT_EXP(apdu, dataLen); - // break; - case INS_INT_MOD: - test_INT_MOD(apdu, dataLen); - break; - - default: - // good practice: If you don't know the INStruction, say so: - ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); - } - // Capture all reasonable exceptions and change into readable ones (instead of 0x6f00) - } catch (ISOException e) { - throw e; // Our exception from code, just re-emit - } catch (ArrayIndexOutOfBoundsException e) { - ISOException.throwIt(ReturnCodes.SW_ArrayIndexOutOfBoundsException); - } catch (ArithmeticException e) { - ISOException.throwIt(ReturnCodes.SW_ArithmeticException); - } catch (ArrayStoreException e) { - ISOException.throwIt(ReturnCodes.SW_ArrayStoreException); - } catch (NullPointerException e) { - ISOException.throwIt(ReturnCodes.SW_NullPointerException); - } catch (NegativeArraySizeException e) { - ISOException.throwIt(ReturnCodes.SW_NegativeArraySizeException); - } catch (CryptoException e) { - ISOException.throwIt((short) (ReturnCodes.SW_CryptoException_prefix | e.getReason())); - } catch (SystemException e) { - ISOException.throwIt((short) (ReturnCodes.SW_SystemException_prefix | e.getReason())); - } catch (PINException e) { - ISOException.throwIt((short) (ReturnCodes.SW_PINException_prefix | e.getReason())); - } catch (TransactionException e) { - ISOException.throwIt((short) (ReturnCodes.SW_TransactionException_prefix | e.getReason())); - } catch (CardRuntimeException e) { - ISOException.throwIt((short) (ReturnCodes.SW_CardRuntimeException_prefix | e.getReason())); - } catch (Exception e) { - ISOException.throwIt(ReturnCodes.SW_Exception); - } - - } - - - final short snapshotAvailableMemory(short tag, short[] buffer, short bufferOffset) { - buffer[bufferOffset] = tag; - buffer[(short) (bufferOffset + 1)] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_RESET); - buffer[(short) (bufferOffset + 2)] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); - return (short) (bufferOffset + 3); - } - - - void test_EC_GEN(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - - PM.check(PM.TRAP_EC_GEN_1); - m_testPoint1.randomize(); - PM.check(PM.TRAP_EC_GEN_2); - - short len = m_testPoint1.getW(apdubuf, (short) 0); - PM.check(PM.TRAP_EC_GEN_3); - apdu.setOutgoingAndSend((short) 0, len); - } - - void updateAfterReset() { - if (m_testCurve != null) { m_testCurve.updateAfterReset(); } - if (m_testCurveCustom != null) {m_testCurveCustom.updateAfterReset(); } - if (m_ecc != null) { - m_ecc.refreshAfterReset(); - m_ecc.unlockAll(); - } - if (m_ecc.bnh != null) {m_ecc.bnh.bIsSimulator = bIsSimulator; } - } - void test_EC_SETCURVE_G(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - - Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_customG, (short) 0, dataLen); - PM.check(PM.TRAP_EC_SETCURVE_1); - - if (apdubuf[ISO7816.OFFSET_P2] == 1) { // If required, complete new custom curve and point is allocated - m_testCurveCustom = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, m_customG, SecP256r1.r); - m_testPointCustom = new ECPoint(m_testCurveCustom, m_ecc.ech); - PM.check(PM.TRAP_EC_SETCURVE_2); - // Release unused previous objects - if (!bIsSimulator) { - JCSystem.requestObjectDeletion(); - } - } - else { - // Otherwise, only G is set and relevant objects are updated - m_testCurveCustom.setG(apdubuf, (short) ISO7816.OFFSET_CDATA, m_testCurveCustom.POINT_SIZE); - m_testPointCustom.updatePointObjects(); // After changing curve parameters, internal objects needs to be actualized - } - } - - void test_EC_DBL(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - - PM.check(PM.TRAP_EC_DBL_1); - m_testPointCustom.setW(apdubuf, (short) ISO7816.OFFSET_CDATA, m_testCurveCustom.POINT_SIZE); - // NOTE: for doubling, curve G must be also set. Here we expect that test_EC_SETCURVE_G() was called before - PM.check(PM.TRAP_EC_DBL_2); - m_testPointCustom.makeDouble(); //G + G - PM.check(PM.TRAP_EC_DBL_3); - - short len = m_testPointCustom.getW(apdubuf, (short) 0); - PM.check(PM.TRAP_EC_DBL_4); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_EC_ADD(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - - PM.check(PM.TRAP_EC_ADD_1); - m_testPoint1.setW(apdubuf, (short) ISO7816.OFFSET_CDATA, m_testCurve.POINT_SIZE); - PM.check(PM.TRAP_EC_ADD_2); - m_testPoint2.setW(apdubuf, (short) (ISO7816.OFFSET_CDATA + m_testCurve.POINT_SIZE), m_testCurve.POINT_SIZE); - PM.check(PM.TRAP_EC_ADD_3); - m_testPoint1.add(m_testPoint2); - PM.check(PM.TRAP_EC_ADD_4); - - short len = m_testPoint1.getW(apdubuf, (short) 0); - PM.check(PM.TRAP_EC_ADD_5); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_EC_MUL(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - short p1_len = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_EC_MUL_1); - Bignat scalar = m_testBN1; - scalar.set_size(p1_len); - scalar.from_byte_array(p1_len, (short) 0, apdubuf, ISO7816.OFFSET_CDATA); - PM.check(PM.TRAP_EC_MUL_2); - m_testPoint1.setW(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1_len), m_testCurve.POINT_SIZE); - PM.check(PM.TRAP_EC_MUL_3); - m_testPoint1.multiplication(scalar); - PM.check(PM.TRAP_EC_MUL_4); - - short len = m_testPoint1.getW(apdubuf, (short) 0); - PM.check(PM.TRAP_EC_MUL_5); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_EC_NEG(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - short p1_len = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - m_testPoint1.setW(apdubuf, ISO7816.OFFSET_CDATA, p1_len); - m_testPoint1.negate(); - short len = m_testPoint1.getW(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - - void test_EC_COMPARE(APDU apdu) { - byte[] apdubuf = apdu.getBuffer(); - short p1_len = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2_len = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - m_testPoint1.setW(apdubuf, (short) ISO7816.OFFSET_CDATA, p1_len); - m_testPoint2.setW(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1_len), p2_len); - apdubuf[0] = 0; apdubuf[1] = 0; apdubuf[2] = 0; apdubuf[3] = 0; // Tests expects big integer - apdubuf[4] = m_testPoint1.isEqual(m_testPoint2) ? (byte) 1 : (byte) 0; - apdu.setOutgoingAndSend((short) 0, (short) 5); - } - - - void test_BN_STR(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - - PM.check(PM.TRAP_BN_STR_1); - Bignat num = m_testBN1; - num.set_size(dataLen); - PM.check(PM.TRAP_BN_STR_2); - num.from_byte_array(dataLen, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - PM.check(PM.TRAP_BN_STR_3); - short len = num.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_ADD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_BN_ADD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_ADD_2); - Bignat num2 = m_testBN2; - num2.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_ADD_3); - Bignat sum = m_testBN3; - sum.set_size((short) (p1 + 1)); - - PM.check(PM.TRAP_BN_ADD_4); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - num2.from_byte_array((short) (dataLen - p1), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_ADD_5); - sum.copy(num1); - PM.check(PM.TRAP_BN_ADD_6); - sum.add(num2); - PM.check(PM.TRAP_BN_ADD_7); - short len = sum.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_SUB(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_BN_SUB_1); - Bignat sub1 = m_testBN1; - sub1.set_size(p1); - PM.check(PM.TRAP_BN_SUB_2); - Bignat sub2 = m_testBN2; - sub2.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_SUB_3); - Bignat result = m_testBN3; - result.set_size((short) (p1 + 1)); - PM.check(PM.TRAP_BN_SUB_4); - sub1.from_byte_array(dataLen, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - sub2.from_byte_array(dataLen, (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_SUB_5); - result.copy(sub1); - PM.check(PM.TRAP_BN_SUB_6); - result.subtract(sub2); - PM.check(PM.TRAP_BN_SUB_7); - short len = result.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_MUL(APDU apdu, short dataLen, boolean bFastEngine) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_BN_MUL_1); - Bignat mul1 = m_testBN1; - mul1.set_size(p1); - PM.check(PM.TRAP_BN_MUL_2); - Bignat mul2 = m_testBN2; - mul2.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_MUL_3); - Bignat product = m_testBN3; - product.set_size(dataLen); - PM.check(PM.TRAP_BN_MUL_4); - mul1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - mul2.from_byte_array((short)(dataLen-p1), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_MUL_5); - if (bFastEngine && !bIsSimulator) { - product.mult_rsa_trick(mul1, mul2, null, null); - } - else { - product.mult_schoolbook(mul1, mul2); - } - PM.check(PM.TRAP_BN_MUL_6); - short len = product.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_EXP(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_EXP_1); - Bignat base = m_testBN1; - base.set_size(p1); - PM.check(PM.TRAP_BN_EXP_2); - Bignat exp = m_testBN2; - exp.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_EXP_3); - Bignat res = m_testBN3; - res.set_size((short) (m_ecc.MAX_BIGNAT_SIZE / 2)); - PM.check(PM.TRAP_BN_EXP_4); - base.from_byte_array(p1, (short) 0, apdubuf, ISO7816.OFFSET_CDATA); - exp.from_byte_array((short) (dataLen - p1), (short) 0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_EXP_5); - res.exponentiation(base, exp); - PM.check(PM.TRAP_BN_EXP_6); - short len = res.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_SQRT(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - Bignat num = m_testBN1; - num.set_size(p1); - num.from_byte_array(p1, p1, apdubuf, ISO7816.OFFSET_CDATA); - Bignat num2 = m_testBN2; - num2.clone(m_testCurve.pBN); - num.sqrt_FP(num2); - short len = num.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - - void test_BN_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_BN_MOD_1); - Bignat num = m_testBN1; - num.set_size(p1); - PM.check(PM.TRAP_BN_MOD_2); - Bignat mod = m_testBN2; - mod.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_MOD_3); - num.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - mod.from_byte_array((short)(dataLen-p1), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_MOD_4); - num.mod(mod); - PM.check(PM.TRAP_BN_MOD_5); - short len = num.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_ADD_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_ADD_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_ADD_MOD_2); - Bignat num2 = m_testBN2; - num2.set_size(p2); - PM.check(PM.TRAP_BN_ADD_MOD_3); - Bignat mod = m_testBN3; - mod.set_size((short) (dataLen - p1 - p2)); - PM.check(PM.TRAP_BN_ADD_MOD_4); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - num2.from_byte_array(p2, (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_ADD_MOD_5); - mod.from_byte_array((short)(dataLen-p1-p2), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1+p2)); - PM.check(PM.TRAP_BN_ADD_MOD_6); - num1.mod_add(num2, mod); - PM.check(PM.TRAP_BN_ADD_MOD_7); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_SUB_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_SUB_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_SUB_MOD_2); - Bignat num2 = m_testBN2; - num2.set_size(p2); - PM.check(PM.TRAP_BN_SUB_MOD_3); - Bignat mod = m_testBN3; - mod.set_size((short) (dataLen - p1 - p2)); - PM.check(PM.TRAP_BN_SUB_MOD_4); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - num2.from_byte_array(p2, (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - mod.from_byte_array((short)(dataLen-p1-p2), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1+p2)); - PM.check(PM.TRAP_BN_SUB_MOD_5); - num1.mod_sub(num2, mod); - PM.check(PM.TRAP_BN_SUB_MOD_6); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_MUL_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_MUL_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_MUL_MOD_2); - Bignat num2 = m_testBN2; - num2.set_size(p2); - PM.check(PM.TRAP_BN_MUL_MOD_3); - Bignat mod = m_testBN3; - mod.set_size((short) (dataLen - p1 - p2)); - PM.check(PM.TRAP_BN_MUL_MOD_4); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - num2.from_byte_array(p2, (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - mod.from_byte_array((short)(dataLen-p1-p2), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1+p2)); - PM.check(PM.TRAP_BN_MUL_MOD_5); - num1.mod_mult(num1, num2, mod); - PM.check(PM.TRAP_BN_MUL_MOD_6); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_EXP_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_EXP_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_EXP_MOD_2); - Bignat num2 = m_testBN2; - num2.set_size(p2); - PM.check(PM.TRAP_BN_EXP_MOD_3); - Bignat mod = m_testBN3; - mod.set_size((short) (dataLen - p1 - p2)); - PM.check(PM.TRAP_BN_EXP_MOD_4); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - num2.from_byte_array(p2, (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - mod.from_byte_array((short)(dataLen-p1-p2), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1+p2)); - PM.check(PM.TRAP_BN_EXP_MOD_5); - num1.mod_exp(num2, mod); - PM.check(PM.TRAP_BN_EXP_MOD_6); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_POW2_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - short p2 = (short) (apdubuf[ISO7816.OFFSET_P2] & 0x00FF); - - PM.check(PM.TRAP_BN_POW2_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - Bignat mod = m_testBN3; - mod.set_size((short) (dataLen - p1)); - num1.from_byte_array(p1, (short) 0, apdubuf, ISO7816.OFFSET_CDATA); - mod.from_byte_array((short) (dataLen - p1), (short) 0, apdubuf, (short) (ISO7816.OFFSET_CDATA + p1)); - PM.check(PM.TRAP_BN_POW2_MOD_2); - //num1.pow2Mod_RSATrick(mod); - num1.mod_exp2(mod); - PM.check(PM.TRAP_BN_POW2_MOD_3); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_BN_INV_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_BN_INV_MOD_1); - Bignat num1 = m_testBN1; - num1.set_size(p1); - PM.check(PM.TRAP_BN_INV_MOD_2); - Bignat mod = m_testBN2; - mod.set_size((short) (dataLen - p1)); - PM.check(PM.TRAP_BN_INV_MOD_3); - num1.from_byte_array(p1, (short)0, apdubuf, ISO7816.OFFSET_CDATA); - mod.from_byte_array((short)(dataLen-p1), (short)0, apdubuf, (short)(ISO7816.OFFSET_CDATA+p1)); - PM.check(PM.TRAP_BN_INV_MOD_4); - num1.mod_inv(mod); - PM.check(PM.TRAP_BN_INV_MOD_5); - short len = num1.copy_to_buffer(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_STR(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_STR_1); - //Integer num_int = new Integer(dataLen, (short) 0, apdubuf, ISO7816.OFFSET_CDATA); - Integer num_int = m_testINT1; - num_int.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, dataLen); - PM.check(PM.TRAP_INT_STR_2); - short len = num_int.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_ADD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_ADD_1); - //Integer num_add_1 = new Integer(dataLen, (short) 0, apdubuf, ISO7816.OFFSET_CDATA); - Integer num_add_1 = m_testINT1; - num_add_1.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, p1); - PM.check(PM.TRAP_INT_ADD_2); - //Integer num_add_2 = new Integer((short) (dataLen - p1), (short) 0, apdubuf, (short) (ISO7816.OFFSET_CDATA + p1)); - Integer num_add_2 = m_testINT2; - num_add_2.fromByteArray(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1), p1); - PM.check(PM.TRAP_INT_ADD_3); - num_add_1.add(num_add_2); - PM.check(PM.TRAP_INT_ADD_4); - short len = num_add_1.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_SUB(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_SUB_1); - Integer num_sub_1 = m_testINT1; - num_sub_1.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, p1); - Integer num_sub_2 = m_testINT2; - num_sub_2.fromByteArray(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1), p1); - PM.check(PM.TRAP_INT_SUB_2); - - num_sub_1.subtract(num_sub_2); - PM.check(PM.TRAP_INT_SUB_3); - short len = num_sub_1.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_MUL(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_MUL_1); - Integer num_mul_1 = m_testINT1; - num_mul_1.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, p1); - Integer num_mul_2 = m_testINT2; - num_mul_2.fromByteArray(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1), p1); - PM.check(PM.TRAP_INT_MUL_2); - - num_mul_1.multiply(num_mul_2); - PM.check(PM.TRAP_INT_MUL_3); - short len = num_mul_1.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_DIV(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_DIV_1); - Integer num_div_1 = m_testINT1; - num_div_1.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, p1); - Integer num_div_2 = m_testINT2; - num_div_2.fromByteArray(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1), p1); - PM.check(PM.TRAP_INT_DIV_2); - - num_div_1.divide(num_div_2); - PM.check(PM.TRAP_INT_DIV_3); - - short len = num_div_1.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } - - void test_INT_MOD(APDU apdu, short dataLen) { - byte[] apdubuf = apdu.getBuffer(); - short p1 = (short) (apdubuf[ISO7816.OFFSET_P1] & 0x00FF); - - PM.check(PM.TRAP_INT_MOD_1); - Integer num_mod_1 = m_testINT1; - num_mod_1.fromByteArray(apdubuf, ISO7816.OFFSET_CDATA, p1); - Integer num_mod_2 = m_testINT2; - num_mod_2.fromByteArray(apdubuf, (short) (ISO7816.OFFSET_CDATA + p1), p1); - PM.check(PM.TRAP_INT_MOD_2); - - num_mod_1.modulo(num_mod_2); - PM.check(PM.TRAP_INT_MOD_3); - short len = num_mod_1.toByteArray(apdubuf, (short) 0); - apdu.setOutgoingAndSend((short) 0, len); - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/P512r1.java b/JCMathLib/src/opencrypto/jcmathlib/P512r1.java deleted file mode 100644 index d03de61a..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/P512r1.java +++ /dev/null @@ -1,19 +0,0 @@ -package opencrypto.jcmathlib; - -public class P512r1 { - - public final static short KEY_LENGTH = 512; //Bits - public final static short POINT_SIZE = 129; //Bytes - public final static short COORD_SIZE = 64; //Bytes - - public final static byte[] p = {(byte) 0xAA, (byte) 0xDD, (byte) 0x9D, (byte) 0xB8, (byte) 0xDB, (byte) 0xE9, (byte) 0xC4, (byte) 0x8B, (byte) 0x3F, (byte) 0xD4, (byte) 0xE6, (byte) 0xAE, (byte) 0x33, (byte) 0xC9, (byte) 0xFC, (byte) 0x07, (byte) 0xCB, (byte) 0x30, (byte) 0x8D, (byte) 0xB3, (byte) 0xB3, (byte) 0xC9, (byte) 0xD2, (byte) 0x0E, (byte) 0xD6, (byte) 0x63, (byte) 0x9C, (byte) 0xCA, (byte) 0x70, (byte) 0x33, (byte) 0x08, (byte) 0x71, (byte) 0x7D, (byte) 0x4D, (byte) 0x9B, (byte) 0x00, (byte) 0x9B, (byte) 0xC6, (byte) 0x68, (byte) 0x42, (byte) 0xAE, (byte) 0xCD, (byte) 0xA1, (byte) 0x2A, (byte) 0xE6, (byte) 0xA3, (byte) 0x80, (byte) 0xE6, (byte) 0x28, (byte) 0x81, (byte) 0xFF, (byte) 0x2F, (byte) 0x2D, (byte) 0x82, (byte) 0xC6, (byte) 0x85, (byte) 0x28, (byte) 0xAA, (byte) 0x60, (byte) 0x56, (byte) 0x58, (byte) 0x3A, (byte) 0x48, (byte) 0xF3}; - - public final static byte[] a = {(byte) 0x78, (byte) 0x30, (byte) 0xA3, (byte) 0x31, (byte) 0x8B, (byte) 0x60, (byte) 0x3B, (byte) 0x89, (byte) 0xE2, (byte) 0x32, (byte) 0x71, (byte) 0x45, (byte) 0xAC, (byte) 0x23, (byte) 0x4C, (byte) 0xC5, (byte) 0x94, (byte) 0xCB, (byte) 0xDD, (byte) 0x8D, (byte) 0x3D, (byte) 0xF9, (byte) 0x16, (byte) 0x10, (byte) 0xA8, (byte) 0x34, (byte) 0x41, (byte) 0xCA, (byte) 0xEA, (byte) 0x98, (byte) 0x63, (byte) 0xBC, (byte) 0x2D, (byte) 0xED, (byte) 0x5D, (byte) 0x5A, (byte) 0xA8, (byte) 0x25, (byte) 0x3A, (byte) 0xA1, (byte) 0x0A, (byte) 0x2E, (byte) 0xF1, (byte) 0xC9, (byte) 0x8B, (byte) 0x9A, (byte) 0xC8, (byte) 0xB5, (byte) 0x7F, (byte) 0x11, (byte) 0x17, (byte) 0xA7, (byte) 0x2B, (byte) 0xF2, (byte) 0xC7, (byte) 0xB9, (byte) 0xE7, (byte) 0xC1, (byte) 0xAC, (byte) 0x4D, (byte) 0x77, (byte) 0xFC, (byte) 0x94, (byte) 0xCA}; - - public final static byte[] b = {(byte) 0x3D, (byte) 0xF9, (byte) 0x16, (byte) 0x10, (byte) 0xA8, (byte) 0x34, (byte) 0x41, (byte) 0xCA, (byte) 0xEA, (byte) 0x98, (byte) 0x63, (byte) 0xBC, (byte) 0x2D, (byte) 0xED, (byte) 0x5D, (byte) 0x5A, (byte) 0xA8, (byte) 0x25, (byte) 0x3A, (byte) 0xA1, (byte) 0x0A, (byte) 0x2E, (byte) 0xF1, (byte) 0xC9, (byte) 0x8B, (byte) 0x9A, (byte) 0xC8, (byte) 0xB5, (byte) 0x7F, (byte) 0x11, (byte) 0x17, (byte) 0xA7, (byte) 0x2B, (byte) 0xF2, (byte) 0xC7, (byte) 0xB9, (byte) 0xE7, (byte) 0xC1, (byte) 0xAC, (byte) 0x4D, (byte) 0x77, (byte) 0xFC, (byte) 0x94, (byte) 0xCA, (byte) 0xDC, (byte) 0x08, (byte) 0x3E, (byte) 0x67, (byte) 0x98, (byte) 0x40, (byte) 0x50, (byte) 0xB7, (byte) 0x5E, (byte) 0xBA, (byte) 0xE5, (byte) 0xDD, (byte) 0x28, (byte) 0x09, (byte) 0xBD, (byte) 0x63, (byte) 0x80, (byte) 0x16, (byte) 0xF7, (byte) 0x23}; - - public final static byte[] G = {(byte) 0x04, (byte) 0x81, (byte) 0xAE, (byte) 0xE4, (byte) 0xBD, (byte) 0xD8, (byte) 0x2E, (byte) 0xD9, (byte) 0x64, (byte) 0x5A, (byte) 0x21, (byte) 0x32, (byte) 0x2E, (byte) 0x9C, (byte) 0x4C, (byte) 0x6A, (byte) 0x93, (byte) 0x85, (byte) 0xED, (byte) 0x9F, (byte) 0x70, (byte) 0xB5, (byte) 0xD9, (byte) 0x16, (byte) 0xC1, (byte) 0xB4, (byte) 0x3B, (byte) 0x62, (byte) 0xEE, (byte) 0xF4, (byte) 0xD0, (byte) 0x09, (byte) 0x8E, (byte) 0xFF, (byte) 0x3B, (byte) 0x1F, (byte) 0x78, (byte) 0xE2, (byte) 0xD0, (byte) 0xD4, (byte) 0x8D, (byte) 0x50, (byte) 0xD1, (byte) 0x68, (byte) 0x7B, (byte) 0x93, (byte) 0xB9, (byte) 0x7D, (byte) 0x5F, (byte) 0x7C, (byte) 0x6D, (byte) 0x50, (byte) 0x47, (byte) 0x40, (byte) 0x6A, (byte) 0x5E, (byte) 0x68, (byte) 0x8B, (byte) 0x35, (byte) 0x22, (byte) 0x09, (byte) 0xBC, (byte) 0xB9, (byte) 0xF8, (byte) 0x22, - (byte) 0x7D, (byte) 0xDE, (byte) 0x38, (byte) 0x5D, (byte) 0x56, (byte) 0x63, (byte) 0x32, (byte) 0xEC, (byte) 0xC0, (byte) 0xEA, (byte) 0xBF, (byte) 0xA9, (byte) 0xCF, (byte) 0x78, (byte) 0x22, (byte) 0xFD, (byte) 0xF2, (byte) 0x09, (byte) 0xF7, (byte) 0x00, (byte) 0x24, (byte) 0xA5, (byte) 0x7B, (byte) 0x1A, (byte) 0xA0, (byte) 0x00, (byte) 0xC5, (byte) 0x5B, (byte) 0x88, (byte) 0x1F, (byte) 0x81, (byte) 0x11, (byte) 0xB2, (byte) 0xDC, (byte) 0xDE, (byte) 0x49, (byte) 0x4A, (byte) 0x5F, (byte) 0x48, (byte) 0x5E, (byte) 0x5B, (byte) 0xCA, (byte) 0x4B, (byte) 0xD8, (byte) 0x8A, (byte) 0x27, (byte) 0x63, (byte) 0xAE, (byte) 0xD1, (byte) 0xCA, (byte) 0x2B, (byte) 0x2F, (byte) 0xA8, (byte) 0xF0, (byte) 0x54, (byte) 0x06, (byte) 0x78, (byte) 0xCD, (byte) 0x1E, (byte) 0x0F, (byte) 0x3A, (byte) 0xD8, (byte) 0x08, (byte) 0x92}; - - public final static byte[] r = {(byte) 0xAA, (byte) 0xDD, (byte) 0x9D, (byte) 0xB8, (byte) 0xDB, (byte) 0xE9, (byte) 0xC4, (byte) 0x8B, (byte) 0x3F, (byte) 0xD4, (byte) 0xE6, (byte) 0xAE, (byte) 0x33, (byte) 0xC9, (byte) 0xFC, (byte) 0x07, (byte) 0xCB, (byte) 0x30, (byte) 0x8D, (byte) 0xB3, (byte) 0xB3, (byte) 0xC9, (byte) 0xD2, (byte) 0x0E, (byte) 0xD6, (byte) 0x63, (byte) 0x9C, (byte) 0xCA, (byte) 0x70, (byte) 0x33, (byte) 0x08, (byte) 0x70, (byte) 0x55, (byte) 0x3E, (byte) 0x5C, (byte) 0x41, (byte) 0x4C, (byte) 0xA9, (byte) 0x26, (byte) 0x19, (byte) 0x41, (byte) 0x86, (byte) 0x61, (byte) 0x19, (byte) 0x7F, (byte) 0xAC, (byte) 0x10, (byte) 0x47, (byte) 0x1D, (byte) 0xB1, (byte) 0xD3, (byte) 0x81, (byte) 0x08, (byte) 0x5D, (byte) 0xDA, (byte) 0xDD, (byte) 0xB5, (byte) 0x87, (byte) 0x96, (byte) 0x82, (byte) 0x9C, (byte) 0xA9, (byte) 0x00, (byte) 0x69}; -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/PM.java b/JCMathLib/src/opencrypto/jcmathlib/PM.java deleted file mode 100644 index 510200e7..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/PM.java +++ /dev/null @@ -1,288 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.ISOException; - -/** - * Utility class for performance profiling. Contains definition of performance trap - * constants and trap reaction method. -* @author Petr Svenda - */ -public class PM { - public static short m_perfStop = -1; // Performace measurement stop indicator - - // Performance-related debugging response codes - public static final short PERF_START = (short) 0x0001; - - public static final short TRAP_UNDEFINED = (short) 0xffff; - - public static final short TRAP_EC_MUL = (short) 0x7780; - public static final short TRAP_EC_MUL_1 = (short) (TRAP_EC_MUL + 1); - public static final short TRAP_EC_MUL_2 = (short) (TRAP_EC_MUL + 2); - public static final short TRAP_EC_MUL_3 = (short) (TRAP_EC_MUL + 3); - public static final short TRAP_EC_MUL_4 = (short) (TRAP_EC_MUL + 4); - public static final short TRAP_EC_MUL_5 = (short) (TRAP_EC_MUL + 5); - public static final short TRAP_EC_MUL_6 = (short) (TRAP_EC_MUL + 6); - public static final short TRAP_EC_MUL_COMPLETE = TRAP_EC_MUL; - - public static final short TRAP_EC_GEN = (short) 0x7770; - public static final short TRAP_EC_GEN_1 = (short) (TRAP_EC_GEN + 1); - public static final short TRAP_EC_GEN_2 = (short) (TRAP_EC_GEN + 2); - public static final short TRAP_EC_GEN_3 = (short) (TRAP_EC_GEN + 3); - public static final short TRAP_EC_GEN_COMPLETE = TRAP_EC_GEN; - - public static final short TRAP_EC_DBL = (short) 0x7760; - public static final short TRAP_EC_DBL_1 = (short) (TRAP_EC_DBL + 1); - public static final short TRAP_EC_DBL_2 = (short) (TRAP_EC_DBL + 2); - public static final short TRAP_EC_DBL_3 = (short) (TRAP_EC_DBL + 3); - public static final short TRAP_EC_DBL_4 = (short) (TRAP_EC_DBL + 4); - public static final short TRAP_EC_DBL_COMPLETE = TRAP_EC_DBL; - - public static final short TRAP_EC_ADD = (short) 0x7750; - public static final short TRAP_EC_ADD_1 = (short) (TRAP_EC_ADD + 1); - public static final short TRAP_EC_ADD_2 = (short) (TRAP_EC_ADD + 2); - public static final short TRAP_EC_ADD_3 = (short) (TRAP_EC_ADD + 3); - public static final short TRAP_EC_ADD_4 = (short) (TRAP_EC_ADD + 4); - public static final short TRAP_EC_ADD_5 = (short) (TRAP_EC_ADD + 5); - public static final short TRAP_EC_ADD_COMPLETE = TRAP_EC_ADD; - - public static final short TRAP_BN_STR = (short) 0x7740; - public static final short TRAP_BN_STR_1 = (short) (TRAP_BN_STR + 1); - public static final short TRAP_BN_STR_2 = (short) (TRAP_BN_STR + 2); - public static final short TRAP_BN_STR_3 = (short) (TRAP_BN_STR + 3); - public static final short TRAP_BN_STR_COMPLETE = TRAP_BN_STR; - - public static final short TRAP_BN_ADD = (short) 0x7730; - public static final short TRAP_BN_ADD_1 = (short) (TRAP_BN_ADD + 1); - public static final short TRAP_BN_ADD_2 = (short) (TRAP_BN_ADD + 2); - public static final short TRAP_BN_ADD_3 = (short) (TRAP_BN_ADD + 3); - public static final short TRAP_BN_ADD_4 = (short) (TRAP_BN_ADD + 4); - public static final short TRAP_BN_ADD_5 = (short) (TRAP_BN_ADD + 5); - public static final short TRAP_BN_ADD_6 = (short) (TRAP_BN_ADD + 6); - public static final short TRAP_BN_ADD_7 = (short) (TRAP_BN_ADD + 7); - public static final short TRAP_BN_ADD_COMPLETE = TRAP_BN_ADD; - - public static final short TRAP_BN_SUB = (short) 0x7720; - public static final short TRAP_BN_SUB_1 = (short) (TRAP_BN_SUB + 1); - public static final short TRAP_BN_SUB_2 = (short) (TRAP_BN_SUB + 2); - public static final short TRAP_BN_SUB_3 = (short) (TRAP_BN_SUB + 3); - public static final short TRAP_BN_SUB_4 = (short) (TRAP_BN_SUB + 4); - public static final short TRAP_BN_SUB_5 = (short) (TRAP_BN_SUB + 5); - public static final short TRAP_BN_SUB_6 = (short) (TRAP_BN_SUB + 6); - public static final short TRAP_BN_SUB_7 = (short) (TRAP_BN_SUB + 7); - public static final short TRAP_BN_SUB_COMPLETE = TRAP_BN_SUB; - - public static final short TRAP_BN_MUL = (short) 0x7710; - public static final short TRAP_BN_MUL_1 = (short) (TRAP_BN_MUL + 1); - public static final short TRAP_BN_MUL_2 = (short) (TRAP_BN_MUL + 2); - public static final short TRAP_BN_MUL_3 = (short) (TRAP_BN_MUL + 3); - public static final short TRAP_BN_MUL_4 = (short) (TRAP_BN_MUL + 4); - public static final short TRAP_BN_MUL_5 = (short) (TRAP_BN_MUL + 5); - public static final short TRAP_BN_MUL_6 = (short) (TRAP_BN_MUL + 6); - public static final short TRAP_BN_MUL_COMPLETE = TRAP_BN_MUL; - - public static final short TRAP_BN_EXP = (short) 0x7700; - public static final short TRAP_BN_EXP_1 = (short) (TRAP_BN_EXP + 1); - public static final short TRAP_BN_EXP_2 = (short) (TRAP_BN_EXP + 2); - public static final short TRAP_BN_EXP_3 = (short) (TRAP_BN_EXP + 3); - public static final short TRAP_BN_EXP_4 = (short) (TRAP_BN_EXP + 4); - public static final short TRAP_BN_EXP_5 = (short) (TRAP_BN_EXP + 5); - public static final short TRAP_BN_EXP_6 = (short) (TRAP_BN_EXP + 6); - public static final short TRAP_BN_EXP_COMPLETE = TRAP_BN_EXP; - - public static final short TRAP_BN_MOD = (short) 0x76f0; - public static final short TRAP_BN_MOD_1 = (short) (TRAP_BN_MOD + 1); - public static final short TRAP_BN_MOD_2 = (short) (TRAP_BN_MOD + 2); - public static final short TRAP_BN_MOD_3 = (short) (TRAP_BN_MOD + 3); - public static final short TRAP_BN_MOD_4 = (short) (TRAP_BN_MOD + 4); - public static final short TRAP_BN_MOD_5 = (short) (TRAP_BN_MOD + 5); - public static final short TRAP_BN_MOD_COMPLETE = TRAP_BN_MOD; - - public static final short TRAP_BN_ADD_MOD = (short) 0x76e0; - public static final short TRAP_BN_ADD_MOD_1 = (short) (TRAP_BN_ADD_MOD + 1); - public static final short TRAP_BN_ADD_MOD_2 = (short) (TRAP_BN_ADD_MOD + 2); - public static final short TRAP_BN_ADD_MOD_3 = (short) (TRAP_BN_ADD_MOD + 3); - public static final short TRAP_BN_ADD_MOD_4 = (short) (TRAP_BN_ADD_MOD + 4); - public static final short TRAP_BN_ADD_MOD_5 = (short) (TRAP_BN_ADD_MOD + 5); - public static final short TRAP_BN_ADD_MOD_6 = (short) (TRAP_BN_ADD_MOD + 6); - public static final short TRAP_BN_ADD_MOD_7 = (short) (TRAP_BN_ADD_MOD + 7); - public static final short TRAP_BN_ADD_MOD_COMPLETE = TRAP_BN_ADD_MOD; - - public static final short TRAP_BN_SUB_MOD = (short) 0x76d0; - public static final short TRAP_BN_SUB_MOD_1 = (short) (TRAP_BN_SUB_MOD + 1); - public static final short TRAP_BN_SUB_MOD_2 = (short) (TRAP_BN_SUB_MOD + 2); - public static final short TRAP_BN_SUB_MOD_3 = (short) (TRAP_BN_SUB_MOD + 3); - public static final short TRAP_BN_SUB_MOD_4 = (short) (TRAP_BN_SUB_MOD + 4); - public static final short TRAP_BN_SUB_MOD_5 = (short) (TRAP_BN_SUB_MOD + 5); - public static final short TRAP_BN_SUB_MOD_6 = (short) (TRAP_BN_SUB_MOD + 6); - public static final short TRAP_BN_SUB_MOD_COMPLETE = TRAP_BN_SUB_MOD; - - public static final short TRAP_BN_MUL_MOD = (short) 0x76c0; - public static final short TRAP_BN_MUL_MOD_1 = (short) (TRAP_BN_MUL_MOD + 1); - public static final short TRAP_BN_MUL_MOD_2 = (short) (TRAP_BN_MUL_MOD + 2); - public static final short TRAP_BN_MUL_MOD_3 = (short) (TRAP_BN_MUL_MOD + 3); - public static final short TRAP_BN_MUL_MOD_4 = (short) (TRAP_BN_MUL_MOD + 4); - public static final short TRAP_BN_MUL_MOD_5 = (short) (TRAP_BN_MUL_MOD + 5); - public static final short TRAP_BN_MUL_MOD_6 = (short) (TRAP_BN_MUL_MOD + 6); - public static final short TRAP_BN_MUL_MOD_COMPLETE = TRAP_BN_MUL_MOD; - - public static final short TRAP_BN_EXP_MOD = (short) 0x76b0; - public static final short TRAP_BN_EXP_MOD_1 = (short) (TRAP_BN_EXP_MOD + 1); - public static final short TRAP_BN_EXP_MOD_2 = (short) (TRAP_BN_EXP_MOD + 2); - public static final short TRAP_BN_EXP_MOD_3 = (short) (TRAP_BN_EXP_MOD + 3); - public static final short TRAP_BN_EXP_MOD_4 = (short) (TRAP_BN_EXP_MOD + 4); - public static final short TRAP_BN_EXP_MOD_5 = (short) (TRAP_BN_EXP_MOD + 5); - public static final short TRAP_BN_EXP_MOD_6 = (short) (TRAP_BN_EXP_MOD + 6); - public static final short TRAP_BN_EXP_MOD_COMPLETE = TRAP_BN_EXP_MOD; - - public static final short TRAP_BN_INV_MOD = (short) 0x76a0; - public static final short TRAP_BN_INV_MOD_1 = (short) (TRAP_BN_INV_MOD + 1); - public static final short TRAP_BN_INV_MOD_2 = (short) (TRAP_BN_INV_MOD + 2); - public static final short TRAP_BN_INV_MOD_3 = (short) (TRAP_BN_INV_MOD + 3); - public static final short TRAP_BN_INV_MOD_4 = (short) (TRAP_BN_INV_MOD + 4); - public static final short TRAP_BN_INV_MOD_5 = (short) (TRAP_BN_INV_MOD + 5); - public static final short TRAP_BN_INV_MOD_COMPLETE = TRAP_BN_INV_MOD; - - public static final short TRAP_INT_STR = (short) 0x7690; - public static final short TRAP_INT_STR_1 = (short) (TRAP_INT_STR + 1); - public static final short TRAP_INT_STR_2 = (short) (TRAP_INT_STR + 2); - public static final short TRAP_INT_STR_COMPLETE = TRAP_INT_STR; - - public static final short TRAP_INT_ADD = (short) 0x7680; - public static final short TRAP_INT_ADD_1 = (short) (TRAP_INT_ADD + 1); - public static final short TRAP_INT_ADD_2 = (short) (TRAP_INT_ADD + 2); - public static final short TRAP_INT_ADD_3 = (short) (TRAP_INT_ADD + 3); - public static final short TRAP_INT_ADD_4 = (short) (TRAP_INT_ADD + 4); - public static final short TRAP_INT_ADD_COMPLETE = TRAP_INT_ADD; - - public static final short TRAP_INT_SUB = (short) 0x7670; - public static final short TRAP_INT_SUB_1 = (short) (TRAP_INT_SUB + 1); - public static final short TRAP_INT_SUB_2 = (short) (TRAP_INT_SUB + 2); - public static final short TRAP_INT_SUB_3 = (short) (TRAP_INT_SUB + 3); - public static final short TRAP_INT_SUB_4 = (short) (TRAP_INT_SUB + 4); - public static final short TRAP_INT_SUB_COMPLETE = TRAP_INT_SUB; - - public static final short TRAP_INT_MUL = (short) 0x7660; - public static final short TRAP_INT_MUL_1 = (short) (TRAP_INT_MUL + 1); - public static final short TRAP_INT_MUL_2 = (short) (TRAP_INT_MUL + 2); - public static final short TRAP_INT_MUL_3 = (short) (TRAP_INT_MUL + 3); - public static final short TRAP_INT_MUL_4 = (short) (TRAP_INT_MUL + 4); - public static final short TRAP_INT_MUL_COMPLETE = TRAP_INT_MUL; - - public static final short TRAP_INT_DIV = (short) 0x7650; - public static final short TRAP_INT_DIV_1 = (short) (TRAP_INT_DIV + 1); - public static final short TRAP_INT_DIV_2 = (short) (TRAP_INT_DIV + 2); - public static final short TRAP_INT_DIV_3 = (short) (TRAP_INT_DIV + 3); - public static final short TRAP_INT_DIV_4 = (short) (TRAP_INT_DIV + 4); - public static final short TRAP_INT_DIV_COMPLETE = TRAP_INT_DIV; - - public static final short TRAP_INT_EXP = (short) 0x7640; - public static final short TRAP_INT_EXP_1 = (short) (TRAP_INT_EXP + 1); - public static final short TRAP_INT_EXP_2 = (short) (TRAP_INT_EXP + 2); - public static final short TRAP_INT_EXP_3 = (short) (TRAP_INT_EXP + 3); - public static final short TRAP_INT_EXP_4 = (short) (TRAP_INT_EXP + 4); - public static final short TRAP_INT_EXP_COMPLETE = TRAP_INT_EXP; - - public static final short TRAP_INT_MOD = (short) 0x7630; - public static final short TRAP_INT_MOD_1 = (short) (TRAP_INT_MOD + 1); - public static final short TRAP_INT_MOD_2 = (short) (TRAP_INT_MOD + 2); - public static final short TRAP_INT_MOD_3 = (short) (TRAP_INT_MOD + 3); - public static final short TRAP_INT_MOD_4 = (short) (TRAP_INT_MOD + 4); - public static final short TRAP_INT_MOD_COMPLETE = TRAP_INT_MOD; - - public static final short TRAP_BN_POW2_MOD = (short) 0x7620; - public static final short TRAP_BN_POW2_MOD_1 = (short) (TRAP_BN_POW2_MOD + 1); - public static final short TRAP_BN_POW2_MOD_2 = (short) (TRAP_BN_POW2_MOD + 2); - public static final short TRAP_BN_POW2_MOD_3 = (short) (TRAP_BN_POW2_MOD + 3); - public static final short TRAP_BN_POW2_COMPLETE = TRAP_BN_POW2_MOD; - - - // 7610-7600 unused - - public static final short TRAP_ECCURVE_NEWKEYPAIR = (short) 0x75f0; - public static final short TRAP_ECCURVE_NEWKEYPAIR_1 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 1); - public static final short TRAP_ECCURVE_NEWKEYPAIR_2 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 2); - public static final short TRAP_ECCURVE_NEWKEYPAIR_3 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 3); - public static final short TRAP_ECCURVE_NEWKEYPAIR_4 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 4); - public static final short TRAP_ECCURVE_NEWKEYPAIR_5 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 5); - public static final short TRAP_ECCURVE_NEWKEYPAIR_6 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 6); - public static final short TRAP_ECCURVE_NEWKEYPAIR_7 = (short) (TRAP_ECCURVE_NEWKEYPAIR + 7); - public static final short TRAP_ECCURVE_NEWKEYPAIR_COMPLETE = TRAP_ECCURVE_NEWKEYPAIR; - - public static final short TRAP_ECPOINT_ADD = (short) 0x75e0; - public static final short TRAP_ECPOINT_ADD_1 = (short) (TRAP_ECPOINT_ADD + 1); - public static final short TRAP_ECPOINT_ADD_2 = (short) (TRAP_ECPOINT_ADD + 2); - public static final short TRAP_ECPOINT_ADD_3 = (short) (TRAP_ECPOINT_ADD + 3); - public static final short TRAP_ECPOINT_ADD_4 = (short) (TRAP_ECPOINT_ADD + 4); - public static final short TRAP_ECPOINT_ADD_5 = (short) (TRAP_ECPOINT_ADD + 5); - public static final short TRAP_ECPOINT_ADD_6 = (short) (TRAP_ECPOINT_ADD + 6); - public static final short TRAP_ECPOINT_ADD_7 = (short) (TRAP_ECPOINT_ADD + 7); - public static final short TRAP_ECPOINT_ADD_8 = (short) (TRAP_ECPOINT_ADD + 8); - public static final short TRAP_ECPOINT_ADD_9 = (short) (TRAP_ECPOINT_ADD + 9); - public static final short TRAP_ECPOINT_ADD_10 = (short) (TRAP_ECPOINT_ADD + 10); - public static final short TRAP_ECPOINT_ADD_11 = (short) (TRAP_ECPOINT_ADD + 11); - public static final short TRAP_ECPOINT_ADD_12 = (short) (TRAP_ECPOINT_ADD + 12); - public static final short TRAP_ECPOINT_ADD_13 = (short) (TRAP_ECPOINT_ADD + 13); - public static final short TRAP_ECPOINT_ADD_COMPLETE = TRAP_ECPOINT_ADD; - - public static final short TRAP_ECPOINT_MULT = (short) 0x75d0; - public static final short TRAP_ECPOINT_MULT_1 = (short) (TRAP_ECPOINT_MULT + 1); - public static final short TRAP_ECPOINT_MULT_2 = (short) (TRAP_ECPOINT_MULT + 2); - public static final short TRAP_ECPOINT_MULT_3 = (short) (TRAP_ECPOINT_MULT + 3); - public static final short TRAP_ECPOINT_MULT_4 = (short) (TRAP_ECPOINT_MULT + 4); - public static final short TRAP_ECPOINT_MULT_5 = (short) (TRAP_ECPOINT_MULT + 5); - public static final short TRAP_ECPOINT_MULT_6 = (short) (TRAP_ECPOINT_MULT + 6); - public static final short TRAP_ECPOINT_MULT_7 = (short) (TRAP_ECPOINT_MULT + 7); - public static final short TRAP_ECPOINT_MULT_8 = (short) (TRAP_ECPOINT_MULT + 8); - public static final short TRAP_ECPOINT_MULT_9 = (short) (TRAP_ECPOINT_MULT + 9); - public static final short TRAP_ECPOINT_MULT_10 = (short) (TRAP_ECPOINT_MULT + 10); - public static final short TRAP_ECPOINT_MULT_11 = (short) (TRAP_ECPOINT_MULT + 11); - public static final short TRAP_ECPOINT_MULT_12 = (short) (TRAP_ECPOINT_MULT + 12); - public static final short TRAP_ECPOINT_MULT_COMPLETE = TRAP_ECPOINT_MULT; - - public static final short TRAP_ECPOINT_MULT_X = (short) 0x75c0; - public static final short TRAP_ECPOINT_MULT_X_1 = (short) (TRAP_ECPOINT_MULT_X + 1); - public static final short TRAP_ECPOINT_MULT_X_2 = (short) (TRAP_ECPOINT_MULT_X + 2); - public static final short TRAP_ECPOINT_MULT_X_3 = (short) (TRAP_ECPOINT_MULT_X + 3); - public static final short TRAP_ECPOINT_MULT_X_4 = (short) (TRAP_ECPOINT_MULT_X + 4); - public static final short TRAP_ECPOINT_MULT_X_5 = (short) (TRAP_ECPOINT_MULT_X + 5); - public static final short TRAP_ECPOINT_MULT_X_COMPLETE = TRAP_ECPOINT_MULT_X; - - public static final short TRAP_ECPOINT_NEGATE = (short) 0x75b0; - public static final short TRAP_ECPOINT_NEGATE_1 = (short) (TRAP_ECPOINT_NEGATE + 1); - public static final short TRAP_ECPOINT_NEGATE_2 = (short) (TRAP_ECPOINT_NEGATE + 2); - public static final short TRAP_ECPOINT_NEGATE_3 = (short) (TRAP_ECPOINT_NEGATE + 3); - public static final short TRAP_ECPOINT_NEGATE_4 = (short) (TRAP_ECPOINT_NEGATE + 4); - public static final short TRAP_ECPOINT_NEGATE_5 = (short) (TRAP_ECPOINT_NEGATE + 5); - public static final short TRAP_ECPOINT_NEGATE_COMPLETE = TRAP_ECPOINT_NEGATE; - - public static final short TRAP_BIGNAT_SQRT = (short) 0x75a0; - public static final short TRAP_BIGNAT_SQRT_1 = (short) (TRAP_BIGNAT_SQRT + 1); - public static final short TRAP_BIGNAT_SQRT_2 = (short) (TRAP_BIGNAT_SQRT + 2); - public static final short TRAP_BIGNAT_SQRT_3 = (short) (TRAP_BIGNAT_SQRT + 3); - public static final short TRAP_BIGNAT_SQRT_4 = (short) (TRAP_BIGNAT_SQRT + 4); - public static final short TRAP_BIGNAT_SQRT_5 = (short) (TRAP_BIGNAT_SQRT + 5); - public static final short TRAP_BIGNAT_SQRT_6 = (short) (TRAP_BIGNAT_SQRT + 6); - public static final short TRAP_BIGNAT_SQRT_7 = (short) (TRAP_BIGNAT_SQRT + 7); - public static final short TRAP_BIGNAT_SQRT_8 = (short) (TRAP_BIGNAT_SQRT + 8); - public static final short TRAP_BIGNAT_SQRT_9 = (short) (TRAP_BIGNAT_SQRT + 9); - public static final short TRAP_BIGNAT_SQRT_10 = (short) (TRAP_BIGNAT_SQRT + 10); - public static final short TRAP_BIGNAT_SQRT_11 = (short) (TRAP_BIGNAT_SQRT + 11); - public static final short TRAP_BIGNAT_SQRT_12 = (short) (TRAP_BIGNAT_SQRT + 12); - public static final short TRAP_BIGNAT_SQRT_13 = (short) (TRAP_BIGNAT_SQRT + 13); - public static final short TRAP_BIGNAT_SQRT_14 = (short) (TRAP_BIGNAT_SQRT + 14); - public static final short TRAP_BIGNAT_SQRT_15 = (short) (TRAP_BIGNAT_SQRT + 15); - public static final short TRAP_BIGNAT_SQRT_COMPLETE = TRAP_BIGNAT_SQRT; - - - public static final short TRAP_EC_SETCURVE = (short) 0x7590; - public static final short TRAP_EC_SETCURVE_1 = (short) (TRAP_EC_SETCURVE + 1); - public static final short TRAP_EC_SETCURVE_2 = (short) (TRAP_EC_SETCURVE + 2); - public static final short TRAP_EC_SETCURVE_COMPLETE = TRAP_EC_SETCURVE; - - - public static void check(short stopCondition) { - if (PM.m_perfStop == stopCondition) { - ISOException.throwIt(stopCondition); - } - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ResourceManager.java b/JCMathLib/src/opencrypto/jcmathlib/ResourceManager.java deleted file mode 100644 index 323cc97e..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ResourceManager.java +++ /dev/null @@ -1,167 +0,0 @@ -package opencrypto.jcmathlib; - -import javacard.framework.Util; -import javacard.security.MessageDigest; - -/** - * - * @author Petr Svenda - */ -public class ResourceManager { - /** - * Object responsible for logical locking and unlocking of shared arrays and - * objects - */ - public ObjectLocker locker = null; - /** - * Object responsible for easy management of target placement (RAM/EEPROM) - * fro allocated objects - */ - public ObjectAllocator memAlloc = null; - - - - // Allocated arrays - byte[] helper_BN_array1 = null; - byte[] helper_BN_array2 = null; - byte[] helper_uncompressed_point_arr1 = null; - byte[] helper_hashArray = null; - /** - * Number of pre-allocated helper arrays - */ - public static final byte NUM_HELPER_ARRAYS = 4; - - MessageDigest hashEngine; - public static final byte NUM_SHARED_HELPER_OBJECTS = 1; - - - // These Bignats helper_BN_? are allocated - Bignat helper_BN_A; - Bignat helper_BN_B; - Bignat helper_BN_C; - Bignat helper_BN_D; - Bignat helper_BN_E; - Bignat helper_BN_F; - - // These Bignats helperEC_BN_? are allocated - Bignat helperEC_BN_A; - Bignat helperEC_BN_B; - Bignat helperEC_BN_C; - Bignat helperEC_BN_D; - Bignat helperEC_BN_E; - Bignat helperEC_BN_F; - - public void initialize(short MAX_POINT_SIZE, short MAX_COORD_SIZE, short MAX_BIGNAT_SIZE, short MULT_RSA_ENGINE_MAX_LENGTH_BITS, Bignat_Helper bnh) { - // Allocate long-term helper values - locker = new ObjectLocker((short) (NUM_HELPER_ARRAYS + NUM_SHARED_HELPER_OBJECTS)); - //locker.setLockingActive(false); // if required, locking can be disabled - memAlloc = new ObjectAllocator(); - memAlloc.setAllAllocatorsRAM(); - //if required, memory for helper objects and arrays can be in persistent memory to save RAM (or some tradeoff) - //ObjectAllocator.setAllAllocatorsEEPROM(); //ObjectAllocator.setAllocatorsTradeoff(); - - - // Multiplication speedup engines and arrays used by Bignat.mult_RSATrick() - helper_BN_array1 = memAlloc.allocateByteArray((short) (MULT_RSA_ENGINE_MAX_LENGTH_BITS / 8), memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_array1)); - locker.registerLock(helper_BN_array1); - helper_BN_array2 = memAlloc.allocateByteArray((short) (MULT_RSA_ENGINE_MAX_LENGTH_BITS / 8), memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_array2)); - locker.registerLock(helper_BN_array2); - helper_uncompressed_point_arr1 = memAlloc.allocateByteArray((short) (MAX_POINT_SIZE + 1), memAlloc.getAllocatorType(ObjectAllocator.ECPH_uncompressed_point_arr1)); - locker.registerLock(helper_uncompressed_point_arr1); - hashEngine = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false); - helper_hashArray = memAlloc.allocateByteArray(hashEngine.getLength(), memAlloc.getAllocatorType(ObjectAllocator.ECPH_hashArray)); - locker.registerLock(helper_hashArray); - //locker.registerLock(hashEngine); // register hash engine to slightly speedup search for locked objects (hash engine used less frequently) - - - helper_BN_A = new Bignat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_A), bnh); - helper_BN_B = new Bignat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_B), bnh); - helper_BN_C = new Bignat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_C), bnh); - helper_BN_D = new Bignat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_D), bnh); - helper_BN_E = new Bignat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_E), bnh); - helper_BN_F = new Bignat((short) (MAX_BIGNAT_SIZE + 2), memAlloc.getAllocatorType(ObjectAllocator.BNH_helper_BN_F), bnh); // +2 is to correct for infrequent RSA result with two or more leading zeroes - - helperEC_BN_A = new Bignat(MAX_POINT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_A), bnh); - helperEC_BN_B = new Bignat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_B), bnh); - helperEC_BN_C = new Bignat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_C), bnh); - helperEC_BN_D = new Bignat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_D), bnh); - helperEC_BN_E = new Bignat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_E), bnh); - helperEC_BN_F = new Bignat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.ECPH_helperEC_BN_F), bnh); - - - } - - /** - * Erase all values stored in helper objects - */ - void erase() { - helper_BN_A.erase(); - helper_BN_B.erase(); - helper_BN_C.erase(); - helper_BN_D.erase(); - helper_BN_E.erase(); - helper_BN_F.erase(); - - helperEC_BN_A.erase(); - helperEC_BN_B.erase(); - helperEC_BN_C.erase(); - helperEC_BN_D.erase(); - helperEC_BN_E.erase(); - helperEC_BN_F.erase(); - - - Util.arrayFillNonAtomic(helper_BN_array1, (short) 0, (short) helper_BN_array1.length, (byte) 0); - Util.arrayFillNonAtomic(helper_BN_array2, (short) 0, (short) helper_BN_array2.length, (byte) 0); - Util.arrayFillNonAtomic(helper_uncompressed_point_arr1, (short) 0, (short) helper_uncompressed_point_arr1.length, (byte) 0); - } - - /** - * Unlocks all helper objects - */ - public void unlockAll() { - if (helper_BN_A.isLocked()) { - helper_BN_A.unlock(); - } - if (helper_BN_B.isLocked()) { - helper_BN_B.unlock(); - } - if (helper_BN_C.isLocked()) { - helper_BN_C.unlock(); - } - if (helper_BN_D.isLocked()) { - helper_BN_D.unlock(); - } - if (helper_BN_E.isLocked()) { - helper_BN_E.unlock(); - } - if (helper_BN_F.isLocked()) { - helper_BN_F.unlock(); - } - - if (helperEC_BN_A.isLocked()) { - helperEC_BN_A.unlock(); - } - if (helperEC_BN_B.isLocked()) { - helperEC_BN_B.unlock(); - } - if (helperEC_BN_C.isLocked()) { - helperEC_BN_C.unlock(); - } - if (helperEC_BN_D.isLocked()) { - helperEC_BN_D.unlock(); - } - if (helperEC_BN_E.isLocked()) { - helperEC_BN_E.unlock(); - } - if (helperEC_BN_F.isLocked()) { - helperEC_BN_F.unlock(); - } - if (locker.isLocked(helper_uncompressed_point_arr1)) { - locker.unlock(helper_uncompressed_point_arr1); - } - if (locker.isLocked(helper_hashArray)) { - locker.unlock(helper_hashArray); - } - - } -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/ReturnCodes.java b/JCMathLib/src/opencrypto/jcmathlib/ReturnCodes.java deleted file mode 100644 index 6a42813a..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/ReturnCodes.java +++ /dev/null @@ -1,37 +0,0 @@ -package opencrypto.jcmathlib; - -/** - * -* @author Vasilios Mavroudis and Petr Svenda - */ -public class ReturnCodes { - // Custom error response codes - public static final short SW_BIGNAT_RESIZETOLONGER = (short) 0x7000; - public static final short SW_BIGNAT_REALLOCATIONNOTALLOWED = (short) 0x7001; - public static final short SW_BIGNAT_MODULOTOOLARGE = (short) 0x7002; - public static final short SW_BIGNAT_INVALIDCOPYOTHER = (short) 0x7003; - public static final short SW_BIGNAT_INVALIDRESIZE = (short) 0x7004; - public static final short SW_LOCK_ALREADYLOCKED = (short) 0x7005; - public static final short SW_LOCK_NOTLOCKED = (short) 0x7006; - public static final short SW_LOCK_OBJECT_NOT_FOUND = (short) 0x7007; - public static final short SW_LOCK_NOFREESLOT = (short) 0x7008; - public static final short SW_LOCK_OBJECT_MISMATCH = (short) 0x7009; - public static final short SW_ECPOINT_INVALIDLENGTH = (short) 0x700a; - public static final short SW_ECPOINT_UNEXPECTED_KA_LEN = (short) 0x700b; - public static final short SW_ALLOCATOR_INVALIDOBJID = (short) 0x700c; - - - // Specific codes to propagate exceptions cought - // lower byte of exception is value as defined in JCSDK/api_classic/constant-values.htm - public final static short SW_Exception = (short) 0xff01; - public final static short SW_ArrayIndexOutOfBoundsException = (short) 0xff02; - public final static short SW_ArithmeticException = (short) 0xff03; - public final static short SW_ArrayStoreException = (short) 0xff04; - public final static short SW_NullPointerException = (short) 0xff05; - public final static short SW_NegativeArraySizeException = (short) 0xff06; - public final static short SW_CryptoException_prefix = (short) 0xf100; - public final static short SW_SystemException_prefix = (short) 0xf200; - public final static short SW_PINException_prefix = (short) 0xf300; - public final static short SW_TransactionException_prefix = (short) 0xf400; - public final static short SW_CardRuntimeException_prefix = (short) 0xf500; -} diff --git a/JCMathLib/src/opencrypto/jcmathlib/SecP256r1.java b/JCMathLib/src/opencrypto/jcmathlib/SecP256r1.java deleted file mode 100644 index b3821872..00000000 --- a/JCMathLib/src/opencrypto/jcmathlib/SecP256r1.java +++ /dev/null @@ -1,37 +0,0 @@ -package opencrypto.jcmathlib; - -public class SecP256r1 { - - public final static short KEY_LENGTH = 256;//Bits - public final static short POINT_SIZE = 65; //Bytes - public final static short COORD_SIZE = 32; //Bytes - - public final static byte[] p = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xff, - (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, - (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }; - - - public final static byte[] a = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xff, - (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, - (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xfc}; - - public final static byte[] b = { 0x5a, (byte) 0xc6, 0x35, (byte) 0xd8, (byte) 0xaa, 0x3a, - (byte) 0x93, (byte) 0xe7, (byte) 0xb3, (byte) 0xeb, (byte) 0xbd, 0x55, 0x76, (byte) 0x98, - (byte) 0x86, (byte) 0xbc, 0x65, 0x1d, 0x06, (byte) 0xb0, (byte) 0xcc, 0x53, (byte) 0xb0, - (byte) 0xf6, 0x3b, (byte) 0xce, 0x3c, 0x3e, 0x27, (byte) 0xd2, 0x60, 0x4b }; - - public final static byte[] G = { 0x04, 0x6b, 0x17, (byte) 0xd1, (byte) 0xf2, (byte) 0xe1, 0x2c, - 0x42, 0x47, (byte) 0xf8, (byte) 0xbc, (byte) 0xe6, (byte) 0xe5, 0x63, (byte) 0xa4, 0x40, - (byte) 0xf2, 0x77, 0x03, 0x7d, (byte) 0x81, 0x2d, (byte) 0xeb, 0x33, (byte) 0xa0, (byte) 0xf4, - (byte) 0xa1, 0x39, 0x45, (byte) 0xd8, (byte) 0x98, (byte) 0xc2, (byte) 0x96, 0x4f, (byte) 0xe3, - 0x42, (byte) 0xe2, (byte) 0xfe, 0x1a, 0x7f, (byte) 0x9b, (byte) 0x8e, (byte) 0xe7, (byte) 0xeb, - 0x4a, 0x7c, 0x0f, (byte) 0x9e, 0x16, 0x2b, (byte) 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, - (byte) 0xce, (byte) 0xcb, (byte) 0xb6, 0x40, 0x68, 0x37, (byte) 0xbf, 0x51, (byte) 0xf5 }; - - public final static byte[] r = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, - 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, - (byte) 0xff, (byte) 0xbc, (byte) 0xe6, (byte) 0xfa, (byte) 0xad, (byte) 0xa7, 0x17, (byte) 0x9e, - (byte) 0x84, (byte) 0xf3, (byte) 0xb9, (byte) 0xca, (byte) 0xc2, (byte) 0xfc, 0x63, 0x25, 0x51 }; -} diff --git a/JCMathLibExamples/bin/.gitignore b/JCMathLibExamples/bin/.gitignore deleted file mode 100644 index 86d0cb27..00000000 --- a/JCMathLibExamples/bin/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/JCMathLibExamples/build.xml b/JCMathLibExamples/build.xml deleted file mode 100644 index 6c9178c8..00000000 --- a/JCMathLibExamples/build.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/JCMathLibExamples/ext/bcprov-jdk15on-157.jar b/JCMathLibExamples/ext/bcprov-jdk15on-157.jar deleted file mode 100644 index 5a10986b..00000000 Binary files a/JCMathLibExamples/ext/bcprov-jdk15on-157.jar and /dev/null differ diff --git a/JCMathLibExamples/ext/bcprov-jdk15on-161.jar b/JCMathLibExamples/ext/bcprov-jdk15on-161.jar deleted file mode 100644 index 1fdff384..00000000 Binary files a/JCMathLibExamples/ext/bcprov-jdk15on-161.jar and /dev/null differ diff --git a/JCMathLibExamples/ext/jcardsim-2.2.2.jar b/JCMathLibExamples/ext/jcardsim-2.2.2.jar deleted file mode 100644 index 0ac10c01..00000000 Binary files a/JCMathLibExamples/ext/jcardsim-2.2.2.jar and /dev/null differ diff --git a/JCMathLibExamples/ext/jcardsim-3.0.4.jar b/JCMathLibExamples/ext/jcardsim-3.0.4.jar deleted file mode 100644 index ea3ea265..00000000 Binary files a/JCMathLibExamples/ext/jcardsim-3.0.4.jar and /dev/null differ diff --git a/JCMathLibExamples/ext/jcardsim-3.0.5.jar b/JCMathLibExamples/ext/jcardsim-3.0.5.jar deleted file mode 100644 index 4a1c59c4..00000000 Binary files a/JCMathLibExamples/ext/jcardsim-3.0.5.jar and /dev/null differ diff --git a/JCMathLibExamples/src/opencrypto/examples/CardConfig.java b/JCMathLibExamples/src/opencrypto/examples/CardConfig.java deleted file mode 100644 index 25ed73eb..00000000 --- a/JCMathLibExamples/src/opencrypto/examples/CardConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package opencrypto.examples; - -import opencrypto.jcmathlib.OCUnitTests; - -/** - * - * @author Petr Svenda - */ -public class CardConfig { - int targetReaderIndex = 0; - public Class appletToSimulate = OCUnitTests.class; - - public enum CARD_TYPE { - PHYSICAL, JCOPSIM, JCARDSIMLOCAL, JCARDSIMREMOTE - } - public CARD_TYPE testCardType = CARD_TYPE.PHYSICAL; - - public static CardConfig getDefaultConfig() { - CardConfig runCfg = new CardConfig(); - runCfg.targetReaderIndex = 0; - runCfg.testCardType = CARD_TYPE.PHYSICAL; - runCfg.appletToSimulate = OCUnitTests.class; - - return runCfg; - } -} diff --git a/JCMathLibExamples/src/opencrypto/examples/CardManager.java b/JCMathLibExamples/src/opencrypto/examples/CardManager.java deleted file mode 100644 index eb1574a6..00000000 --- a/JCMathLibExamples/src/opencrypto/examples/CardManager.java +++ /dev/null @@ -1,202 +0,0 @@ -package opencrypto.examples; - -import com.licel.jcardsim.io.CAD; -import com.licel.jcardsim.io.JavaxSmartCardInterface; -//import com.licel.jcardsim.smartcardio.CardSimulator; -import java.util.ArrayList; -import java.util.List; -import javacard.framework.AID; -import javacard.framework.ISO7816; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CardTerminal; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import javax.smartcardio.TerminalFactory; -import java.util.Properties; - - -/** - * Utility class to manage smartcard connection (both simulator and real card). - * @author Petr Svenda - */ -public class CardManager { - boolean m_bDebug = false; - byte[] m_APPLET_AID = null; - Long m_lastTransmitTime = (long) 0; - CommandAPDU m_lastCommand = null; - CardChannel m_channel = null; - - public CardManager(boolean bDebug, byte[] appletAID) { - this.m_bDebug = bDebug; - this.m_APPLET_AID = appletAID; - } - - // Card Logistics - public boolean Connect(CardConfig runCfg) throws Exception { - boolean bConnected = false; - switch (runCfg.testCardType) { - case PHYSICAL: { - m_channel = ConnectPhysicalCard(runCfg.targetReaderIndex); - break; - } - case JCOPSIM: { - m_channel = ConnectJCOPSimulator(runCfg.targetReaderIndex); - break; - } - case JCARDSIMLOCAL: { - m_channel = ConnectJCardSimLocalSimulator(runCfg.appletToSimulate); - break; - } - case JCARDSIMREMOTE: { - m_channel = null; // Not implemented yet - break; - } - default: - m_channel = null; - bConnected = false; - - } - if (m_channel != null) { - bConnected = true; - } - return bConnected; - } - - public void Disconnect(boolean bReset) throws CardException { - m_channel.getCard().disconnect(bReset); // Disconnect from the card - } - - public CardChannel ConnectPhysicalCard(int targetReaderIndex) throws Exception { - // JCOP Simulators - System.out.print("Looking for physical cards... "); - return connectToCardByTerminalFactory(TerminalFactory.getDefault(), targetReaderIndex); - } - - public CardChannel ConnectJCOPSimulator(int targetReaderIndex) throws Exception { - // JCOP Simulators - System.out.print("Looking for JCOP simulators..."); - int[] ports = new int[]{8050}; - return connectToCardByTerminalFactory(TerminalFactory.getInstance("JcopEmulator", ports), targetReaderIndex); - } - - private CardChannel ConnectJCardSimLocalSimulator(Class appletClass) throws Exception { - System.out.print("Setting up Javacard simulator..."); - //CardSimulator simulator = new CardSimulator(); - System.setProperty("com.licel.jcardsim.terminal.type", "2"); - CAD cad = new CAD(System.getProperties()); - JavaxSmartCardInterface simulator = (JavaxSmartCardInterface) cad.getCardInterface(); - byte[] installData = new byte[0]; - AID appletAID = new AID(m_APPLET_AID, (short) 0, (byte) m_APPLET_AID.length); - AID appletAIDRes = simulator.installApplet(appletAID, appletClass, installData, (short) 0, (byte) installData.length); - simulator.selectApplet(appletAID); - return new SimulatedCardChannelLocal(simulator); - } - - private CardChannel connectToCardByTerminalFactory(TerminalFactory factory, int targetReaderIndex) throws CardException { - List terminals = new ArrayList<>(); - - boolean card_found = false; - CardTerminal terminal = null; - Card card = null; - try { - for (CardTerminal t : factory.terminals().list()) { - terminals.add(t); - if (t.isCardPresent()) { - card_found = true; - } - } - } catch (Exception ignored) { - } - - if (card_found) { - System.out.println("Cards found: " + terminals); - - terminal = terminals.get(targetReaderIndex); - - System.out.print("Connecting..."); - card = terminal.connect("*"); - - System.out.println(" done."); - - System.out.print("Establishing channel..."); - m_channel = card.getBasicChannel(); - - System.out.println(" done."); - - System.out.print("Selecting applet..."); - - CommandAPDU cmd = new CommandAPDU(0x00, 0xa4, 0x04, 0x00, m_APPLET_AID); - ResponseAPDU response = transmit(cmd); - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - System.out.print(" done"); - } - else { - System.out.print(" failed."); - } - - } else { - System.out.print("Failed to find required card."); - } - - if (card != null) { - return card.getBasicChannel(); - } else { - return null; - } - } - - public ResponseAPDU transmit(CommandAPDU cmd) - throws CardException { - - m_lastCommand = cmd; - if (m_bDebug == true) { - log(cmd); - } - - long elapsed = -System.currentTimeMillis(); - ResponseAPDU response = m_channel.transmit(cmd); - elapsed += System.currentTimeMillis(); - m_lastTransmitTime = elapsed; - - if (m_bDebug == true) { - log(response, m_lastTransmitTime); - } - - return response; - } - - private void log(CommandAPDU cmd) { - System.out.printf("--> %s\n", toHex(cmd.getBytes()), - cmd.getBytes().length); - } - - private void log(ResponseAPDU response, long time) { - String swStr = String.format("%02X", response.getSW()); - byte[] data = response.getData(); - if (data.length > 0) { - System.out.printf("<-- %s %s (%d) [%d ms]\n", toHex(data), swStr, - data.length, time); - } else { - System.out.printf("<-- %s [%d ms]\n", swStr, time); - } - } - - private void log(ResponseAPDU response) { - log(response, 0); - } - - public static String toHex(byte[] bytes) { - return toHex(bytes, 0, bytes.length); - } - - public static String toHex(byte[] bytes, int offset, int len) { - String result = ""; - for (int i = offset; i < offset + len; i++) { - result += String.format("%02X", bytes[i]); - } - - return result; - } -} diff --git a/JCMathLibExamples/src/opencrypto/examples/ExamplesClient.java b/JCMathLibExamples/src/opencrypto/examples/ExamplesClient.java deleted file mode 100644 index 1208f953..00000000 --- a/JCMathLibExamples/src/opencrypto/examples/ExamplesClient.java +++ /dev/null @@ -1,176 +0,0 @@ -package opencrypto.examples; - -import java.math.BigInteger; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.Security; -import javax.smartcardio.CommandAPDU; - -import org.bouncycastle.jce.ECNamedCurveTable; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.math.ec.ECPoint; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.jce.interfaces.ECPublicKey; - -import opencrypto.jcmathlib.OCUnitTests; - - -/** - * Simple example client to trigger selected Bignat and ECPoint on-card operations. For detailed testing please use JCMathLibTests client. - * Requires bouncycastle (e.g., bcprov-jdk15on-157.jar) and jcardsim (e.g., jcardsim-3.0.5.jar) dependencies - * @author Petr Svenda - */ -public class ExamplesClient { - public static byte[] APPLET_AID = {0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74, 0x73}; - public static byte[] APDU_CLEANUP = {OCUnitTests.CLA_OC_UT, OCUnitTests.INS_CLEANUP, (byte) 0x00, (byte) 0x00}; - - - public static void main(String[] args) throws Exception { - ExamplesClient client = new ExamplesClient(); - client.run(); - } - - public void run() { - try { - - // Run on simulator -> only change CARD_TYPE.JCARDSIMLOCAL and set class of simulated applet - // Test by placing breakpoint directly into opencrypto.jcmathlib.OCUnitTests.process() or any other method of interest - CardConfig runCfg = CardConfig.getDefaultConfig(); - runCfg.testCardType = CardConfig.CARD_TYPE.JCARDSIMLOCAL; - runCfg.appletToSimulate = OCUnitTests.class; - runExamples(runCfg); - - // Run on real card -> only change CARD_TYPE.PHYSICAL - // Applet must be uploaded before (gppro -install opcrypto.cap) - // Breakpoints will not be triggered (we are on real card :)) - runCfg.testCardType = CardConfig.CARD_TYPE.PHYSICAL; - runExamples(runCfg); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Demonstration of selected operations of Bignat and ECPoint. Notice that code - * is no different for simulator and real card (except for {@code CardConfig}) - * @param cardCfg configuration of target card to use (simulator / real card) - * @return true if connected, false otherwise - */ - boolean runExamples(CardConfig cardCfg) { - try { - - CardManager cardMngr = new CardManager(true, APPLET_AID); - - // Connnect to card - simulator or real card is used based on cardCfg - System.out.print("Connecting to card..."); - if (!cardMngr.Connect(cardCfg)) { - System.out.println(" failed."); - return false; - } - System.out.println(" done."); - - System.out.println("\n-------------- JCMathLib Operation Examples --------------"); - System.out.println("Info:"); - System.out.println("--> denotes data send to a card (hexadecimal)"); - System.out.println("<-- denotes data received from a card (hexadecimal) in the following format: response_data(xB) status(2B) (response_data_length) [operation_time_in_milliseconds]\n"); - - - // Example values to processed on card (fixed bignats, random ECPoints) - BigInteger num1 = new BigInteger("56C710A2984556420A71E5A898DCB0B9AC9EFF1A4FEA42A30E0BA3E2E483FC", 16); - BigInteger num2 = new BigInteger("4304CE37282F03E5B41F2B50FEB3E6E65951018C9CE1B2682C634A0BA4E0CE", 16); - ECPoint pnt_1 = randECPoint(); - ECPoint pnt_2 = randECPoint(); - Security.addProvider(new BouncyCastleProvider()); - ECParameterSpec ecSpec2 = ECNamedCurveTable.getParameterSpec("secp256r1"); - ECPoint base = ecSpec2.getG(); - - // APDU to be send to card - CommandAPDU cmd; - - // - // Selected Bignat operations - // - System.out.println("BigNatural Addition: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_ADD, num1.toByteArray().length, 0, - concat(num1.toByteArray(), num2.toByteArray())); - cardMngr.transmit(cmd); // Notice: exatly same method is used both for simulator and real card - - System.out.println("BigNatural Multiplication: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL, num1.toByteArray().length, 0, - concat(num1.toByteArray(), num2.toByteArray())); - cardMngr.transmit(cmd); - - System.out.println("BigNatural Modulo: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MOD, num1.toByteArray().length, 0, - concat(num1.toByteArray(), num2.toByteArray())); - cardMngr.transmit(cmd); - - - // - // Selected EC Point operations - // - System.out.println("EC Point Generation: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_GEN, 0, 0); - cardMngr.transmit(cmd); - - System.out.println("EC Point Add: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_ADD, 0, 0, - concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))); - cardMngr.transmit(cmd); - - System.out.println("EC scalar_Point Multiplication: "); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_MUL, num1.toByteArray().length, 0, - concat(num1.toByteArray(), base.getEncoded(false))); - cardMngr.transmit(cmd); - - // Finalize and disconnect from card - System.out.println("\n-------------- done --------------\n\n"); - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); - System.out.println(" Done."); - - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } - - /** - * Utility function which will generate random valid ECPoint - * @return ECPoint - * @throws Exception - */ - public static ECPoint randECPoint() throws Exception { - Security.addProvider(new BouncyCastleProvider()); - - ECParameterSpec ecSpec_named = ECNamedCurveTable.getParameterSpec("secp256r1"); // NIST P-256 - KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECDSA", "BC"); - kpg.initialize(ecSpec_named); - KeyPair apair = kpg.generateKeyPair(); - ECPublicKey apub = (ECPublicKey) apair.getPublic(); - return apub.getQ(); - } - - /** - * Concatenates two separate arrays into single bigger one - * @param a first array - * @param b second array - * @return concatenated array - */ - public static byte[] concat(byte[] a, byte[] b) { - int aLen = a.length; - int bLen = b.length; - byte[] c = new byte[aLen + bLen]; - System.arraycopy(a, 0, c, 0, aLen); - System.arraycopy(b, 0, c, aLen, bLen); - return c; - } -} - - - - - - - diff --git a/JCMathLibExamples/src/opencrypto/examples/SimulatedCard.java b/JCMathLibExamples/src/opencrypto/examples/SimulatedCard.java deleted file mode 100644 index 12bf40ce..00000000 --- a/JCMathLibExamples/src/opencrypto/examples/SimulatedCard.java +++ /dev/null @@ -1,55 +0,0 @@ -package opencrypto.examples; - -import javax.smartcardio.ATR; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; - -/** - * Stub class used by SimulatedCardChannelLocal to turn JCardSim interface into standard javax.smartcardio. - * NOTE: no methods of Card are implemented as we don't use any. Needs to be implemented with sensible return - * values if required. - * @author Petr Svenda - */ -public class SimulatedCard extends Card { - - @Override - public ATR getATR() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getProtocol() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public CardChannel getBasicChannel() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public CardChannel openLogicalChannel() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void beginExclusive() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void endExclusive() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public byte[] transmitControlCommand(int i, byte[] bytes) throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void disconnect(boolean bln) throws CardException { - // do nothing - } -} diff --git a/JCMathLibExamples/src/opencrypto/examples/SimulatedCardChannelLocal.java b/JCMathLibExamples/src/opencrypto/examples/SimulatedCardChannelLocal.java deleted file mode 100644 index 4cccfb50..00000000 --- a/JCMathLibExamples/src/opencrypto/examples/SimulatedCardChannelLocal.java +++ /dev/null @@ -1,56 +0,0 @@ -package opencrypto.examples; - -import com.licel.jcardsim.io.JavaxSmartCardInterface; -import java.nio.ByteBuffer; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -/** - * Proxy class turning JCardSim interface into standard javax.smartcardio - * @author Petr Svenda - */ -public class SimulatedCardChannelLocal extends CardChannel { - JavaxSmartCardInterface m_simulator; - SimulatedCard m_card; - - SimulatedCardChannelLocal (JavaxSmartCardInterface simulator) { - m_simulator = simulator; - m_card = new SimulatedCard(); - } - - @Override - public Card getCard() { - return m_card; - } - - @Override - public int getChannelNumber() { - return 0; - } - - @Override - public ResponseAPDU transmit(CommandAPDU apdu) throws CardException { - ResponseAPDU responseAPDU = null; - - try { - responseAPDU = this.m_simulator.transmitCommand(apdu); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return responseAPDU; - } - - @Override - public int transmit(ByteBuffer bb, ByteBuffer bb1) throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void close() throws CardException { - m_simulator.reset(); - } -} diff --git a/JCMathLibTests/bin/.gitignore b/JCMathLibTests/bin/.gitignore deleted file mode 100644 index 86d0cb27..00000000 --- a/JCMathLibTests/bin/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/JCMathLibTests/build.xml b/JCMathLibTests/build.xml deleted file mode 100644 index e3959616..00000000 --- a/JCMathLibTests/build.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/JCMathLibTests/ext/bcprov-jdk15on-161.jar b/JCMathLibTests/ext/bcprov-jdk15on-161.jar deleted file mode 100644 index 1fdff384..00000000 Binary files a/JCMathLibTests/ext/bcprov-jdk15on-161.jar and /dev/null differ diff --git a/JCMathLibTests/ext/jcardsim-2.2.2.jar b/JCMathLibTests/ext/jcardsim-2.2.2.jar deleted file mode 100644 index 0ac10c01..00000000 Binary files a/JCMathLibTests/ext/jcardsim-2.2.2.jar and /dev/null differ diff --git a/JCMathLibTests/ext/jcardsim-3.0.4.jar b/JCMathLibTests/ext/jcardsim-3.0.4.jar deleted file mode 100644 index ea3ea265..00000000 Binary files a/JCMathLibTests/ext/jcardsim-3.0.4.jar and /dev/null differ diff --git a/JCMathLibTests/ext/jcardsim-3.0.5.jar b/JCMathLibTests/ext/jcardsim-3.0.5.jar deleted file mode 100644 index 4a1c59c4..00000000 Binary files a/JCMathLibTests/ext/jcardsim-3.0.5.jar and /dev/null differ diff --git a/JCMathLibTests/libs/bcprov-jdk15on-157.jar b/JCMathLibTests/libs/bcprov-jdk15on-157.jar deleted file mode 100644 index 5a10986b..00000000 Binary files a/JCMathLibTests/libs/bcprov-jdk15on-157.jar and /dev/null differ diff --git a/JCMathLibTests/libs/bcprov-jdk15on-165.jar b/JCMathLibTests/libs/bcprov-jdk15on-165.jar deleted file mode 100644 index 32a83c72..00000000 Binary files a/JCMathLibTests/libs/bcprov-jdk15on-165.jar and /dev/null differ diff --git a/JCMathLibTests/libs/jcardsim-3.0.5-SNAPSHOT.jar b/JCMathLibTests/libs/jcardsim-3.0.5-SNAPSHOT.jar deleted file mode 100644 index f7af7581..00000000 Binary files a/JCMathLibTests/libs/jcardsim-3.0.5-SNAPSHOT.jar and /dev/null differ diff --git a/JCMathLibTests/src/opencrypto/test/CardManager.java b/JCMathLibTests/src/opencrypto/test/CardManager.java deleted file mode 100644 index a27d79e0..00000000 --- a/JCMathLibTests/src/opencrypto/test/CardManager.java +++ /dev/null @@ -1,195 +0,0 @@ -package opencrypto.test; - -import com.licel.jcardsim.io.CAD; -import com.licel.jcardsim.io.JavaxSmartCardInterface; -import java.util.ArrayList; -import java.util.List; -import javacard.framework.AID; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CardTerminal; -import javax.smartcardio.CardTerminals; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import javax.smartcardio.TerminalFactory; - -/** - * -* @author Petr Svenda - */ -public class CardManager { - boolean m_bDebug = false; - byte[] m_APPLET_AID = null; - Long m_lastTransmitTime = (long) 0; - CommandAPDU m_lastCommand = null; - CardChannel m_channel = null; - - public CardManager(boolean bDebug, byte[] appletAID) { - this.m_bDebug = bDebug; - this.m_APPLET_AID = appletAID; - } - - // Card Logistics - public boolean Connect(RunConfig runCfg) throws Exception { - boolean bConnected = false; - switch (runCfg.testCardType) { - case PHYSICAL: { - m_channel = ConnectPhysicalCard(runCfg.targetReaderIndex); - break; - } - case JCOPSIM: { - m_channel = ConnectJCOPSimulator(runCfg.targetReaderIndex); - break; - } - case JCARDSIMLOCAL: { - m_channel = ConnectJCardSimLocalSimulator(runCfg.appletToSimulate); - break; - } - case JCARDSIMREMOTE: { - m_channel = null; // Not implemented yet - break; - } - default: - m_channel = null; - bConnected = false; - - } - if (m_channel != null) { - bConnected = true; - } - return bConnected; - } - - public void Disconnect(boolean bReset) throws CardException { - m_channel.getCard().disconnect(bReset); // Disconnect from the card - } - - public CardChannel ConnectPhysicalCard(int targetReaderIndex) throws Exception { - // JCOP Simulators - System.out.print("Looking for physical cards... "); - return connectToCardByTerminalFactory(TerminalFactory.getDefault(), targetReaderIndex); - } - - public CardChannel ConnectJCOPSimulator(int targetReaderIndex) throws Exception { - // JCOP Simulators - System.out.print("Looking for JCOP simulators..."); - int[] ports = new int[]{8050}; - return connectToCardByTerminalFactory(TerminalFactory.getInstance("JcopEmulator", ports), targetReaderIndex); - } - - private CardChannel ConnectJCardSimLocalSimulator(Class appletClass) throws Exception { - System.setProperty("com.licel.jcardsim.terminal.type", "2"); - CAD cad = new CAD(System.getProperties()); - JavaxSmartCardInterface simulator = (JavaxSmartCardInterface) cad.getCardInterface(); - byte[] installData = new byte[0]; - AID appletAID = new AID(m_APPLET_AID, (short) 0, (byte) m_APPLET_AID.length); - - AID appletAIDRes = simulator.installApplet(appletAID, appletClass, installData, (short) 0, (byte) installData.length); - simulator.selectApplet(appletAID); - - return new SimulatedCardChannelLocal(simulator); - } - - private CardChannel connectToCardByTerminalFactory(TerminalFactory factory, int targetReaderIndex) throws CardException { - List terminals = new ArrayList<>(); - - boolean card_found = false; - CardTerminal terminal = null; - Card card = null; - try { - for (CardTerminal t : factory.terminals().list()) { - terminals.add(t); - if (t.isCardPresent()) { - card_found = true; - } - } - System.out.println("Success."); - } catch (Exception e) { - System.out.println("Failed."); - } - - if (card_found) { - System.out.println("Cards found: " + terminals); - - terminal = terminals.get(targetReaderIndex); // Prioritize physical card over simulations - - System.out.print("Connecting..."); - card = terminal.connect("*"); // Connect with the card - - System.out.println(" Done."); - - System.out.print("Establishing channel..."); - m_channel = card.getBasicChannel(); - - System.out.println(" Done."); - - // Select applet (mpcapplet) - System.out.println("Smartcard: Selecting applet..."); - - CommandAPDU cmd = new CommandAPDU(0x00, 0xa4, 0x04, 0x00, m_APPLET_AID); - ResponseAPDU response = transmit(cmd); - } else { - System.out.print("Failed to find physical card."); - } - - if (card != null) { - return card.getBasicChannel(); - } else { - return null; - } - } - - public ResponseAPDU transmit(CommandAPDU cmd) - throws CardException { - - m_lastCommand = cmd; - if (m_bDebug == true) { - log(cmd); - } - - long elapsed = -System.currentTimeMillis(); - ResponseAPDU response = m_channel.transmit(cmd); - elapsed += System.currentTimeMillis(); - m_lastTransmitTime = elapsed; - - if (m_bDebug == true) { - log(response, m_lastTransmitTime); - } - - return response; - } - - private void log(CommandAPDU cmd) { - System.out.printf("--> %s\n", Util.toHex(cmd.getBytes()), - cmd.getBytes().length); - } - - private void log(ResponseAPDU response, long time) { - String swStr = String.format("%02X", response.getSW()); - byte[] data = response.getData(); - if (data.length > 0) { - System.out.printf("<-- %s %s (%d) [%d ms]\n", Util.toHex(data), swStr, - data.length, time); - } else { - System.out.printf("<-- %s [%d ms]\n", swStr, time); - } - } - - private void log(ResponseAPDU response) { - log(response, 0); - } - - private Card waitForCard(CardTerminals terminals) - throws CardException { - while (true) { - for (CardTerminal ct : terminals - .list(CardTerminals.State.CARD_INSERTION)) { - - return ct.connect("*"); - } - terminals.waitForChange(); - } - } - -} diff --git a/JCMathLibTests/src/opencrypto/test/PerfTests.java b/JCMathLibTests/src/opencrypto/test/PerfTests.java deleted file mode 100644 index c190bf98..00000000 --- a/JCMathLibTests/src/opencrypto/test/PerfTests.java +++ /dev/null @@ -1,889 +0,0 @@ -package opencrypto.test; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.math.BigInteger; -import java.security.Security; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; -import javacard.framework.ISO7816; -import java.util.Map.Entry; -import java.util.AbstractMap.SimpleEntry; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import opencrypto.jcmathlib.OCUnitTests; -import opencrypto.jcmathlib.PM; -import opencrypto.jcmathlib.SecP256r1; -import org.bouncycastle.jce.ECNamedCurveTable; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.math.ec.ECPoint; - -/** - * -* @author Petr Svenda - */ -public class PerfTests { - public static HashMap PERF_STOP_MAPPING = new HashMap<>(); - public static byte[] PERF_COMMAND = {OCUnitTests.CLA_OC_UT, OCUnitTests.INS_PERF_SETSTOP, 0, 0, 2, 0, 0}; - public static byte[] APDU_RESET = {(byte) 0xB0, (byte) 0x03, (byte) 0x00, (byte) 0x00}; - public static final byte[] PERF_COMMAND_NONE = {OCUnitTests.CLA_OC_UT, OCUnitTests.INS_PERF_SETSTOP, 0, 0, 2, 0, 0}; - - static final String PERF_TRAP_CALL = "PM.check(PM."; - static final String PERF_TRAP_CALL_END = ");"; - - boolean MODIFY_SOURCE_FILES_BY_PERF = true; - - class PerfConfig { - public String cardName = "noCardName"; - public FileOutputStream perfFile = null; - public ArrayList> perfResultsSingleOp = new ArrayList<>(); - public ArrayList perfResultsSubparts = new ArrayList<>(); - public HashMap> perfResultsSubpartsRaw = new HashMap<>(); // hashmap with key being perf trap id, folowed by pair - public boolean bMeasurePerf = true; - public short[] perfStops = null; - public short perfStopComplete = -1; - public ArrayList failedPerfTraps = new ArrayList<>(); - } - - PerfTests() { - buildPerfMapping(); - } - - void printOperationAverageTime(String opName, RunConfig runCfg, PerfConfig perfCfg) { - if (runCfg.bMeasureOnlyTargetOp) { - long avgOpTimeFirst = 0; - long avgOpTimeSecond = 0; - // Compute average for first stop - - System.out.println(String.format("Average time: %d", avgOpTimeSecond - avgOpTimeFirst)); - } - } - void RunPerformanceTests(RunConfig runCfg) throws Exception { - PerfConfig cfg = new PerfConfig(); - cfg.cardName = "gd60"; - String experimentID = String.format("%d", System.currentTimeMillis()); - cfg.perfFile = new FileOutputStream(String.format("OC_PERF_log_%s.csv", experimentID)); - - try { - CardManager cardMngr = new CardManager(true, TestClient.OPENCRYPTO_UNITTEST_APPLET_AID); - System.out.print("Connecting to card..."); - runCfg.testCardType = RunConfig.CARD_TYPE.JCARDSIMLOCAL; - //runCfg.testCardType = RunConfig.CARD_TYPE.PHYSICAL; - cardMngr.Connect(runCfg); - System.out.println(" Done."); - - cardMngr.transmit(new CommandAPDU(PERF_COMMAND_NONE)); // erase any previous performance stop - cardMngr.transmit(new CommandAPDU(APDU_RESET)); - - byte[] bogusArray = new byte[1]; // Bogus array with single zero byte - NXP J3H145G P60 fails when no data are provided - - if (runCfg.bTestBN) { - short[] PERFSTOPS_BigNatural_Addition = {PM.TRAP_BN_ADD_1, PM.TRAP_BN_ADD_2, PM.TRAP_BN_ADD_3, PM.TRAP_BN_ADD_4, PM.TRAP_BN_ADD_5, PM.TRAP_BN_ADD_6, PM.TRAP_BN_ADD_7, PM.TRAP_BN_ADD_COMPLETE}; - short[] PERFSTOPS_BigNatural_Addition_onlyTarget = {PM.TRAP_BN_ADD_6, PM.TRAP_BN_ADD_7}; - cfg.perfStops = runCfg.bMeasureOnlyTargetOp ? PERFSTOPS_BigNatural_Addition_onlyTarget : PERFSTOPS_BigNatural_Addition; - cfg.perfStopComplete = PM.TRAP_BN_ADD_COMPLETE; - long avgOpTime = 0; - String opName = "BigNatural Addition: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength - 1);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength - 1);//Generate Int2 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_ADD, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - avgOpTime += PerfAnalyzeCommand(opName, cmd, cardMngr, cfg); - } - printOperationAverageTime(opName, runCfg, cfg); - System.out.println(String.format("%s: average time: %d", opName, avgOpTime / runCfg.numRepeats)); - - short[] PERFSTOPS_BigNatural_Subtraction = {PM.TRAP_BN_SUB_1, PM.TRAP_BN_SUB_2, PM.TRAP_BN_SUB_3, PM.TRAP_BN_SUB_4, PM.TRAP_BN_SUB_5, PM.TRAP_BN_SUB_6, PM.TRAP_BN_SUB_7, PM.TRAP_BN_SUB_COMPLETE}; - short[] PERFSTOPS_BigNatural_Subtraction_onlyTarget = {PM.TRAP_BN_SUB_6, PM.TRAP_BN_SUB_7}; - cfg.perfStops = runCfg.bMeasureOnlyTargetOp ? PERFSTOPS_BigNatural_Subtraction_onlyTarget : PERFSTOPS_BigNatural_Subtraction; - cfg.perfStopComplete = PM.TRAP_BN_SUB_COMPLETE; - avgOpTime = 0; - opName = "BigNatural Subtraction: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength - 1);//Generate Int2 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_SUB, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - avgOpTime += PerfAnalyzeCommand(opName, cmd, cardMngr, cfg); - } - System.out.println(String.format("%s: average time: %d", opName, avgOpTime / runCfg.numRepeats)); - - short[] PERFSTOPS_BigNatural_Multiplication = {PM.TRAP_BN_MUL_1, PM.TRAP_BN_MUL_2, PM.TRAP_BN_MUL_3, PM.TRAP_BN_MUL_4, PM.TRAP_BN_MUL_5, PM.TRAP_BN_MUL_6, PM.TRAP_BN_MUL_COMPLETE}; - short[] PERFSTOPS_BigNatural_Multiplication_onlyTarget = {PM.TRAP_BN_MUL_5, PM.TRAP_BN_MUL_6}; - cfg.perfStops = runCfg.bMeasureOnlyTargetOp ? PERFSTOPS_BigNatural_Multiplication_onlyTarget : PERFSTOPS_BigNatural_Multiplication; - cfg.perfStopComplete = PM.TRAP_BN_MUL_COMPLETE; - avgOpTime = 0; - opName = "BigNatural Multiplication: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int2 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - avgOpTime += PerfAnalyzeCommand(opName, cmd, cardMngr, cfg); - } - System.out.println(String.format("%s: average time: %d", opName, avgOpTime / runCfg.numRepeats)); - - - short[] PERFSTOPS_Bignat_sqrt = {PM.TRAP_BIGNAT_SQRT_1, PM.TRAP_BIGNAT_SQRT_2, PM.TRAP_BIGNAT_SQRT_3, PM.TRAP_BIGNAT_SQRT_4, PM.TRAP_BIGNAT_SQRT_5, PM.TRAP_BIGNAT_SQRT_6, PM.TRAP_BIGNAT_SQRT_7, PM.TRAP_BIGNAT_SQRT_8, PM.TRAP_BIGNAT_SQRT_9, PM.TRAP_BIGNAT_SQRT_10, PM.TRAP_BIGNAT_SQRT_11, PM.TRAP_BIGNAT_SQRT_12, PM.TRAP_BIGNAT_SQRT_13, PM.TRAP_BIGNAT_SQRT_14, PM.TRAP_BIGNAT_SQRT_15, PM.TRAP_BIGNAT_SQRT_COMPLETE}; - short[] PERFSTOPS_Bignat_sqrt_onlyTarget = {PM.TRAP_BIGNAT_SQRT_1, PM.TRAP_BIGNAT_SQRT_2, PM.TRAP_BIGNAT_SQRT_3, PM.TRAP_BIGNAT_SQRT_4, PM.TRAP_BIGNAT_SQRT_5, PM.TRAP_BIGNAT_SQRT_6, PM.TRAP_BIGNAT_SQRT_7, PM.TRAP_BIGNAT_SQRT_8, PM.TRAP_BIGNAT_SQRT_9, PM.TRAP_BIGNAT_SQRT_10, PM.TRAP_BIGNAT_SQRT_11, PM.TRAP_BIGNAT_SQRT_12, PM.TRAP_BIGNAT_SQRT_13, PM.TRAP_BIGNAT_SQRT_14, PM.TRAP_BIGNAT_SQRT_15, PM.TRAP_BIGNAT_SQRT_COMPLETE}; - cfg.perfStops = runCfg.bMeasureOnlyTargetOp ? PERFSTOPS_Bignat_sqrt_onlyTarget : PERFSTOPS_Bignat_sqrt; - cfg.perfStopComplete = PM.TRAP_BIGNAT_SQRT_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_SQRT, num.toByteArray().length, 0, num.toByteArray()); - PerfAnalyzeCommand("Bignat_sqrt_FP: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Storage = {PM.TRAP_BN_STR_1, PM.TRAP_BN_STR_2, PM.TRAP_BN_STR_3, PM.TRAP_BN_STR_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Storage; - cfg.perfStopComplete = PM.TRAP_BN_STR_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_STR, 0, 0, num.toByteArray()); - PerfAnalyzeCommand("BigNatural Storage: ", cmd, cardMngr, cfg); - } - - - short[] PERFSTOPS_BigNatural_Exponentiation = {PM.TRAP_BN_EXP_1, PM.TRAP_BN_EXP_2, PM.TRAP_BN_EXP_3, PM.TRAP_BN_EXP_4, PM.TRAP_BN_EXP_5, PM.TRAP_BN_EXP_6, PM.TRAP_BN_EXP_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Exponentiation; - cfg.perfStopComplete = PM.TRAP_BN_EXP_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = BigInteger.valueOf(14); //Generate Int1 - BigInteger num2 = BigInteger.valueOf(8); //Generate Int2 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_EXP, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - PerfAnalyzeCommand("BigNatural Exponentiation: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Modulo = {PM.TRAP_BN_MOD_1, PM.TRAP_BN_MOD_2, PM.TRAP_BN_MOD_3, PM.TRAP_BN_MOD_4, PM.TRAP_BN_MOD_5, PM.TRAP_BN_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Modulo; - cfg.perfStopComplete = PM.TRAP_BN_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength - 1);//Generate Int2 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MOD, (num1.toByteArray()).length, 0, Util.concat((num1.toByteArray()), (num2.toByteArray()))); - PerfAnalyzeCommand("BigNatural Modulo: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Addition__Modulo_ = {PM.TRAP_BN_ADD_MOD_1, PM.TRAP_BN_ADD_MOD_2, PM.TRAP_BN_ADD_MOD_3, PM.TRAP_BN_ADD_MOD_4, PM.TRAP_BN_ADD_MOD_5, PM.TRAP_BN_ADD_MOD_6, PM.TRAP_BN_ADD_MOD_7, PM.TRAP_BN_ADD_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Addition__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_ADD_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int2 - BigInteger num3 = Util.randomBigNat(runCfg.bnBaseTestLength / 8);//Generate Int3 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_ADD_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - PerfAnalyzeCommand("BigNatural Addition (Modulo): ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Subtraction__Modulo_ = {PM.TRAP_BN_SUB_MOD_1, PM.TRAP_BN_SUB_MOD_2, PM.TRAP_BN_SUB_MOD_3, PM.TRAP_BN_SUB_MOD_4, PM.TRAP_BN_SUB_MOD_5, PM.TRAP_BN_SUB_MOD_6, PM.TRAP_BN_SUB_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Subtraction__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_SUB_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int2 - BigInteger num3 = Util.randomBigNat(runCfg.bnBaseTestLength / 8);//Generate Int3 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_SUB_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - PerfAnalyzeCommand("BigNatural Subtraction (Modulo): ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Multiplication__Modulo_ = {PM.TRAP_BN_MUL_MOD_1, PM.TRAP_BN_MUL_MOD_2, PM.TRAP_BN_MUL_MOD_3, PM.TRAP_BN_MUL_MOD_4, PM.TRAP_BN_MUL_MOD_5, PM.TRAP_BN_MUL_MOD_6, PM.TRAP_BN_MUL_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Multiplication__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_MUL_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int1 - BigInteger num2 = Util.randomBigNat(runCfg.bnBaseTestLength / 2);//Generate Int2 - BigInteger num3 = Util.randomBigNat(runCfg.bnBaseTestLength / 8);//Generate Int3 - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - PerfAnalyzeCommand("BigNatural Multiplication (Modulo): ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Exponentiation__Modulo_ = {PM.TRAP_BN_EXP_MOD_1, PM.TRAP_BN_EXP_MOD_2, PM.TRAP_BN_EXP_MOD_3, PM.TRAP_BN_EXP_MOD_4, PM.TRAP_BN_EXP_MOD_5, PM.TRAP_BN_EXP_MOD_6, PM.TRAP_BN_EXP_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Exponentiation__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_EXP_MOD_COMPLETE; - int power = 2; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength); //Generate Int1 (base) - BigInteger num2 = BigInteger.valueOf(power); //Generate Int2 (exp) - BigInteger num3 = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int3 (mod) - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_EXP_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(num2.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()), Util.trimLeadingZeroes(num3.toByteArray()))); - PerfAnalyzeCommand("BigNatural Exponentiation (Modulo): ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Pow2__Modulo_ = {PM.TRAP_BN_POW2_MOD_1, PM.TRAP_BN_POW2_MOD_2, PM.TRAP_BN_POW2_MOD_3, PM.TRAP_BN_POW2_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Pow2__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_POW2_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength); //Generate Int1 (base) - BigInteger mod = Util.randomBigNat(runCfg.bnBaseTestLength);//Generate Int3 (mod) - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_POW2_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(mod.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); - PerfAnalyzeCommand("BigNatural Power2 (Modulo): ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_BigNatural_Inversion__Modulo_ = {PM.TRAP_BN_INV_MOD_1, PM.TRAP_BN_INV_MOD_2, PM.TRAP_BN_INV_MOD_3, PM.TRAP_BN_INV_MOD_4, PM.TRAP_BN_INV_MOD_5, PM.TRAP_BN_INV_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_BigNatural_Inversion__Modulo_; - cfg.perfStopComplete = PM.TRAP_BN_INV_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - BigInteger num1 = Util.randomBigNat(runCfg.bnBaseTestLength + runCfg.bnBaseTestLength / 2); //Generate base - BigInteger num2 = new BigInteger(1, SecP256r1.p);//Generate mod - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_INV_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, 0, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()))); - PerfAnalyzeCommand("BigNatural Inversion (Modulo): ", cmd, cardMngr, cfg); - } - - } - - if (runCfg.bTestINT) { - short[] PERFSTOPS_Integer_Storage = {PM.TRAP_INT_STR_1, PM.TRAP_INT_STR_2, PM.TRAP_INT_STR_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Storage; - cfg.perfStopComplete = PM.TRAP_INT_STR_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_STR, 0, 0, Util.IntToBytes(num)); - PerfAnalyzeCommand("Integer Storage: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_Integer_Addition = {PM.TRAP_INT_ADD_1, PM.TRAP_INT_ADD_2, PM.TRAP_INT_ADD_3, PM.TRAP_INT_ADD_4, PM.TRAP_INT_ADD_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Addition; - cfg.perfStopComplete = PM.TRAP_INT_ADD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num_add_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_add_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_ADD, Util.IntToBytes(num_add_1).length, 0, Util.concat(Util.IntToBytes(num_add_1), Util.IntToBytes(num_add_2))); - PerfAnalyzeCommand("Integer Addition: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_Integer_Subtraction = {PM.TRAP_INT_SUB_1, PM.TRAP_INT_SUB_2, PM.TRAP_INT_SUB_3, PM.TRAP_INT_SUB_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Subtraction; - cfg.perfStopComplete = PM.TRAP_INT_SUB_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num_sub_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_sub_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_SUB, Util.IntToBytes(num_sub_1).length, 0, Util.concat(Util.IntToBytes(num_sub_1), Util.IntToBytes(num_sub_2))); - PerfAnalyzeCommand("Integer Subtraction: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_Integer_Multiplication = {PM.TRAP_INT_MUL_1, PM.TRAP_INT_MUL_2, PM.TRAP_INT_MUL_3, PM.TRAP_INT_MUL_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Multiplication; - cfg.perfStopComplete = PM.TRAP_INT_MUL_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num_mul_1 = ThreadLocalRandom.current().nextInt((int) (Math.sqrt(Integer.MIN_VALUE)), (int) (Math.sqrt(Integer.MAX_VALUE))); - int num_mul_2 = ThreadLocalRandom.current().nextInt((int) (Math.sqrt(Integer.MIN_VALUE)), (int) (Math.sqrt(Integer.MAX_VALUE))); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_MUL, Util.IntToBytes(num_mul_1).length, 0, Util.concat(Util.IntToBytes(num_mul_1), Util.IntToBytes(num_mul_2))); - PerfAnalyzeCommand("Integer Multiplication: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_Integer_Division = {PM.TRAP_INT_DIV_1, PM.TRAP_INT_DIV_2, PM.TRAP_INT_DIV_3, PM.TRAP_INT_DIV_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Division; - cfg.perfStopComplete = PM.TRAP_INT_DIV_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num_div_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_div_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_DIV, Util.IntToBytes(num_div_1).length, 0, Util.concat(Util.IntToBytes(num_div_1), Util.IntToBytes(num_div_2))); - PerfAnalyzeCommand("Integer Division: ", cmd, cardMngr, cfg); - } - /* - short[] PERFSTOPS_Integer_Exponentiation = {PerfMeasure.TRAP_INT_EXP_1, PerfMeasure.TRAP_INT_EXP_2, PerfMeasure.TRAP_INT_EXP_3, PerfMeasure.TRAP_INT_EXP_4, PerfMeasure.TRAP_INT_EXP_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Exponentiation; - cfg.perfStopComplete = PerfMeasure.TRAP_INT_EXP_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - PerfAnalyzeCommand("Integer Exponentiation: ", cmd, cardMngr, cfg); - } - */ - short[] PERFSTOPS_Integer_Modulo = {PM.TRAP_INT_MOD_1, PM.TRAP_INT_MOD_2, PM.TRAP_INT_MOD_3, PM.TRAP_INT_MOD_COMPLETE}; - cfg.perfStops = PERFSTOPS_Integer_Modulo; - cfg.perfStopComplete = PM.TRAP_INT_MOD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - int num_mod_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_mod_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_MOD, Util.IntToBytes(num_mod_1).length, 0, Util.concat(Util.IntToBytes(num_mod_1), Util.IntToBytes(num_mod_2))); - PerfAnalyzeCommand("Integer Modulo: ", cmd, cardMngr, cfg); - } - } - - if (runCfg.bTestECPoint) { - // Details of ECPoint - -/* - short[] PERFSTOPS_ECPoint_multiplication_double = {PerfMeasure.TRAP_ECPOINT_MULT_1, PerfMeasure.TRAP_ECPOINT_MULT_2, PerfMeasure.TRAP_ECPOINT_MULT_3, PerfMeasure.TRAP_ECPOINT_MULT_4, PerfMeasure.TRAP_ECPOINT_MULT_5, PerfMeasure.TRAP_ECPOINT_MULT_6, PerfMeasure.TRAP_ECPOINT_MULT_7, PerfMeasure.TRAP_ECPOINT_MULT_8, PerfMeasure.TRAP_ECPOINT_MULT_9, PerfMeasure.TRAP_ECPOINT_MULT_10, PerfMeasure.TRAP_ECPOINT_MULT_11, PerfMeasure.TRAP_ECPOINT_MULT_12, PerfMeasure.TRAP_ECPOINT_MULT_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_multiplication_double; - cfg.perfStopComplete = PerfMeasure.TRAP_ECPOINT_MULT_COMPLETE; -/**/ - /* - short[] PERFSTOPS_ECPoint_multiplication_x2 = {PerfMeasure.TRAP_ECPOINT_MULT_X_1, PerfMeasure.TRAP_ECPOINT_MULT_X_2, PerfMeasure.TRAP_ECPOINT_MULT_X_3, PerfMeasure.TRAP_ECPOINT_MULT_X_4, PerfMeasure.TRAP_ECPOINT_MULT_X_5, PerfMeasure.TRAP_ECPOINT_MULT_X_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_multiplication_x2; - cfg.perfStopComplete = PerfMeasure.TRAP_ECPOINT_MULT_X_COMPLETE; -*/ -/* - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt = Util.randECPoint(); - System.out.println(String.format("Random ECPoint == G: %s", Util.toHex(pnt.getEncoded(false)))); - // Set modified parameter G of the curve (our random point) - cardMngr.transmit(new CommandAPDU(Configuration.CLA_MPC, Configuration.INS_EC_SETCURVE_G, 0, 0, pnt.getEncoded(false))); - - CommandAPDU cmd = new CommandAPDU(Configuration.CLA_MPC, Configuration.INS_EC_DBL, 0, 0, pnt.getEncoded(false)); - PerfAnalyzeCommand("ECPoint_double: ", cmd, cardMngr, cfg); - } -*/ - short[] PERFSTOPS_ECPoint_multiplication = {PM.TRAP_ECPOINT_MULT_1, PM.TRAP_ECPOINT_MULT_2, PM.TRAP_ECPOINT_MULT_3, PM.TRAP_ECPOINT_MULT_4, PM.TRAP_ECPOINT_MULT_5, PM.TRAP_ECPOINT_MULT_6, PM.TRAP_ECPOINT_MULT_7, PM.TRAP_ECPOINT_MULT_8, PM.TRAP_ECPOINT_MULT_9, PM.TRAP_ECPOINT_MULT_10, PM.TRAP_ECPOINT_MULT_11, PM.TRAP_ECPOINT_MULT_12, PM.TRAP_ECPOINT_MULT_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_multiplication; - cfg.perfStopComplete = PM.TRAP_ECPOINT_MULT_COMPLETE; - Security.addProvider(new BouncyCastleProvider()); - ECParameterSpec ecSpec2 = ECNamedCurveTable.getParameterSpec("secp256r1"); - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt = ecSpec2.getG(); // Use standard G point - BigInteger scalar = Util.randomBigNat(runCfg.bnBaseTestLength); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_MUL, scalar.toByteArray().length, 0, Util.concat(scalar.toByteArray(), pnt.getEncoded(false))); - PerfAnalyzeCommand("ECPoint_multiplication: ", cmd, cardMngr, cfg); - } - - short[] PERFSTOPS_ECPoint_add = {PM.TRAP_ECPOINT_ADD_1, PM.TRAP_ECPOINT_ADD_2, PM.TRAP_ECPOINT_ADD_3, PM.TRAP_ECPOINT_ADD_4, PM.TRAP_ECPOINT_ADD_5, PM.TRAP_ECPOINT_ADD_6, PM.TRAP_ECPOINT_ADD_7, PM.TRAP_ECPOINT_ADD_8, PM.TRAP_ECPOINT_ADD_9, PM.TRAP_ECPOINT_ADD_10, PM.TRAP_ECPOINT_ADD_11, PM.TRAP_ECPOINT_ADD_12, PM.TRAP_ECPOINT_ADD_13, PM.TRAP_ECPOINT_ADD_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_add; - cfg.perfStopComplete = PM.TRAP_ECPOINT_ADD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt_1 = Util.randECPoint(); - ECPoint pnt_2 = Util.randECPoint(); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_ADD, 0, 0, Util.concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))); - //CommandAPDU cmd = new CommandAPDU(hexStringToByteArray("B041000041041D1D96E2B171DFCC457587259E28E597258BF86EA0CFCB97BB6FCE62E7539E2879F3FDE52075AACAD1BA7637F816B6145C01E646831C259409FB89309AB03FD9")); - PerfAnalyzeCommand("ECPoint_add: ", cmd, cardMngr, cfg); - } - - // Details of ECCurve - /* - short[] PERFSTOPS_ECCurve_newKeyPair = {PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_1, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_2, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_3, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_4, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_5, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_6, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_7, PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECCurve_newKeyPair; - cfg.perfStopComplete = PerfMeasure.TRAP_ECCURVE_NEWKEYPAIR_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - CommandAPDU cmd = new CommandAPDU(Configuration.CLA_MPC, Configuration.INS_EC_GEN, 0, 0, bogusArray); - PerfAnalyzeCommand("ECCurve_newKeyPair: ", cmd, cardMngr, cfg); - } - */ - - short[] PERFSTOPS_ECPoint_multiplication_x = {PM.TRAP_ECPOINT_MULT_X_1, PM.TRAP_ECPOINT_MULT_X_2, PM.TRAP_ECPOINT_MULT_X_3, PM.TRAP_ECPOINT_MULT_X_4, PM.TRAP_ECPOINT_MULT_X_5, PM.TRAP_ECPOINT_MULT_X_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_multiplication_x; - cfg.perfStopComplete = PM.TRAP_ECPOINT_MULT_X_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt = ecSpec2.getG(); // Use standard G point - BigInteger scalar = Util.randomBigNat(runCfg.bnBaseTestLength); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_MUL, scalar.toByteArray().length, 0, Util.concat(scalar.toByteArray(), pnt.getEncoded(false))); - PerfAnalyzeCommand("ECPoint_multiplication_x: ", cmd, cardMngr, cfg); - } - - - short[] PERFSTOPS_ECPoint_negate = {PM.TRAP_ECPOINT_NEGATE_1, PM.TRAP_ECPOINT_NEGATE_2, PM.TRAP_ECPOINT_NEGATE_3, PM.TRAP_ECPOINT_NEGATE_4, PM.TRAP_ECPOINT_NEGATE_5, PM.TRAP_ECPOINT_NEGATE_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPoint_negate; - cfg.perfStopComplete = PM.TRAP_ECPOINT_NEGATE_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt = Util.randECPoint(); - ECPoint negPnt = pnt.negate(); - CommandAPDU cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_NEG, pnt.getEncoded(false).length, 0, pnt.getEncoded(false)); - PerfAnalyzeCommand("ECPoint_negate: ", cmd, cardMngr, cfg); - } - } - - if (runCfg.bTestEC) { - short[] PERFSTOPS_ECPOINT_GEN = {PM.TRAP_EC_GEN_1, PM.TRAP_EC_GEN_2, PM.TRAP_EC_GEN_3, PM.TRAP_EC_GEN_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPOINT_GEN; - cfg.perfStopComplete = PM.TRAP_EC_GEN_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - PerfAnalyzeCommand("EC Point Generation: ", new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_GEN, 0, 0, bogusArray), cardMngr, cfg); - } - - short[] PERFSTOPS_ECPOINT_ADD = {PM.TRAP_EC_ADD_1, PM.TRAP_EC_ADD_2, PM.TRAP_EC_ADD_3, PM.TRAP_EC_ADD_4, PM.TRAP_EC_ADD_5, PM.TRAP_EC_ADD_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPOINT_ADD; - cfg.perfStopComplete = PM.TRAP_EC_ADD_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt_1 = Util.randECPoint(); - ECPoint pnt_2 = Util.randECPoint(); - PerfAnalyzeCommand("EC Point Add: ", new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_ADD, 0, 0, Util.concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))), cardMngr, cfg); - } - - short[] PERFSTOPS_EC_scalar_point_multiplication = {PM.TRAP_EC_MUL_1, PM.TRAP_EC_MUL_2, PM.TRAP_EC_MUL_3, PM.TRAP_EC_MUL_4, PM.TRAP_EC_MUL_5, PM.TRAP_EC_MUL_COMPLETE}; - cfg.perfStops = PERFSTOPS_EC_scalar_point_multiplication; - cfg.perfStopComplete = PM.TRAP_EC_MUL_COMPLETE; - Security.addProvider(new BouncyCastleProvider()); - ECParameterSpec ecSpec2 = ECNamedCurveTable.getParameterSpec("secp256r1"); - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint base = ecSpec2.getG(); - Random rnd = new Random(); - BigInteger priv1 = new BigInteger(runCfg.bnBaseTestLength, rnd); - PerfAnalyzeCommand("EC scalar-point multiplication: ", new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_MUL, priv1.toByteArray().length, 0, Util.concat(priv1.toByteArray(), base.getEncoded(false))), cardMngr, cfg); - } - - short[] PERFSTOPS_ECPOINT_DOUBLE = {PM.TRAP_EC_DBL_1, PM.TRAP_EC_DBL_2, PM.TRAP_EC_DBL_3, PM.TRAP_EC_DBL_4, PM.TRAP_EC_DBL_COMPLETE}; - cfg.perfStops = PERFSTOPS_ECPOINT_DOUBLE; - cfg.perfStopComplete = PM.TRAP_EC_DBL_COMPLETE; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - ECPoint pnt = Util.randECPoint(); - System.out.println(String.format("Random ECPoint == G: %s", Util.toHex(pnt.getEncoded(false)))); - // Set modified parameter G of the curve (our random point) - cardMngr.transmit(new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_SETCURVE_G, 0, 0, pnt.getEncoded(false))); - - PerfAnalyzeCommand("EC Point Double: ", new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_DBL, 0, 0, pnt.getEncoded(false)), cardMngr, cfg); - } - } - - - System.out.println("\n-------------- Performance tests--------------\n\n"); - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); // Disconnect from the card - System.out.println(" Done."); - } catch (Exception e) { - e.printStackTrace(); - } - - if (cfg.failedPerfTraps.size() > 0) { - System.out.println("#########################"); - System.out.println("!!! SOME PERFORMANCE TRAPS NOT REACHED !!!"); - System.out.println("#########################"); - for (String trap : cfg.failedPerfTraps) { - System.out.println(trap); - } - } else { - System.out.println("##########################"); - System.out.println("ALL PERFORMANCE TRAPS REACHED CORRECTLY"); - System.out.println("##########################"); - } - - // Save performance traps into single file - String perfFileName = String.format("TRAP_RAW_%s.csv", experimentID); - SavePerformanceResults(cfg.perfResultsSubpartsRaw, perfFileName); - - // If required, modification of source code files is attempted - if (MODIFY_SOURCE_FILES_BY_PERF) { - String dirPath = "..\\!PerfSRC\\Lib\\"; - InsertPerfInfoIntoFiles(dirPath, cfg.cardName, experimentID, cfg.perfResultsSubpartsRaw); - } - } - - static void SavePerformanceResults(HashMap> perfResultsSubpartsRaw, String fileName) throws FileNotFoundException, IOException { - // Save performance traps into single file - FileOutputStream perfLog = new FileOutputStream(fileName); - String output = "perfID, previous perfID, time difference between perfID and previous perfID (ms)\n"; - perfLog.write(output.getBytes()); - for (Short perfID : perfResultsSubpartsRaw.keySet()) { - output = String.format("%d, %d, %d\n", perfID, perfResultsSubpartsRaw.get(perfID).getKey(), perfResultsSubpartsRaw.get(perfID).getValue()); - perfLog.write(output.getBytes()); - } - perfLog.close(); - } - - static void LoadPerformanceResults(String fileName, HashMap> perfResultsSubpartsRaw) throws FileNotFoundException, IOException { - BufferedReader br = new BufferedReader(new FileReader(fileName)); - String strLine; - while ((strLine = br.readLine()) != null) { - if (strLine.contains("perfID,")) { - // skip header line - } - else { - String[] cols = strLine.split(","); - Short perfID = Short.parseShort(cols[0].trim()); - Short prevPerfID = Short.parseShort(cols[1].trim()); - Long elapsed = Long.parseLong(cols[2].trim()); - - perfResultsSubpartsRaw.put(perfID, new SimpleEntry(prevPerfID, elapsed)); - } - } - br.close(); - } - - static void testInsertPerfIntoFiles() throws IOException { - String dirPath = "..\\!PerfSRC\\Lib\\"; - HashMap> results = new HashMap<>(); - results.put(PM.TRAP_EC_ADD_2, new SimpleEntry(PM.TRAP_EC_ADD_1, 37)); - results.put(PM.TRAP_EC_GEN_3, new SimpleEntry(PM.TRAP_EC_GEN_2, 123)); - results.put(PM.TRAP_EC_DBL_2, new SimpleEntry(PM.TRAP_EC_DBL_1, 567)); - - String perfFileName = String.format("TRAP_RAW_123456.csv"); - SavePerformanceResults(results, perfFileName); - HashMap> perfResultsSubpartsRaw = new HashMap<>(); - LoadPerformanceResults(perfFileName, perfResultsSubpartsRaw); - assert (perfResultsSubpartsRaw.size() == results.size()); - - InsertPerfInfoIntoFiles(dirPath, "test", "123456", results); - } - - long PerfAnalyzeCommand(String operationName, CommandAPDU cmd, CardManager cardMngr, PerfConfig cfg) throws CardException, IOException { - System.out.println(operationName); - short prevPerfStop = PM.PERF_START; - long prevTransmitTime = 0; - long lastFromPrevTime = 0; - short currentPerfStop = 0; - try { - for (short perfStop : cfg.perfStops) { - currentPerfStop = perfStop; - System.arraycopy(Util.shortToByteArray(perfStop), 0, PERF_COMMAND, ISO7816.OFFSET_CDATA, 2); // set required stop condition - String operationNamePerf = String.format("%s_%s", operationName, getPerfStopName(perfStop)); - System.out.println(operationNamePerf); - cardMngr.transmit(new CommandAPDU(PERF_COMMAND)); // set performance trap - ResponseAPDU response = cardMngr.transmit(cmd); // execute target operation - boolean bFailedToReachTrap = false; - if (perfStop != cfg.perfStopComplete) { // Check expected error to be equal performance trap - if (response.getSW() != (perfStop & 0xffff)) { - // we have not reached expected performance trap - cfg.failedPerfTraps.add(getPerfStopName(perfStop)); - bFailedToReachTrap = true; - } - } - writePerfLog(operationNamePerf, response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff), cardMngr.m_lastTransmitTime, cfg.perfResultsSingleOp, cfg.perfFile); - long fromPrevTime = cardMngr.m_lastTransmitTime - prevTransmitTime; - if (bFailedToReachTrap) { - cfg.perfResultsSubparts.add(String.format("[%s-%s], \tfailed to reach after %d ms (0x%x)", getPerfStopName(prevPerfStop), getPerfStopName(perfStop), cardMngr.m_lastTransmitTime, response.getSW())); - } - else { - cfg.perfResultsSubparts.add(String.format("[%s-%s], \t%d ms", getPerfStopName(prevPerfStop), getPerfStopName(perfStop), fromPrevTime)); - cfg.perfResultsSubpartsRaw.put(perfStop, new SimpleEntry(prevPerfStop, fromPrevTime)); - lastFromPrevTime = fromPrevTime; - } - - prevPerfStop = perfStop; - prevTransmitTime = cardMngr.m_lastTransmitTime; - - cardMngr.transmit(new CommandAPDU(APDU_RESET)); // free memory after command - } - } - catch (Exception e) { - // Print what we have measured so far - for (String res : cfg.perfResultsSubparts) { - System.out.println(res); - } - cfg.failedPerfTraps.add(getPerfStopName(currentPerfStop)); - throw e; - } - // Print measured performance info - for (String res : cfg.perfResultsSubparts) { - System.out.println(res); - } - - return lastFromPrevTime; - } - - - static void writePerfLog(String operationName, boolean bResult, Long time, ArrayList> perfResults, FileOutputStream perfFile) throws IOException { - perfResults.add(new SimpleEntry(operationName, time)); - perfFile.write(String.format("%s,%d,%s\n", operationName, time, bResult).getBytes()); - perfFile.flush(); - } - - - static void InsertPerfInfoIntoFiles(String basePath, String cardName, String experimentID, HashMap> perfResultsSubpartsRaw) throws FileNotFoundException, IOException { - File dir = new File(basePath); - String[] filesArray = dir.list(); - if ((filesArray != null) && (dir.isDirectory() == true)) { - // make subdir for results - String outputDir = String.format("%s\\perf\\%s\\", basePath, experimentID); - new File(outputDir).mkdirs(); - - for (String fileName : filesArray) { - File dir2 = new File(basePath + fileName); - if (!dir2.isDirectory()) { - InsertPerfInfoIntoFile(String.format("%s\\%s", basePath, fileName), cardName, experimentID, outputDir, perfResultsSubpartsRaw); - } - } - } - } - - static void InsertPerfInfoIntoFile(String filePath, String cardName, String experimentID, String outputDir, HashMap> perfResultsSubpartsRaw) throws FileNotFoundException, IOException { - try { - BufferedReader br = new BufferedReader(new FileReader(filePath)); - String basePath = filePath.substring(0, filePath.lastIndexOf("\\")); - String fileName = filePath.substring(filePath.lastIndexOf("\\")); - - String fileNamePerf = String.format("%s\\%s", outputDir, fileName); - FileOutputStream fileOut = new FileOutputStream(fileNamePerf); - String strLine; - String resLine; - // For every line of program try to find perfromance trap. If found and perf. is available, then insert comment into code - while ((strLine = br.readLine()) != null) { - - if (strLine.contains(PERF_TRAP_CALL)) { - int trapStart = strLine.indexOf(PERF_TRAP_CALL); - int trapEnd = strLine.indexOf(PERF_TRAP_CALL_END); - // We have perf. trap, now check if we also corresponding measurement - String perfTrapName = (String) strLine.substring(trapStart + PERF_TRAP_CALL.length(), trapEnd); - short perfID = getPerfStopFromName(perfTrapName); - - if (perfResultsSubpartsRaw.containsKey(perfID)) { - // We have measurement for this trap, add into comment section - resLine = String.format("%s // %d ms (%s,%s) %s", (String) strLine.substring(0, trapEnd + PERF_TRAP_CALL_END.length()), perfResultsSubpartsRaw.get(perfID).getValue(), cardName, experimentID, (String) strLine.subSequence(trapEnd + PERF_TRAP_CALL_END.length(), strLine.length())); - } - else { - resLine = strLine; - } - } - else { - resLine = strLine; - } - resLine += "\n"; - fileOut.write(resLine.getBytes()); - } - - fileOut.close(); - } - catch(Exception e) { - System.out.println(String.format("Failed to transform file %s ", filePath) + e); - } - } - - - public static void buildPerfMapping() { - PERF_STOP_MAPPING.put(PM.PERF_START, "PERF_START"); - //PERF_STOP_MAPPING.put(PerfMeasure.PERF_COMPLETE, "PERF_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_EC_GEN_1, "TRAP_EC_GEN_1"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_GEN_2, "TRAP_EC_GEN_2"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_GEN_3, "TRAP_EC_GEN_3"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_GEN_COMPLETE, "TRAP_EC_GEN_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_EC_DBL_1, "TRAP_EC_DBL_1"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_DBL_2, "TRAP_EC_DBL_2"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_DBL_3, "TRAP_EC_DBL_3"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_DBL_4, "TRAP_EC_DBL_4"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_DBL_COMPLETE, "TRAP_EC_DBL_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_1, "TRAP_EC_MUL_1"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_2, "TRAP_EC_MUL_2"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_3, "TRAP_EC_MUL_3"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_4, "TRAP_EC_MUL_4"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_5, "TRAP_EC_MUL_5"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_6, "TRAP_EC_MUL_6"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_MUL_COMPLETE, "TRAP_EC_MUL_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_1, "TRAP_EC_ADD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_2, "TRAP_EC_ADD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_3, "TRAP_EC_ADD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_4, "TRAP_EC_ADD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_5, "TRAP_EC_ADD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_ADD_COMPLETE, "TRAP_EC_ADD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_STR_1, "TRAP_BN_STR_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_STR_2, "TRAP_BN_STR_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_STR_3, "TRAP_BN_STR_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_STR_COMPLETE, "TRAP_BN_STR_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_1, "TRAP_BN_ADD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_2, "TRAP_BN_ADD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_3, "TRAP_BN_ADD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_4, "TRAP_BN_ADD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_5, "TRAP_BN_ADD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_6, "TRAP_BN_ADD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_7, "TRAP_BN_ADD_7"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_COMPLETE, "TRAP_BN_ADD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_1, "TRAP_BN_SUB_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_2, "TRAP_BN_SUB_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_3, "TRAP_BN_SUB_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_4, "TRAP_BN_SUB_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_5, "TRAP_BN_SUB_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_6, "TRAP_BN_SUB_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_7, "TRAP_BN_SUB_7"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_COMPLETE, "TRAP_BN_SUB_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_1, "TRAP_BN_MUL_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_2, "TRAP_BN_MUL_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_3, "TRAP_BN_MUL_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_4, "TRAP_BN_MUL_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_5, "TRAP_BN_MUL_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_6, "TRAP_BN_MUL_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_COMPLETE, "TRAP_BN_MUL_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_1, "TRAP_BN_EXP_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_2, "TRAP_BN_EXP_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_3, "TRAP_BN_EXP_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_4, "TRAP_BN_EXP_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_5, "TRAP_BN_EXP_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_6, "TRAP_BN_EXP_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_COMPLETE, "TRAP_BN_EXP_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_1, "TRAP_BN_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_2, "TRAP_BN_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_3, "TRAP_BN_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_4, "TRAP_BN_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_5, "TRAP_BN_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MOD_COMPLETE, "TRAP_BN_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_1, "TRAP_BN_ADD_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_2, "TRAP_BN_ADD_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_3, "TRAP_BN_ADD_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_4, "TRAP_BN_ADD_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_5, "TRAP_BN_ADD_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_6, "TRAP_BN_ADD_MOD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_7, "TRAP_BN_ADD_MOD_7"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_ADD_MOD_COMPLETE, "TRAP_BN_ADD_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_1, "TRAP_BN_SUB_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_2, "TRAP_BN_SUB_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_3, "TRAP_BN_SUB_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_4, "TRAP_BN_SUB_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_5, "TRAP_BN_SUB_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_6, "TRAP_BN_SUB_MOD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_SUB_MOD_COMPLETE, "TRAP_BN_SUB_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_1, "TRAP_BN_MUL_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_2, "TRAP_BN_MUL_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_3, "TRAP_BN_MUL_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_4, "TRAP_BN_MUL_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_5, "TRAP_BN_MUL_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_6, "TRAP_BN_MUL_MOD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_MUL_MOD_COMPLETE, "TRAP_BN_MUL_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_1, "TRAP_BN_EXP_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_2, "TRAP_BN_EXP_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_3, "TRAP_BN_EXP_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_4, "TRAP_BN_EXP_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_5, "TRAP_BN_EXP_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_6, "TRAP_BN_EXP_MOD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_EXP_MOD_COMPLETE, "TRAP_BN_EXP_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_1, "TRAP_BN_INV_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_2, "TRAP_BN_INV_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_3, "TRAP_BN_INV_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_4, "TRAP_BN_INV_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_5, "TRAP_BN_INV_MOD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_INV_MOD_COMPLETE, "TRAP_BN_INV_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_STR_1, "TRAP_INT_STR_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_STR_2, "TRAP_INT_STR_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_STR_COMPLETE, "TRAP_INT_STR_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_ADD_1, "TRAP_INT_ADD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_ADD_2, "TRAP_INT_ADD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_ADD_3, "TRAP_INT_ADD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_ADD_4, "TRAP_INT_ADD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_ADD_COMPLETE, "TRAP_INT_ADD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_SUB_1, "TRAP_INT_SUB_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_SUB_2, "TRAP_INT_SUB_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_SUB_3, "TRAP_INT_SUB_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_SUB_4, "TRAP_INT_SUB_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_SUB_COMPLETE, "TRAP_INT_SUB_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_MUL_1, "TRAP_INT_MUL_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MUL_2, "TRAP_INT_MUL_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MUL_3, "TRAP_INT_MUL_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MUL_4, "TRAP_INT_MUL_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MUL_COMPLETE, "TRAP_INT_MUL_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_DIV_1, "TRAP_INT_DIV_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_DIV_2, "TRAP_INT_DIV_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_DIV_3, "TRAP_INT_DIV_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_DIV_4, "TRAP_INT_DIV_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_DIV_COMPLETE, "TRAP_INT_DIV_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_EXP_1, "TRAP_INT_EXP_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_EXP_2, "TRAP_INT_EXP_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_EXP_3, "TRAP_INT_EXP_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_EXP_4, "TRAP_INT_EXP_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_EXP_COMPLETE, "TRAP_INT_EXP_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_INT_MOD_1, "TRAP_INT_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MOD_2, "TRAP_INT_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MOD_3, "TRAP_INT_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MOD_4, "TRAP_INT_MOD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_INT_MOD_COMPLETE, "TRAP_INT_MOD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BN_POW2_MOD_1, "TRAP_BN_POW2_MOD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_POW2_MOD_2, "TRAP_BN_POW2_MOD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_POW2_MOD_3, "TRAP_BN_POW2_MOD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BN_POW2_COMPLETE, "TRAP_BN_POW2_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_1, "TRAP_ECCURVE_NEWKEYPAIR_1"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_2, "TRAP_ECCURVE_NEWKEYPAIR_2"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_3, "TRAP_ECCURVE_NEWKEYPAIR_3"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_4, "TRAP_ECCURVE_NEWKEYPAIR_4"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_5, "TRAP_ECCURVE_NEWKEYPAIR_5"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_6, "TRAP_ECCURVE_NEWKEYPAIR_6"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_7, "TRAP_ECCURVE_NEWKEYPAIR_7"); - PERF_STOP_MAPPING.put(PM.TRAP_ECCURVE_NEWKEYPAIR_COMPLETE, "TRAP_ECCURVE_NEWKEYPAIR_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_1, "TRAP_ECPOINT_ADD_1"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_2, "TRAP_ECPOINT_ADD_2"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_3, "TRAP_ECPOINT_ADD_3"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_4, "TRAP_ECPOINT_ADD_4"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_5, "TRAP_ECPOINT_ADD_5"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_6, "TRAP_ECPOINT_ADD_6"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_7, "TRAP_ECPOINT_ADD_7"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_8, "TRAP_ECPOINT_ADD_8"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_9, "TRAP_ECPOINT_ADD_9"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_10, "TRAP_ECPOINT_ADD_10"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_11, "TRAP_ECPOINT_ADD_11"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_12, "TRAP_ECPOINT_ADD_12"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_13, "TRAP_ECPOINT_ADD_13"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_ADD_COMPLETE, "TRAP_ECPOINT_ADD_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_1, "TRAP_ECPOINT_MULT_1"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_2, "TRAP_ECPOINT_MULT_2"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_3, "TRAP_ECPOINT_MULT_3"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_4, "TRAP_ECPOINT_MULT_4"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_5, "TRAP_ECPOINT_MULT_5"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_6, "TRAP_ECPOINT_MULT_6"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_7, "TRAP_ECPOINT_MULT_7"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_8, "TRAP_ECPOINT_MULT_8"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_9, "TRAP_ECPOINT_MULT_9"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_10, "TRAP_ECPOINT_MULT_10"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_11, "TRAP_ECPOINT_MULT_11"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_12, "TRAP_ECPOINT_MULT_12"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_COMPLETE, "TRAP_ECPOINT_MULT_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_1, "TRAP_ECPOINT_MULT_X_1"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_2, "TRAP_ECPOINT_MULT_X_2"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_3, "TRAP_ECPOINT_MULT_X_3"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_4, "TRAP_ECPOINT_MULT_X_4"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_5, "TRAP_ECPOINT_MULT_X_5"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_MULT_X_COMPLETE, "TRAP_ECPOINT_MULT_X_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_1, "TRAP_ECPOINT_NEGATE_1"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_2, "TRAP_ECPOINT_NEGATE_2"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_3, "TRAP_ECPOINT_NEGATE_3"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_4, "TRAP_ECPOINT_NEGATE_4"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_5, "TRAP_ECPOINT_NEGATE_5"); - PERF_STOP_MAPPING.put(PM.TRAP_ECPOINT_NEGATE_COMPLETE, "TRAP_ECPOINT_NEGATE_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_1, "TRAP_BIGNAT_SQRT_1"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_2, "TRAP_BIGNAT_SQRT_2"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_3, "TRAP_BIGNAT_SQRT_3"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_4, "TRAP_BIGNAT_SQRT_4"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_5, "TRAP_BIGNAT_SQRT_5"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_6, "TRAP_BIGNAT_SQRT_6"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_7, "TRAP_BIGNAT_SQRT_7"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_8, "TRAP_BIGNAT_SQRT_8"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_9, "TRAP_BIGNAT_SQRT_9"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_10, "TRAP_BIGNAT_SQRT_10"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_11, "TRAP_BIGNAT_SQRT_11"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_12, "TRAP_BIGNAT_SQRT_12"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_13, "TRAP_BIGNAT_SQRT_13"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_14, "TRAP_BIGNAT_SQRT_14"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_15, "TRAP_BIGNAT_SQRT_15"); - PERF_STOP_MAPPING.put(PM.TRAP_BIGNAT_SQRT_COMPLETE, "TRAP_BIGNAT_SQRT_COMPLETE"); - - PERF_STOP_MAPPING.put(PM.TRAP_EC_SETCURVE_1, "TRAP_EC_SETCURVE_1"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_SETCURVE_2, "TRAP_EC_SETCURVE_2"); - PERF_STOP_MAPPING.put(PM.TRAP_EC_SETCURVE_COMPLETE, "TRAP_EC_SETCURVE_COMPLETE"); - } - - public static String getPerfStopName(short stopID) { - if (PERF_STOP_MAPPING.containsKey(stopID)) { - return PERF_STOP_MAPPING.get(stopID); - } else { - assert (false); - return "PERF_UNDEFINED"; - } - } - - public static short getPerfStopFromName(String stopName) { - for (Short stopID : PERF_STOP_MAPPING.keySet()) { - if (PERF_STOP_MAPPING.get(stopID).equalsIgnoreCase(stopName)) { - return stopID; - } - } - assert (false); - return PM.TRAP_UNDEFINED; - } - - -} diff --git a/JCMathLibTests/src/opencrypto/test/RunConfig.java b/JCMathLibTests/src/opencrypto/test/RunConfig.java deleted file mode 100644 index e9402fb2..00000000 --- a/JCMathLibTests/src/opencrypto/test/RunConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -package opencrypto.test; - -import java.util.ArrayList; -import opencrypto.jcmathlib.OCUnitTests; - -/** - * - * @author Petr Svenda - */ -public class RunConfig { - int targetReaderIndex = 0; - public boolean bTestBN = true; - public boolean bTestINT = true; - public boolean bTestEC = true; - public boolean bTestECPoint = true; - public boolean bMeasureOnlyTargetOp = false; - public int numRepeats = 1; - public int bnBaseTestLength = 256; - public ArrayList failedTestsList = new ArrayList<>(); - public Class appletToSimulate; - - public enum CARD_TYPE { - PHYSICAL, JCOPSIM, JCARDSIMLOCAL, JCARDSIMREMOTE - } - public CARD_TYPE testCardType = CARD_TYPE.PHYSICAL; - - public static RunConfig getDefaultConfig() { - RunConfig runCfg = new RunConfig(); - runCfg.targetReaderIndex = 0; - runCfg.testCardType = CARD_TYPE.PHYSICAL; - runCfg.appletToSimulate = OCUnitTests.class; - - return runCfg; - } - public static RunConfig getConfigSimulator() { - RunConfig runCfg = new RunConfig(); - runCfg.targetReaderIndex = 0; - runCfg.testCardType = CARD_TYPE.JCARDSIMLOCAL; - runCfg.bTestBN = false; - runCfg.bTestINT = false; - runCfg.bTestEC = false; - runCfg.appletToSimulate = OCUnitTests.class; - return runCfg; - } - public static RunConfig getConfig(boolean bTestBN, boolean bTestINT, boolean bTestEC, int numRepeats, CARD_TYPE cardType) { - RunConfig runCfg = new RunConfig(); - runCfg.targetReaderIndex = 0; - runCfg.testCardType = cardType; - runCfg.bTestBN = bTestBN; - runCfg.bTestINT = bTestINT; - runCfg.bTestEC = bTestEC; - runCfg.numRepeats = numRepeats; - runCfg.appletToSimulate = OCUnitTests.class; - return runCfg; - } -} diff --git a/JCMathLibTests/src/opencrypto/test/SimulatedCard.java b/JCMathLibTests/src/opencrypto/test/SimulatedCard.java deleted file mode 100644 index 29a4d238..00000000 --- a/JCMathLibTests/src/opencrypto/test/SimulatedCard.java +++ /dev/null @@ -1,53 +0,0 @@ -package opencrypto.test; - -import javax.smartcardio.ATR; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; - -/** - * - * @author Petr Svenda - */ -public class SimulatedCard extends Card { - - @Override - public ATR getATR() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getProtocol() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public CardChannel getBasicChannel() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public CardChannel openLogicalChannel() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void beginExclusive() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void endExclusive() throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public byte[] transmitControlCommand(int i, byte[] bytes) throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void disconnect(boolean bln) throws CardException { - // do nothing - } -} diff --git a/JCMathLibTests/src/opencrypto/test/SimulatedCardChannelLocal.java b/JCMathLibTests/src/opencrypto/test/SimulatedCardChannelLocal.java deleted file mode 100644 index c2edf9d2..00000000 --- a/JCMathLibTests/src/opencrypto/test/SimulatedCardChannelLocal.java +++ /dev/null @@ -1,59 +0,0 @@ -package opencrypto.test; - -import com.licel.jcardsim.io.JavaxSmartCardInterface; -import java.nio.ByteBuffer; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -/** - * - * @author Petr Svenda - */ -public class SimulatedCardChannelLocal extends CardChannel { - JavaxSmartCardInterface m_simulator; - SimulatedCard m_card; - - SimulatedCardChannelLocal (JavaxSmartCardInterface simulator) { - m_simulator = simulator; - m_card = new SimulatedCard(); - } - - @Override - public Card getCard() { - return m_card; - } - - @Override - public int getChannelNumber() { - return 0; - } - - @Override - public ResponseAPDU transmit(CommandAPDU apdu) throws CardException { - ResponseAPDU responseAPDU = null; - - try { - responseAPDU = this.m_simulator.transmitCommand(apdu); - // TODO: Add delay corresponding to real cards - //int delay = OperationTimes.getCardOperationDelay(apdu); - //Thread.sleep(delay); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return responseAPDU; - } - - @Override - public int transmit(ByteBuffer bb, ByteBuffer bb1) throws CardException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void close() throws CardException { - m_simulator.reset(); - } -} diff --git a/JCMathLibTests/src/opencrypto/test/TestClient.java b/JCMathLibTests/src/opencrypto/test/TestClient.java deleted file mode 100644 index dfe13296..00000000 --- a/JCMathLibTests/src/opencrypto/test/TestClient.java +++ /dev/null @@ -1,818 +0,0 @@ -package opencrypto.test; - - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; - -import java.util.Map.Entry; - -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -import org.bouncycastle.jce.ECNamedCurveTable; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.math.ec.ECPoint; -import org.bouncycastle.jce.spec.ECParameterSpec; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.security.Security; -import java.util.HashMap; -import java.util.concurrent.ThreadLocalRandom; -import javacard.framework.ISO7816; -import opencrypto.jcmathlib.OCUnitTests; -import opencrypto.jcmathlib.SecP256r1; - -/** - * - * @author Vasilios Mavroudis and Petr Svenda - */ -public class TestClient { - public static boolean _FAIL_ON_ASSERT = false; - public static int NUM_OP_REPEATS = 1; - - // Base length of test inputs (in bits) which corresponds to same length of ECC - // E.g., if you like to test 256b ECC, operations with 256b Bignat numbers are performed - // Important: applet is compiled with MAX_BIGNAT_SIZE constant which must be large enough to hold intermediate computations. - // MAX_BIGNAT_SIZE constant must be at least 2*(ECC_BASE_TEST_LENGTH / 8) + 1. - public final static int BIGNAT_BASE_TEST_LENGTH = 256; - - public static boolean _TEST_BN = true; - public static boolean _TEST_INT = false; - public static boolean _TEST_EC = true; - - public static boolean _MEASURE_PERF = false; - public static boolean _MEASURE_PERF_ONLY_TARGET = true; - - - - static ArrayList> m_perfResults = new ArrayList<>(); - - public static String format = "%-40s:%s%n\n-------------------------------------------------------------------------------\n"; - - public static byte[] OPENCRYPTO_UNITTEST_APPLET_AID = {0x55, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, 0x74, 0x73}; - public static byte[] APDU_CLEANUP = {OCUnitTests.CLA_OC_UT, OCUnitTests.INS_CLEANUP, (byte) 0x00, (byte) 0x00, (byte) 0x00}; - public static byte[] APDU_GET_PROFILE_LOCKS = {OCUnitTests.CLA_OC_UT, OCUnitTests.INS_GET_PROFILE_LOCKS, (byte) 0x00, (byte) 0x00, (byte) 0x00}; - - - public static void main(String[] args) throws Exception { - try { - Integer targetReader = 0; - if (args.length > 0) { - targetReader = Integer.getInteger(args[0]); - } - - PerfTests perfTests = new PerfTests(); - if (_MEASURE_PERF) { - RunConfig runCfg = RunConfig.getConfig(_TEST_BN, _TEST_INT, _TEST_EC, NUM_OP_REPEATS, RunConfig.CARD_TYPE.PHYSICAL); - runCfg.numRepeats = 1; - runCfg.targetReaderIndex = targetReader; - perfTests.RunPerformanceTests(runCfg); - } - else if (_MEASURE_PERF_ONLY_TARGET) { - RunConfig runCfg = RunConfig.getConfig(_TEST_BN, _TEST_INT, _TEST_EC, NUM_OP_REPEATS, RunConfig.CARD_TYPE.PHYSICAL); - runCfg.targetReaderIndex = targetReader; - runCfg.bMeasureOnlyTargetOp = true; - perfTests.RunPerformanceTests(runCfg); - } - else { - RunConfig runCfg = RunConfig.getConfig(_TEST_BN, _TEST_INT, _TEST_EC, NUM_OP_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - runCfg.targetReaderIndex = targetReader; - - // First run debug operations on simulator and real card (if any) -/* OpenCryptoFunctionalTests_debug(runCfg); - runCfg.failedTestsList.clear(); - runCfg.testCardType = RunConfig.CARD_TYPE.PHYSICAL; - OpenCryptoFunctionalTests_debug(runCfg); - runCfg.failedTestsList.clear(); -*/ - // Run standard tests on simulator then real card (if any) - //runCfg.testCardType = RunConfig.CARD_TYPE.JCARDSIMLOCAL; - //OpenCryptoFunctionalTests(runCfg); - //runCfg.failedTestsList.clear(); - runCfg.testCardType = RunConfig.CARD_TYPE.PHYSICAL; - OpenCryptoFunctionalTests(runCfg); - runCfg.failedTestsList.clear(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static boolean OpenCryptoFunctionalTests(RunConfig runCfg) throws Exception { - try { - CardManager cardMngr = new CardManager(true, OPENCRYPTO_UNITTEST_APPLET_AID); - - System.out.print("Connecting to card..."); - if (!cardMngr.Connect(runCfg)) { - return false; - } - System.out.println(" Done."); - - System.out.println("\n--------------Unit Tests--------------"); - - CommandAPDU cmd; - ResponseAPDU response; - String operationName = ""; - boolean bResult = false; - - m_perfResults.clear(); - String logFileName = String.format("OC_PERF_log_%d.csv", System.currentTimeMillis()); - FileOutputStream perfFile = new FileOutputStream(logFileName); - - cardMngr.transmit(new CommandAPDU(PerfTests.PERF_COMMAND_NONE)); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - - // Obtain allocated bytes in RAM and EEPROM - byte[] bogusArray = new byte[1]; // Bogus array with single zero byte - NXP J3H145G P60 fails when no data are provided - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_GET_ALLOCATOR_STATS, 0, 0, bogusArray); - response = cardMngr.transmit(cmd); - byte[] data = response.getData(); - System.out.println(String.format("Data allocator: RAM = %d, EEPROM = %d", Util.getShort(data, (short) 0), Util.getShort(data, (short) 2))); - // Print memory snapshots from allocation - for (int offset = 4; offset < data.length; offset += 6) { - System.out.println(String.format("Tag '%d': RAM = %d, EEPROM = %d", Util.getShort(data, offset), Util.getShort(data, (short) (offset + 2)), Util.getShort(data, (short) (offset + 4)))); - } - - if (runCfg.bTestBN) { - operationName = "BigNatural Storage: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_STR, 0, 0, num.toByteArray()); - performCommand(operationName, cardMngr, cmd, num, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Addition: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH - 1);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH - 1);//Generate Int2 - BigInteger result = num1.add(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_ADD, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Subtraction: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH - 1);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH - 1);//Generate Int2 - BigInteger result = num1.subtract(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_SUB, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Multiplication: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger result = num1.multiply(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Multiplication schoolbook: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger result = num1.multiply(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL_SCHOOL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Exponentiation: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH / 4); //Generate Int1 - BigInteger num2 = BigInteger.valueOf(3); //Generate Int2 - BigInteger result = num1.pow(3); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_EXP, num1.toByteArray().length, result.toByteArray().length, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - - operationName = "BigNatural Modulo: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH - 1);//Generate Int2 - BigInteger result = num1.mod(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MOD, (num1.toByteArray()).length, 0, Util.concat((num1.toByteArray()), (num2.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } -/* - operationName = "BigNatural sqrt_FP: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(256);//Generate Int1 - BigInteger resSqrt = tonelli_shanks(num1, new BigInteger(1, SecP256r1.p)); - cmd = new CommandAPDU(Configuration.CLA_MPC, Configuration.INS_BN_SQRT, (num1.toByteArray()).length, 0,num1.toByteArray()); - performCommand(operationName, cardMngr, cmd, resSqrt, perfFile, true); - } -/**/ - operationName = "BigNatural Addition (Modulo): "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger num3 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH / 8);//Generate Int3 - BigInteger result = (num1.add(num2)).mod(num3); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_ADD_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } - - operationName = "BigNatural Subtraction (Modulo): "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger num3 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH / 8);//Generate Int3 - BigInteger result = (num1.subtract(num2)).mod(num3); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_SUB_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } - - operationName = "BigNatural Multiplication (Modulo): "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger num3 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH / 8);//Generate Int3 - BigInteger result = (num1.multiply(num2)).mod(num3); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL_MOD, (num1.toByteArray()).length, (num2.toByteArray()).length, Util.concat((num1.toByteArray()), (num2.toByteArray()), (num3.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } - - operationName = "BigNatural Exponentiation (Modulo): "; - int power = 2; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH); //Generate Int1 (base) - BigInteger num2 = BigInteger.valueOf(power); //Generate Int2 (exp) - BigInteger num3 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int3 (mod) - BigInteger result = (num1.modPow(num2, num3)); - System.out.println(String.format("num1: %s", num1.toString(16))); - System.out.println(String.format("num2: %s", num2.toString(16))); - System.out.println(String.format("num3: %s", num3.toString(16))); - - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_EXP_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(num2.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()), Util.trimLeadingZeroes(num3.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } - - operationName = "BigNatural Power2 (Modulo): "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH); //Generate Int1 (base) - BigInteger mod = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int3 (mod) - BigInteger result = (num1.modPow(BigInteger.valueOf(2), mod)); - - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_POW2_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(mod.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList, true); - } - - operationName = "BigNatural Inversion (Modulo): "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH + BIGNAT_BASE_TEST_LENGTH / 2); //Generate base - BigInteger num2 = new BigInteger(1,SecP256r1.p);//Generate mod - BigInteger num3 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int3 (mod) - System.out.println(String.format("num1: %s", num1.toString(16))); - System.out.println(String.format("num2: %s", num2.toString(16))); - System.out.println(String.format("num3: %s", num3.toString(16))); - BigInteger result = num1.modInverse(num2).multiply(num1).mod(num3); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_INV_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, 0, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()))); - response = cardMngr.transmit(cmd); - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - BigInteger respInt = new BigInteger(1, response.getData()).multiply(num1).mod(num3); - bResult = result.compareTo(respInt) == 0; - - if (!bResult) { - System.out.println(String.format("Expected: %s", result.toString(16))); - System.out.println(String.format("Obtained: %s", respInt.toString(16))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - logResponse(operationName, bResult, cardMngr.m_lastTransmitTime, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - } - - if (runCfg.bTestINT) { - operationName = "Integer Storage: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_STR, 0, 0, Util.IntToBytes(num)); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "Integer Addition: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num_add_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_add_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - //num_add_1 = Integer.MAX_VALUE; - //num_add_2 = Integer.MAX_VALUE; - int num_add = num_add_1 + num_add_2; - - //System.out.println("op1 : " + bytesToHex(Util.IntToBytes(num_add_1))); - //System.out.println("op2 : " + bytesToHex(Util.IntToBytes(num_add_2))); - //System.out.println("result: " + bytesToHex(Util.IntToBytes(num_add))); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_ADD, Util.IntToBytes(num_add_1).length, 0, Util.concat(Util.IntToBytes(num_add_1), Util.IntToBytes(num_add_2))); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num_add, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "Integer Subtraction: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num_sub_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_sub_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - //num_sub_1 = Integer.MAX_VALUE-1; - //num_sub_2 = Integer.MAX_VALUE; - int num_sub = num_sub_1 - num_sub_2; - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_SUB, Util.IntToBytes(num_sub_1).length, 0, Util.concat(Util.IntToBytes(num_sub_1), Util.IntToBytes(num_sub_2))); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num_sub, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "Integer Multiplication: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num_mul_1 = ThreadLocalRandom.current().nextInt((int) (Math.sqrt(Integer.MIN_VALUE)), (int) (Math.sqrt(Integer.MAX_VALUE))); - int num_mul_2 = ThreadLocalRandom.current().nextInt((int) (Math.sqrt(Integer.MIN_VALUE)), (int) (Math.sqrt(Integer.MAX_VALUE))); - - //Avoid overflows - int num_mul = 0; //(java int may overflow!!) - while (num_mul == 0) { - try { - num_mul = Math.multiplyExact(num_mul_1, num_mul_2); - //num_mul = 6; - } catch (Exception e) { // or your specific exception - } - - } - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_MUL, Util.IntToBytes(num_mul_1).length, 0, Util.concat(Util.IntToBytes(num_mul_1), Util.IntToBytes(num_mul_2))); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num_mul, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - - operationName = "Integer Division: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num_div_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_div_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_div = num_div_1 / num_div_2; - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_DIV, Util.IntToBytes(num_div_1).length, 0, Util.concat(Util.IntToBytes(num_div_1), Util.IntToBytes(num_div_2))); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num_div, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - /* - //14^8 is quite/very close to the max integer value - System.out.print("Integer Exponentiation: "); - int base = ThreadLocalRandom.current().nextInt(-14, 14); - int exp = ThreadLocalRandom.current().nextInt(-8, 8); - int num_exp = Math.pow(base, exp); - cmd = new CommandAPDU(Configuration.CLA_MPC, Configuration.INS_INT_DIV, Util.IntToBytes(num_div_1).length, 0, Util.concat(Util.IntToBytes(num_div_1), Util.IntToBytes(num_div_2))); - response = transmit(cmd); - System.out.println(BytesToInt(response.getData())==num_div); } - */ - - operationName = "Integer Modulo: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - int num_mod_1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_mod_2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - int num_mod = num_mod_1 % num_mod_2; - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_INT_MOD, Util.IntToBytes(num_mod_1).length, 0, Util.concat(Util.IntToBytes(num_mod_1), Util.IntToBytes(num_mod_2))); - response = cardMngr.transmit(cmd); - verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, num_mod, perfFile, runCfg.failedTestsList); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - } - - if (runCfg.bTestEC) { - operationName = "EC Point Generation: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_GEN, 0, 0, bogusArray); - response = cardMngr.transmit(cmd); - PerfTests.writePerfLog(operationName, response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff), cardMngr.m_lastTransmitTime, m_perfResults, perfFile); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "EC Point Add: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - ECPoint pnt_1 = Util.randECPoint(); - ECPoint pnt_2 = Util.randECPoint(); - ECPoint pnt_sum = pnt_1.add(pnt_2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_ADD, 0, 0, Util.concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))); - response = cardMngr.transmit(cmd); - - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Arrays.equals(pnt_sum.getEncoded(false), response.getData()); - - if (!bResult) { - System.out.println(String.format("Expected: %s", Util.toHex(pnt_sum.getEncoded(false)))); - System.out.println(String.format("Obtained: %s", Util.toHex(response.getData()))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - - logResponse(operationName, bResult, cardMngr.m_lastTransmitTime, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "ECPoint Negation: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - ECPoint pnt = Util.randECPoint(); - ECPoint negPnt = pnt.negate(); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_NEG, pnt.getEncoded(false).length, 0, pnt.getEncoded(false)); - response = cardMngr.transmit(cmd); - bResult = verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, negPnt, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "EC scalar_Point Multiplication: "; - Security.addProvider(new BouncyCastleProvider()); - ECParameterSpec ecSpec2 = ECNamedCurveTable.getParameterSpec("secp256r1"); - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - // NOTE: we will keep G same (standard), just keep changing the scalar. - // If you want to test different G, INS_EC_SETCURVE_G must be called before same as for EC Point Double. - ECPoint base = ecSpec2.getG(); - BigInteger priv1 = Util.randomBigNat(256); - ECPoint pub = base.multiply(priv1); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_MUL, priv1.toByteArray().length, 0, Util.concat(priv1.toByteArray(), base.getEncoded(false))); - response = cardMngr.transmit(cmd); - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Arrays.equals(pub.getEncoded(false), response.getData()); - if (!bResult) { - System.out.println(String.format("Expected: %s", Util.toHex(pub.getEncoded(false)))); - System.out.println(String.format("Obtained: %s", Util.toHex(response.getData()))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - logResponse(operationName, bResult, cardMngr.m_lastTransmitTime, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "EC isEqual: "; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - ECPoint pnt_1 = Util.randECPoint(); - ECPoint pnt_2 = Util.randECPoint(); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_COMPARE, pnt_1.getEncoded(false).length, pnt_2.getEncoded(false).length, Util.concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))); - response = cardMngr.transmit(cmd); - bResult = verifyAndLogResponse(operationName, response, cardMngr.m_lastTransmitTime, 0, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - operationName = "EC Point Double: "; - Security.addProvider(new BouncyCastleProvider()); - //ECParameterSpec ecSpec2 = ECNamedCurveTable.getParameterSpec("secp256r1"); - boolean bSetRandomG = true; - boolean bReallocateWholeCurve = false; - for (int repeat = 0; repeat < runCfg.numRepeats; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - ECPoint pnt; - if (bSetRandomG) { - pnt = Util.randECPoint(); - System.out.println(String.format("Random ECPoint == G: %s", Util.toHex(pnt.getEncoded(false)))); - // Set modified parameter G of the curve (our random point) - cardMngr.transmit(new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_SETCURVE_G, pnt.getEncoded(false).length, bReallocateWholeCurve ? (byte) 1 : (byte) 0, pnt.getEncoded(false))); - } else { - pnt = ecSpec2.getG(); - } - - ECPoint doubled = pnt.add(pnt); // expected results - // Perform EC double operation - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_EC_DBL, 0, 0, pnt.getEncoded(false)); - try { - response = cardMngr.transmit(cmd); - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Arrays.equals(doubled.getEncoded(false), response.getData()); - if (!bResult) { - System.out.println(String.format("Expected: %s", Util.toHex(doubled.getEncoded(false)))); - System.out.println(String.format("Obtained: %s", Util.toHex(response.getData()))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - } catch (Exception e) { - bResult = false; - e.printStackTrace(); - } - logResponse(operationName, bResult, cardMngr.m_lastTransmitTime, perfFile, runCfg.failedTestsList); - if (!bResult) { - String failedAPDU = formatFailedAPDUCmd(cmd); - runCfg.failedTestsList.add(failedAPDU); - } - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - } - } - - System.out.println("\n--------------Unit Tests--------------\n\n"); - - cardMngr.transmit(new CommandAPDU(APDU_GET_PROFILE_LOCKS)); - - - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); - System.out.println(" Done."); - - if (runCfg.failedTestsList.size() > 0) { - System.out.println("#########################"); - System.out.println("!!! SOME TESTS FAILED !!!"); - System.out.println("#########################"); - for (String test : runCfg.failedTestsList) { - System.out.println(test); - } - - printFailedTestStats(runCfg); - - } - else { - System.out.println("##########################"); - System.out.println("ALL TESTS PASSED CORRECTLY"); - System.out.println("##########################"); - } - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } - - - static void OpenCryptoFunctionalTests_debug(RunConfig runCfg) throws Exception { - try { - CardManager cardMngr = new CardManager(true, OPENCRYPTO_UNITTEST_APPLET_AID); - System.out.print("Connecting to card..."); - cardMngr.Connect(runCfg); - System.out.println(" Done."); - - m_perfResults.clear(); - - cardMngr.transmit(new CommandAPDU(PerfTests.PERF_COMMAND_NONE)); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - - String logFileName = String.format("OC_PERF_log_%d.csv", System.currentTimeMillis()); - FileOutputStream perfFile = new FileOutputStream(logFileName); - - CommandAPDU cmd; - ResponseAPDU response; - String operationName = ""; - boolean bResult = false; - - - System.out.println("\n-------------- Problematic inputs tests --------------"); -/* - // TODO: add code for debugging - operationName = "BigNatural Multiplication schoolbook: "; - for (int repeat = 0; repeat < 10; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - BigInteger num1 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int1 - BigInteger num2 = Util.randomBigNat(BIGNAT_BASE_TEST_LENGTH);//Generate Int2 - BigInteger result = num1.multiply(num2); - cmd = new CommandAPDU(OCUnitTests.CLA_OC_UT, OCUnitTests.INS_BN_MUL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); - performCommand(operationName, cardMngr, cmd, result, perfFile, runCfg.failedTestsList); - } - int a=0; -/* - operationName = "EC Point Add: "; - for (int repeat = 0; repeat < 1000000; repeat++) { - System.out.println(String.format("%s (%d)", operationName, repeat)); - ECPoint pnt_1 = Util.randECPoint(); - ECPoint pnt_2 = Util.randECPoint(); - ECPoint pnt_sum = pnt_1.add(pnt_2); - cmd = new CommandAPDU(Consts.CLA_OC_UT, Consts.INS_EC_ADD, 0, 0, Util.concat(pnt_1.getEncoded(false), pnt_2.getEncoded(false))); - response = cardMngr.transmit(cmd); - - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - byte[] x = pnt_sum.getXCoord().getEncoded(); - byte[] y = pnt_sum.getYCoord().getEncoded(); - x = pnt_sum.getEncoded(false); - bResult = Arrays.equals(pnt_sum.getEncoded(false), response.getData()); - - if (!bResult) { - System.out.println(String.format("Expected: %s", Util.toHex(pnt_sum.getEncoded(false)))); - System.out.println(String.format("Obtained: %s", Util.toHex(response.getData()))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - } -*/ - - System.out.println("\n-------------- Problematic inputs tests --------------\n\n"); - - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); - System.out.println(" Done."); - - if (runCfg.failedTestsList.size() > 0) { - System.out.println("#########################"); - System.out.println("!!! SOME TESTS FAILED !!!"); - System.out.println("#########################"); - for (String test : runCfg.failedTestsList) { - System.out.println(test); - } - - printFailedTestStats(runCfg); - } else { - System.out.println("##########################"); - System.out.println("ALL TESTS PASSED CORRECTLY"); - System.out.println("##########################"); - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - static HashMap printFailedTestStats(RunConfig runCfg) { - // Parse failed tests, output statistics - HashMap numFailsTest = new HashMap<>(); - for (String test : runCfg.failedTestsList) { - if (!test.contains("failedCommand")) { // ignore output of apdu - if (numFailsTest.containsKey(test)) { - Integer count = numFailsTest.get(test); - count++; - numFailsTest.replace(test, count); - } else { - numFailsTest.put(test, 1); - } - } - } - - System.out.println("\n***FAILED TESTS STATS***"); - for (String test : numFailsTest.keySet()) { - System.out.println(String.format("%40s: %d / %d", test, numFailsTest.get(test), runCfg.numRepeats)); - } - System.out.println("************************\n"); - - return numFailsTest; - } - - - interface CmdResultsComparator { - public boolean compare(ResponseAPDU response); - } - - class ArrayMatchComparator implements CmdResultsComparator { - ECPoint m_expected = null; - ArrayMatchComparator(ECPoint expected) { - this.m_expected = expected; - } - public boolean compare(ResponseAPDU response) { - boolean bResult = false; - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Arrays.equals(m_expected.getEncoded(false), response.getData()); - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - return bResult; - } - } - - static String formatFailedAPDUCmd(CommandAPDU failedCommand) { - // If command corectness verification failed, then output for easy resend during debugging later - byte[] failedcmd = failedCommand.getBytes(); - String failedAPDU = String.format("\tcardMngr.transmit(new CommandAPDU(hexStringToByteArray(\"%s\")));", Util.bytesToHex(failedcmd)); - failedAPDU += "\n\tstatic byte[] failedCommand = {"; - for (int i = 0; i < failedcmd.length; i++) { - failedAPDU += String.format("(byte) 0x%x", failedcmd[i]); - if (i != failedcmd.length - 1) { - failedAPDU += ", "; - } - } - failedAPDU += "};"; - failedAPDU += "\n\t"; - - return failedAPDU; - } - static void performCommand(String operationName, CardManager cardManager, CommandAPDU command, BigInteger expectedResult, FileOutputStream perfFile, ArrayList failedTestsList) throws CardException, IOException { - performCommand(operationName, cardManager, command, expectedResult, perfFile, failedTestsList, false); - } - - static void performCommand(String operationName, CardManager cardManager, CommandAPDU command, BigInteger expectedResult, FileOutputStream perfFile, ArrayList failedTestsList, boolean bSigNum) throws CardException, IOException { - ResponseAPDU response = cardManager.transmit(command); - boolean bSuccess = false; - - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - byte[] data = response.getData(); - BigInteger respInt; - if (bSigNum) { respInt = new BigInteger(1, data); } - else { respInt = new BigInteger(data); } - - bSuccess = expectedResult.compareTo(respInt) == 0; - - if (!bSuccess) { - System.out.println(String.format("Expected: %s", expectedResult.toString(16))); - System.out.println(String.format("Obtained: %s", respInt.toString(16))); - } - } else { - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - - logResponse(operationName, bSuccess, cardManager.m_lastTransmitTime, perfFile, failedTestsList); - - if (!bSuccess) { - String failedAPDU = formatFailedAPDUCmd(command); - failedTestsList.add(failedAPDU); - } - - cardManager.transmit(new CommandAPDU(APDU_CLEANUP)); - } - - static boolean verifyAndLogResponse(String operationName, ResponseAPDU response, Long lastTransmitTime, int expected, FileOutputStream perfFile, ArrayList failedTestsList) throws IOException { - boolean bResult = false; - if (response.getSW () == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Util.BytesToInt(response.getData()) == expected; - } - else { - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - logResponse(operationName, bResult, lastTransmitTime, perfFile, failedTestsList); - return bResult; - } - static boolean verifyAndLogResponse(String operationName, ResponseAPDU response, Long lastTransmitTime, ECPoint expected, FileOutputStream perfFile, ArrayList failedTestsList) throws IOException { - boolean bResult = false; - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - bResult = Arrays.equals(expected.getEncoded(false), response.getData()); - if (!bResult) { - System.out.println(String.format("Expected: %s", Util.toHex(expected.getEncoded(false)))); - System.out.println(String.format("Obtained: %s", Util.toHex(response.getData()))); - } - } else { - bResult = false; - System.out.println(String.format("fail (0x%x)", response.getSW())); - } - logResponse(operationName, bResult, lastTransmitTime, perfFile, failedTestsList); - return bResult; - } - - static void logResponse(String operationName, boolean bResult, Long lastTransmitTime, FileOutputStream perfFile, ArrayList failedTestsList) throws IOException { - System.out.println(String.format("%s [%d ms]", bResult, lastTransmitTime)); - if (bResult == false && _FAIL_ON_ASSERT) { - assert (bResult); - } - if (bResult == false) { - // Add name of failed operation - failedTestsList.add(operationName); - } - PerfTests.writePerfLog(operationName, bResult, lastTransmitTime, m_perfResults, perfFile); - } - -} - - - - - - - diff --git a/JCMathLibTests/src/opencrypto/test/Util.java b/JCMathLibTests/src/opencrypto/test/Util.java deleted file mode 100644 index 28d02fdd..00000000 --- a/JCMathLibTests/src/opencrypto/test/Util.java +++ /dev/null @@ -1,348 +0,0 @@ -package opencrypto.test; - -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.Security; -import java.util.Arrays; -import java.util.Random; -import javacard.framework.ISO7816; -import javax.smartcardio.ResponseAPDU; -import org.bouncycastle.jce.ECNamedCurveTable; -import org.bouncycastle.jce.interfaces.ECPublicKey; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.jce.spec.ECParameterSpec; -import org.bouncycastle.math.ec.ECCurve; -import org.bouncycastle.math.ec.ECPoint; - -/** - * - * @author Vasilios Mavroudis and Petr Svenda - */ -public class Util { - - public static String toHex(byte[] bytes) { - return toHex(bytes, 0, bytes.length); - } - - public static String toHex(byte[] bytes, int offset, int len) { - // StringBuilder buff = new StringBuilder(); - String result = ""; - - for (int i = offset; i < offset + len; i++) { - result += String.format("%02X", bytes[i]); - } - - return result; - } - - public static String bytesToHex(byte[] bytes) { - char[] hexArray = "0123456789ABCDEF".toCharArray(); - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - return new String(hexChars); - } - - - /* Utils */ - public static short getShort(byte[] buffer, int offset) { - return ByteBuffer.wrap(buffer, offset, 2).order(ByteOrder.BIG_ENDIAN).getShort(); - } - - public static short readShort(byte[] data, int offset) { - return (short) (((data[offset] << 8)) | ((data[offset + 1] & 0xff))); - } - - public static byte[] shortToByteArray(int s) { - return new byte[]{(byte) ((s & 0xFF00) >> 8), (byte) (s & 0x00FF)}; - } - - - public static byte[] joinArray(byte[]... arrays) { - int length = 0; - for (byte[] array : arrays) { - length += array.length; - } - - final byte[] result = new byte[length]; - - int offset = 0; - for (byte[] array : arrays) { - System.arraycopy(array, 0, result, offset, array.length); - offset += array.length; - } - - return result; - } - - public static byte[] trimLeadingZeroes(byte[] array) { - short startOffset = 0; - for (int i = 0; i < array.length; i++) { - if (array[i] != 0) { - break; - } else { - // still zero - startOffset++; - } - } - - byte[] result = new byte[array.length - startOffset]; - System.arraycopy(array, startOffset, result, 0, array.length - startOffset); - return result; - } - - public static byte[] concat(byte[] a, byte[] b) { - int aLen = a.length; - int bLen = b.length; - byte[] c = new byte[aLen + bLen]; - System.arraycopy(a, 0, c, 0, aLen); - System.arraycopy(b, 0, c, aLen, bLen); - return c; - } - - public static byte[] concat(byte[] a, byte[] b, byte[] c) { - byte[] tmp_conc = concat(a, b); - return concat(tmp_conc, c); - - } - - - public static ECPoint randECPoint() throws Exception { - Security.addProvider(new BouncyCastleProvider()); - - ECParameterSpec ecSpec_named = ECNamedCurveTable.getParameterSpec("secp256r1"); // NIST P-256 - KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECDSA", "BC"); - kpg.initialize(ecSpec_named); - KeyPair apair = kpg.generateKeyPair(); - ECPublicKey apub = (ECPublicKey) apair.getPublic(); - return apub.getQ(); - } - - public static byte[] IntToBytes(int val) { - byte[] data = new byte[5]; - if (val < 0) { - data[0] = 0x01; - } else { - data[0] = 0x00; - } - - int unsigned = Math.abs(val); - data[1] = (byte) (unsigned >>> 24); - data[2] = (byte) (unsigned >>> 16); - data[3] = (byte) (unsigned >>> 8); - data[4] = (byte) unsigned; - - return data; - } - - public static int BytesToInt(byte[] data) { - int val = (data[1] << 24) - | ((data[2] & 0xFF) << 16) - | ((data[3] & 0xFF) << 8) - | (data[4] & 0xFF); - - if (data[0] == 0x01) { - val = val * -1; - } - - return val; - } - - private static boolean checkSW(ResponseAPDU response) { - if (response.getSW() != (ISO7816.SW_NO_ERROR & 0xffff)) { - System.err.printf("Received error status: %02X.\n", - response.getSW()); - return false; - } - return true; - } - - public static byte[] hexStringToByteArray(String s) { - String sanitized = s.replace(" ", ""); - byte[] b = new byte[sanitized.length() / 2]; - for (int i = 0; i < b.length; i++) { - int index = i * 2; - int v = Integer.parseInt(sanitized.substring(index, index + 2), 16); - b[i] = (byte) v; - } - return b; - } - - - /** - * *Math Stuff** - */ - public static BigInteger randomBigNat(int maxNumBitLength) { - Random rnd = new Random(); - BigInteger aRandomBigInt; - while (true) { - do { - aRandomBigInt = new BigInteger(maxNumBitLength, rnd); - - } while (aRandomBigInt.compareTo(new BigInteger("1")) < 1); - - if ((Util.trimLeadingZeroes(aRandomBigInt.toByteArray()).length != maxNumBitLength / 8) || (aRandomBigInt.toByteArray()).length != maxNumBitLength / 8) { - // After serialization, number is longer or shorter - generate new one - } else { - // We have proper number - return aRandomBigInt; - } - } - } - - public static byte[] SerializeBigInteger(BigInteger BigInt) { - - int bnlen = BigInt.bitLength() / 8; - - byte[] large_int_b = new byte[bnlen]; - Arrays.fill(large_int_b, (byte) 0); - int int_len = BigInt.toByteArray().length; - if (int_len == bnlen) { - large_int_b = BigInt.toByteArray(); - } else if (int_len > bnlen) { - large_int_b = Arrays.copyOfRange(BigInt.toByteArray(), int_len - - bnlen, int_len); - } else if (int_len < bnlen) { - System.arraycopy(BigInt.toByteArray(), 0, large_int_b, - large_int_b.length - int_len, int_len); - } - - return large_int_b; - } - - public static long pow_mod(long x, long n, long p) { - if (n == 0) { - return 1; - } - if ((n & 1) == 1) { - return (pow_mod(x, n - 1, p) * x) % p; - } - x = pow_mod(x, n / 2, p); - return (x * x) % p; - } - - /* Takes as input an odd prime p and n < p and returns r - * such that r * r = n [mod p]. */ - public static BigInteger tonelli_shanks(BigInteger n, BigInteger p) { - - //1. By factoring out powers of 2, find Q and S such that p-1=Q2^S p-1=Q*2^S and Q is odd - BigInteger p_1 = p.subtract(BigInteger.ONE); - BigInteger S = BigInteger.ZERO; - BigInteger Q = p_1; - - BigInteger two = BigInteger.valueOf(2); - - while (Q.mod(two).compareTo(BigInteger.ONE) != 0) { //while Q is not odd - Q = Q.divide(two); - //Q = p_1.divide(two.modPow(S, p)); - S = S.add(BigInteger.ONE); - } - - //2. Find the first quadratic non-residue z by brute-force search - BigInteger z = BigInteger.ONE; - while (z.modPow(p_1.divide(BigInteger.valueOf(2)), p).compareTo(p_1) != 0) { - z = z.add(BigInteger.ONE); - } - - System.out.println("n (y^2) : " + Util.bytesToHex(n.toByteArray())); - System.out.println("Q : " + Util.bytesToHex(Q.toByteArray())); - System.out.println("S : " + Util.bytesToHex(S.toByteArray())); - - BigInteger R = n.modPow(Q.add(BigInteger.ONE).divide(BigInteger.valueOf(2)), p); - BigInteger c = z.modPow(Q, p); - BigInteger t = n.modPow(Q, p); - BigInteger M = S; - - while (t.compareTo(BigInteger.ONE) != 0) { - BigInteger tt = t; - BigInteger i = BigInteger.ZERO; - while (tt.compareTo(BigInteger.ONE) != 0) { - System.out.println("t : " + tt.toString()); - tt = tt.multiply(tt).mod(p); - i = i.add(BigInteger.ONE); - //if (i.compareTo(m)==0) return BigInteger.ZERO; - } - - BigInteger M_i_1 = M.subtract(i).subtract(BigInteger.ONE); - System.out.println("M : " + M.toString()); - System.out.println("i : " + i.toString()); - System.out.println("M_i_1: " + M_i_1.toString()); - System.out.println("==================="); - BigInteger b = c.modPow(two.modPow(M_i_1, p_1), p); - BigInteger b2 = b.multiply(b).mod(p); - - R = R.multiply(b).mod(p); - c = b2; - t = t.multiply(b2).mod(p); - M = i; - } - - if (R.multiply(R).mod(p).compareTo(n) == 0) { - return R; - } else { - return BigInteger.ZERO; - } - } - - /* Takes as input an odd prime p and n < p and returns r - * such that r * r = n [mod p]. */ - public static BigInteger tonellishanks(BigInteger n, BigInteger p) { - //1. By factoring out powers of 2, find Q and S such that p-1=Q2^S p-1=Q*2^S and Q is odd - BigInteger p_1 = p.subtract(BigInteger.ONE); - BigInteger S = BigInteger.ZERO; - BigInteger Q = p_1; - - BigInteger two = BigInteger.valueOf(2); - - System.out.println("p : " + Util.bytesToHex(p.toByteArray())); - System.out.println("p is prime: " + p.isProbablePrime(10)); - System.out.println("n : " + Util.bytesToHex(n.toByteArray())); - System.out.println("Q : " + Util.bytesToHex(Q.toByteArray())); - System.out.println("S : " + Util.bytesToHex(S.toByteArray())); - - while (Q.mod(two).compareTo(BigInteger.ONE) != 0) { //while Q is not odd - Q = p_1.divide(two.modPow(S, p)); - S = S.add(BigInteger.ONE); - - //System.out.println("Iter n: " + bytesToHex(n.toByteArray())); - //System.out.println("Iter Q: " + bytesToHex(Q.toByteArray())); - //System.out.println("Iter S: " + bytesToHex(S.toByteArray())); - } - - //System.out.println("n: " + bytesToHex(n.toByteArray())); - //System.out.println("Q: " + bytesToHex(Q.toByteArray())); - //System.out.println("S: " + bytesToHex(S.toByteArray())); - return n; - } - - private static ECPoint ECPointDeSerialization(byte[] serialized_point, - int offset, int pointLength, ECCurve curve) { - - byte[] x_b = new byte[pointLength / 2]; - byte[] y_b = new byte[pointLength / 2]; - - // System.out.println("Serialized Point: " + toHex(serialized_point)); - // src -- This is the source array. - // srcPos -- This is the starting position in the source array. - // dest -- This is the destination array. - // destPos -- This is the starting position in the destination data. - // length -- This is the number of array elements to be copied. - System.arraycopy(serialized_point, offset + 1, x_b, 0, pointLength / 2); - BigInteger x = new BigInteger(bytesToHex(x_b), 16); - // System.out.println("X:" + toHex(x_b)); - System.arraycopy(serialized_point, offset + (pointLength / 2 + 1), y_b, 0, pointLength / 2); - BigInteger y = new BigInteger(bytesToHex(y_b), 16); - // System.out.println("Y:" + toHex(y_b)); - - ECPoint point = curve.createPoint(x, y); - - return point; - } - -} diff --git a/JCMathLibTests/test/JCMathLibTests.java b/JCMathLibTests/test/JCMathLibTests.java deleted file mode 100644 index 73e9055f..00000000 --- a/JCMathLibTests/test/JCMathLibTests.java +++ /dev/null @@ -1,535 +0,0 @@ -import javacard.framework.ISO7816; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import opencrypto.jcmathlib.ECExample; -import opencrypto.test.CardManager; -import opencrypto.test.PerfTests; -import opencrypto.test.RunConfig; -import opencrypto.test.Util; -import static opencrypto.test.Util.hexStringToByteArray; -import opencrypto.test.TestClient; -import static opencrypto.test.TestClient.APDU_CLEANUP; -import static opencrypto.test.TestClient.OPENCRYPTO_UNITTEST_APPLET_AID; -import static org.testng.Assert.*; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** - * - * @author Petr Svenda - */ -public class JCMathLibTests { - static final int SMALLTEST_NUM_REPEATS = 10; - static final int LARGETEST_NUM_REPEATS = 1000; - - public JCMathLibTests() { - } - - @Test - public void openCrypto_smallTest_simulator() throws Exception { - bignat_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - integer_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - ecc_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - } - @Test - public void openCrypto_largeTest_simulator() throws Exception { - bignat_tests(LARGETEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - integer_tests(LARGETEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - ecc_tests(LARGETEST_NUM_REPEATS, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - } - @Test - public void openCrypto_smallTest_realCard() throws Exception { - bignat_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.PHYSICAL); - integer_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.PHYSICAL); - ecc_tests(SMALLTEST_NUM_REPEATS, RunConfig.CARD_TYPE.PHYSICAL); - } - @Test - public void openCrypto_problemInputs_simulator() throws Exception { - bignat_problemInputs(RunConfig.CARD_TYPE.JCARDSIMLOCAL); - ecc_problemInputs(RunConfig.CARD_TYPE.JCARDSIMLOCAL); - } - @Test - public void openCrypto_problemInputs_realCard() throws Exception { - bignat_problemInputs(RunConfig.CARD_TYPE.PHYSICAL); - ecc_problemInputs(RunConfig.CARD_TYPE.PHYSICAL); - } - - public void bignat_tests(int numRepeats, RunConfig.CARD_TYPE cardType) throws Exception { - TestClient testClient = new TestClient(); - RunConfig runCfg = RunConfig.getConfig(true, false, false, numRepeats, cardType); - assertTrue(testClient.OpenCryptoFunctionalTests(runCfg)); - assertTrue(runCfg.failedTestsList.isEmpty()); - } - public void integer_tests(int numRepeats, RunConfig.CARD_TYPE cardType) throws Exception { - TestClient testClient = new TestClient(); - RunConfig runCfg = RunConfig.getConfig(false, true, false, numRepeats, cardType); - assertTrue(testClient.OpenCryptoFunctionalTests(runCfg)); - assertTrue(runCfg.failedTestsList.isEmpty()); - } - public void ecc_tests(int numRepeats, RunConfig.CARD_TYPE cardType) throws Exception { - TestClient testClient = new TestClient(); - RunConfig runCfg = RunConfig.getConfig(false, false, true, numRepeats, cardType); - assertTrue(testClient.OpenCryptoFunctionalTests(runCfg)); - assertTrue(runCfg.failedTestsList.isEmpty()); - } - - - void testAPDU(CardManager cardMngr, String input, String expectedOutput) { - try { - ResponseAPDU response = cardMngr.transmit(new CommandAPDU(hexStringToByteArray(input))); - if (response.getSW() == (ISO7816.SW_NO_ERROR & 0xffff)) { - if (!expectedOutput.isEmpty()) { - byte[] data = response.getData(); - String output = Util.bytesToHex(data); - assertTrue(expectedOutput.equalsIgnoreCase(output), "Result provided by card mismatch expected"); - } - } - else { - assertTrue(false, String.format("Card failed with 0x%x", response.getSW())); - } - } - catch (Exception e) { - e.printStackTrace(); - assertTrue(false, "Card transmit failed with execption"); - } - } - - public void ecc_problemInputs(RunConfig.CARD_TYPE cardType) { - try { - // Prepare card - RunConfig runCfg = RunConfig.getConfig(false, false, false, 1, cardType); - CardManager cardMngr = new CardManager(true, OPENCRYPTO_UNITTEST_APPLET_AID); - assertTrue(cardMngr.Connect(runCfg), "Failed to connect to card"); - cardMngr.transmit(new CommandAPDU(PerfTests.PERF_COMMAND_NONE)); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - - - // - // EC failure cases - // - - - /* EC ADD - --> B0420000820405AC28C3A153AA18E5F7B08C7C6992F517430CBCCBCA0DCAF7285599E495F7777CA85E1C9EC671D182DFEBEDE489FB625596CBD5886F649B23A0B2A982C77ABD045A55EC838109C2157862B4508421C288EDDD6CB63B4082763E59683E716C093033C0E616D1826904C5E91BB73A81A0DEF9042C621100E53CDBC9F92298E0FACD - <-- 049BC398A6EC46C801613DABD1EA4418901DF881EA4001677408208E85E1B8C87D3541C50B64BA9C6326746F177C10BFF061877725B5575678E49041F7E3254284 9000 (65) [1 ms] - Expected: 04C4F9B065A7B13806F5653333AE5F79F009029F897A3C7BB67FBBE4740835BA21209D14FF7D9BFE018CA4875C64ED6461732D6E49F4684691CCA825D02740A79D - Obtained: 049BC398A6EC46C801613DABD1EA4418901DF881EA4001677408208E85E1B8C87D3541C50B64BA9C6326746F177C10BFF061877725B5575678E49041F7E3254284 - */ - testAPDU(cardMngr, "B0420000820405AC28C3A153AA18E5F7B08C7C6992F517430CBCCBCA0DCAF7285599E495F7777CA85E1C9EC671D182DFEBEDE489FB625596CBD5886F649B23A0B2A982C77ABD045A55EC838109C2157862B4508421C288EDDD6CB63B4082763E59683E716C093033C0E616D1826904C5E91BB73A81A0DEF9042C621100E53CDBC9F92298E0FACD", - "04C4F9B065A7B13806F5653333AE5F79F009029F897A3C7BB67FBBE4740835BA21209D14FF7D9BFE018CA4875C64ED6461732D6E49F4684691CCA825D02740A79D"); - - /* requires complete reallocation of ECCurve and ECPoint with new G - ECPoint_double with random point: - Random ECPoint == G: 04E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A - --> B04500004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A - <-- 9000 [2002 ms] - -- > B04100004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A - cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B04500004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A"))); - cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B04100004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A"))); - */ - testAPDU(cardMngr, "B04500004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A", - ""); - testAPDU(cardMngr, "B04100004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A", - ""); - - - /* OK EC point add - OutOfBound exception on j2e (fixed, caused by rease of ECCurve.pBN after card reset) - -- > B04200008204BF72189A853910F6E09B9AAA7E88FF3E077FFB308C6A3F04D9B2BE394368A63E6C75201A93FE46D00B9C4A9CA941E45B9F134C9ABEC69987A18040A4A982ACCE043C6CF897C243273248B982EB5BAC53AA9C7DA651770A849E8F0BC3ADDAFFE462FD19D33F56E5F0238824D0CCA999B0208D9BDBC5A92B2CC7F4BFA1F57E0D0DE1 - < --FF02 [156 ms] - testAPDU(cardMngr, "B04500004104E1949A6DC59211505B7D120A3506EF09DB472C2A9E767C686396EA72367332F1D888E07010C8EC8EB02F8477BE426995978F342169E3CE500735666821AB2A3A", - ""); - */ - testAPDU(cardMngr, "B04200008204BF72189A853910F6E09B9AAA7E88FF3E077FFB308C6A3F04D9B2BE394368A63E6C75201A93FE46D00B9C4A9CA941E45B9F134C9ABEC69987A18040A4A982ACCE043C6CF897C243273248B982EB5BAC53AA9C7DA651770A849E8F0BC3ADDAFFE462FD19D33F56E5F0238824D0CCA999B0208D9BDBC5A92B2CC7F4BFA1F57E0D0DE1", - ""); - - /* OK EC scalar_Point Multiplication - good X and Y - --> B04320006178A124A8A42D09E7A7CE086BB0498A62D643F4240E6BCE8678FC80E761E18D8F 046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5 - < --045452BF4C01A2B8945B5D0571AFE67FCB4F4212AFEA563430853578B102AAFAE7 C5A8AA4D177A6690932ADDE5D59DEEDA6C2040CDCF8851AF91E89EA685EA37D9 9000 (65) - true - 04 - 5452BF4C01A2B8945B5D0571AFE67FCB4F4212AFEA563430853578B102AAFAE7 - C5A8AA4D177A6690932ADDE5D59DEEDA6C2040CDCF8851AF91E89EA685EA37D9 - - My response:04 - 5452BF4C01A2B8945B5D0571AFE67FCB4F4212AFEA563430853578B102AAFAE7 - 3A5755B1E88599706CD5221A2A62112593DFBF333077AE506E1761597A15C826 - - Valid Y : C5A8AA4D177A6690932ADDE5D59DEEDA6C2040CDCF8851AF91E89EA685EA37D9 - My inv Y: 3A5755B1E88599706CD5221A2A62112593DFBF333077AE506E1761597A15C826 - - --> B043200061464C1264592B74EC69C157549A3419E82E52A7FA991DF4DBB16651A1E058E42B046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5 - <-- 04 4DDED9788EBD7BDC7CFE2E0E2841D1A82BECAC1A11BBF23D0BDB967DC31052F8 385C7026EE71E69394040CC61E2BABF369BAD256BCFFBD5769575493A1061D59 9000 (65) - true - */ - testAPDU(cardMngr, "B04320006178A124A8A42D09E7A7CE086BB0498A62D643F4240E6BCE8678FC80E761E18D8F046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", - "045452BF4C01A2B8945B5D0571AFE67FCB4F4212AFEA563430853578B102AAFAE7C5A8AA4D177A6690932ADDE5D59DEEDA6C2040CDCF8851AF91E89EA685EA37D9"); - - /* - OK EC scalar_Point Multiplication - good X and bad Y - needed recomputation - --> B04320006159D54E15D501C29314527B7120149203558A03D56F9B3AE76E343B67DFBB175F 046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5< - -- 6700 - false - */ - testAPDU(cardMngr, "B04320006159D54E15D501C29314527B7120149203558A03D56F9B3AE76E343B67DFBB175F046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", - ""); - testAPDU(cardMngr, "B04320006178A124A8A42D09E7A7CE086BB0498A62D643F4240E6BCE8678FC80E761E18D8F046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", - ""); - testAPDU(cardMngr, "B043200061464C1264592B74EC69C157549A3419E82E52A7FA991DF4DBB16651A1E058E42B046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", - ""); - testAPDU(cardMngr, "B04320006159D54E15D501C29314527B7120149203558A03D56F9B3AE76E343B67DFBB175F046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", - ""); - - /* - EC Point Double: GD60 provides incorrect answer - KA.generateSecrets returns only first 20 bytes instead of whole 32 - --> B041000041040016A52AED459400766FCC032B9C6049E2130E5F70E3BED5F3E0F42310F6AEDBF9A027D9D16844E5D818A199145D7B30822800351D514F36AEF69EEB2585718B - <-- 040000000000000000000000002465E5D03C7C2EA823EF15E660845D305D60BEEF03698F5BC1E4AD04B2B1D95F37D67FE8A0DD8DCD7E538F0EC0DDBC866584B85A 9000 (65) [3188 ms] - Expected: 042465E5D03C7C2EA823EF15E660845D305D60BEEFEB69ECDB4A895F71F0AED9BD863EA5BEF9B08EDD11DF771651002DFC4ABF62D3948853236C150AD92DC8CB05 - Obtained: 040000000000000000000000002465E5D03C7C2EA823EF15E660845D305D60BEEF03698F5BC1E4AD04B2B1D95F37D67FE8A0DD8DCD7E538F0EC0DDBC866584B85A - false (3188 ms) - */ - testAPDU(cardMngr, "B041000041040016A52AED459400766FCC032B9C6049E2130E5F70E3BED5F3E0F42310F6AEDBF9A027D9D16844E5D818A199145D7B30822800351D514F36AEF69EEB2585718B", - "042465E5D03C7C2EA823EF15E660845D305D60BEEFEB69ECDB4A895F71F0AED9BD863EA5BEF9B08EDD11DF771651002DFC4ABF62D3948853236C150AD92DC8CB05"); - - /* - EC Point Double: - --> B041000041041A200A8CF6CAF55FBFBA77C85F4B3D3F85BC3F94CC51807EE3F63A5FCED1815CF5DF4CD5A654B5E9A95499391200A5B61B6FDF9BCDFC984F0623DCDEBCC05F00 - javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x8010002f - */ - testAPDU(cardMngr, "B041000041041A200A8CF6CAF55FBFBA77C85F4B3D3F85BC3F94CC51807EE3F63A5FCED1815CF5DF4CD5A654B5E9A95499391200A5B61B6FDF9BCDFC984F0623DCDEBCC05F00", - ""); - - /* - OK EC Point Double: incorrect last digit of X (both jcardsim and j2e) - x_p length was 31, from_byte_array read only subpart - --> B0410000410452FA006F9A47EF2EAC460205BBA14C2448BA0B63FD4CFFB2F27AD98A06086B290892F24916E949E83624781286D81BF04FE1D11E7662D79FF0820A6DCFDA9E80 - <-- 041205F5BBC2C5FF101CD915357F771CC44E33280238EA4E1BC05CF888520B560066C77E60CA3AABD17AD98D95905C3C51E2FBD30FF6747278B5F320B917B13249 9000 (65) [1289 ms] - Expected: 041205F5BBC2C5FF101CD915357F771CC44E33280238EA4E1BC05CF888520B5682AEF9A914E2293C1498DB0D75EBEFCE57C95DEA3B183D7C5631EFE62B6A39A8F2 - Obtained: 041205F5BBC2C5FF101CD915357F771CC44E33280238EA4E1BC05CF888520B560066C77E60CA3AABD17AD98D95905C3C51E2FBD30FF6747278B5F320B917B13249 - false (1289 ms) - */ - testAPDU(cardMngr, "B0410000410452FA006F9A47EF2EAC460205BBA14C2448BA0B63FD4CFFB2F27AD98A06086B290892F24916E949E83624781286D81BF04FE1D11E7662D79FF0820A6DCFDA9E80", - "041205F5BBC2C5FF101CD915357F771CC44E33280238EA4E1BC05CF888520B5682AEF9A914E2293C1498DB0D75EBEFCE57C95DEA3B183D7C5631EFE62B6A39A8F2"); - - /* - OK EC scalar_Point Multiplication: lopps forever - scalar: 0D4E3C7BD96EBFF859159CC293AD81916C25C5D046D01A4056385D4F6539C327 - point : 0419E49497625450C8DBDB9E26648C3BB4A8C452FD75B2A573B0B7DC138416D0276E11FAB26D1017EA8E66D72D263AD9D79A25218852422AEB6340EF9625C3F3FF - expect: 048EF036EB99F5F4DC108523C05EAF8783395E0FDA44F47A5879CA2DB0E2C1AB93FBB16CC35A2A3E0B964784ED3CC8128CB772028683A52ECB835E8C8B35016FF3 - --> B0432000610D4E3C7BD96EBFF859159CC293AD81916C25C5D046D01A4056385D4F6539C3270419E49497625450C8DBDB9E26648C3BB4A8C452FD75B2A573B0B7DC138416D0276E11FAB26D1017EA8E66D72D263AD9D79A25218852422AEB6340EF9625C3F3FF - - */ - testAPDU(cardMngr, "B0432000610D4E3C7BD96EBFF859159CC293AD81916C25C5D046D01A4056385D4F6539C3270419E49497625450C8DBDB9E26648C3BB4A8C452FD75B2A573B0B7DC138416D0276E11FAB26D1017EA8E66D72D263AD9D79A25218852422AEB6340EF9625C3F3FF", - "048EF036EB99F5F4DC108523C05EAF8783395E0FDA44F47A5879CA2DB0E2C1AB93FBB16CC35A2A3E0B964784ED3CC8128CB772028683A52ECB835E8C8B35016FF3"); - - - /* OK EC Point Add: - --> B0420000820405AC28C3A153AA18E5F7B08C7C6992F517430CBCCBCA0DCAF7285599E495F7777CA85E1C9EC671D182DFEBEDE489FB625596CBD5886F649B23A0B2A982C77ABD045A55EC838109C2157862B4508421C288EDDD6CB63B4082763E59683E716C093033C0E616D1826904C5E91BB73A81A0DEF9042C621100E53CDBC9F92298E0FACD - <-- 049BC398A6EC46C801613DABD1EA4418901DF881EA4001677408208E85E1B8C87D3541C50B64BA9C6326746F177C10BFF061877725B5575678E49041F7E3254284 9000 (65) [1 ms] - Expected: 04C4F9B065A7B13806F5653333AE5F79F009029F897A3C7BB67FBBE4740835BA21209D14FF7D9BFE018CA4875C64ED6461732D6E49F4684691CCA825D02740A79D - Obtained: 049BC398A6EC46C801613DABD1EA4418901DF881EA4001677408208E85E1B8C87D3541C50B64BA9C6326746F177C10BFF061877725B5575678E49041F7E3254284 - false (1 ms) -*/ - testAPDU(cardMngr, "B0420000820405AC28C3A153AA18E5F7B08C7C6992F517430CBCCBCA0DCAF7285599E495F7777CA85E1C9EC671D182DFEBEDE489FB625596CBD5886F649B23A0B2A982C77ABD045A55EC838109C2157862B4508421C288EDDD6CB63B4082763E59683E716C093033C0E616D1826904C5E91BB73A81A0DEF9042C621100E53CDBC9F92298E0FACD", - "04C4F9B065A7B13806F5653333AE5F79F009029F897A3C7BB67FBBE4740835BA21209D14FF7D9BFE018CA4875C64ED6461732D6E49F4684691CCA825D02740A79D"); -/* - EC Point Add: - --> B042000082040EAD4E4EF0C7201D154C945143F8E3BEBFA727FC1ADA3E242AF765B8CBBEB31E0D9D674C9C46CED3814AADF3B26B539910BE119798760880253CCB178FA48053045722EF49138CBA824475CC788A90F354B775C6BAAAA6801A97D24AB4483D62D3003CCA6B720A46891ED1BBD3EB9A72D272DF673F841BFEB63232C5B1E3E99AB8 - <-- 04441E088C277CD642FC21CC3810BEB8F9255CCCDBEDCD1F8E68FC103B9BCB9E1EDCE877B4789D00EB8322E3B5031764F4D2BE21E285663CBCF6A8E1FB58AFDB81 9000 (65) [1 ms] - Expected: 04A9D9B0AD10D7F612979383633355717C957F8B05DC328F9F0A62155394B3B1C28DCCAA66F5F90E18D53DADF7C1307BCD6474FE863EA4C8CF55869CAFDED8EB03 - Obtained: 04441E088C277CD642FC21CC3810BEB8F9255CCCDBEDCD1F8E68FC103B9BCB9E1EDCE877B4789D00EB8322E3B5031764F4D2BE21E285663CBCF6A8E1FB58AFDB81 - false (1 ms) -*/ - testAPDU(cardMngr, "B042000082040EAD4E4EF0C7201D154C945143F8E3BEBFA727FC1ADA3E242AF765B8CBBEB31E0D9D674C9C46CED3814AADF3B26B539910BE119798760880253CCB178FA48053045722EF49138CBA824475CC788A90F354B775C6BAAAA6801A97D24AB4483D62D3003CCA6B720A46891ED1BBD3EB9A72D272DF673F841BFEB63232C5B1E3E99AB8", - "04A9D9B0AD10D7F612979383633355717C957F8B05DC328F9F0A62155394B3B1C28DCCAA66F5F90E18D53DADF7C1307BCD6474FE863EA4C8CF55869CAFDED8EB03"); -/* - EC Point Add: - --> B0420000820454976787E8049158A46C5EF2ED572F16F52ACAD8DD70646039D1B8CF8FA36D3A1BFDF1F8ABFAE4061E3715C231F12CAFE6CB57CB6104DEC577293643F5F5EE3A04A444355F2F44BFFABB6DA1454722C4ABBC2FA74A672CE6693BE158B9CBBE5BC9EB4A1EC721B53E27AEAA2055A68F787D2DDE14942BD03141A4B8728140EEF4FB - <-- 04A41D315A84BB27E72AD52AB936668CA421A738D46CDFAF150223003D49F887300D52B34F9E5F2C7DEC87AC96D26303F593F9014396E2655C78C7ACB3EF90E472 9000 (65) [1 ms] - Expected: 043BC15BE5F752B3270DB0AEF2BCF0ECBDB5788F88E614323068C4C4886B43914C22E167683B32959831196D41880C9F8C596760861A86F80D01460CB58D866C09 - Obtained: 04A41D315A84BB27E72AD52AB936668CA421A738D46CDFAF150223003D49F887300D52B34F9E5F2C7DEC87AC96D26303F593F9014396E2655C78C7ACB3EF90E472 - false (1 ms) - cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B0420000820405AC28C3A153AA18E5F7B08C7C6992F517430CBCCBCA0DCAF7285599E495F7777CA85E1C9EC671D182DFEBEDE489FB625596CBD5886F649B23A0B2A982C77ABD045A55EC838109C2157862B4508421C288EDDD6CB63B4082763E59683E716C093033C0E616D1826904C5E91BB73A81A0DEF9042C621100E53CDBC9F92298E0FACD"))); -*/ - testAPDU(cardMngr, "B0420000820454976787E8049158A46C5EF2ED572F16F52ACAD8DD70646039D1B8CF8FA36D3A1BFDF1F8ABFAE4061E3715C231F12CAFE6CB57CB6104DEC577293643F5F5EE3A04A444355F2F44BFFABB6DA1454722C4ABBC2FA74A672CE6693BE158B9CBBE5BC9EB4A1EC721B53E27AEAA2055A68F787D2DDE14942BD03141A4B8728140EEF4FB", - "043BC15BE5F752B3270DB0AEF2BCF0ECBDB5788F88E614323068C4C4886B43914C22E167683B32959831196D41880C9F8C596760861A86F80D01460CB58D866C09"); - -/* - EC Point Double: (standard G) - --> B0410000410400047AD7AD297E94E6EA398FB2925E130C3F4710D1963728AA6BCCDB51B9EEDAE564BAA1B1574241FB2BD0AB7570C9ADE06A11E2757D28BE1A08575C894BFBB3 - <-- 04F1A9E97B58F3B52FB0B9733C1E3C62E254A5F8597E9FEC3657F395900B74ABF14B9D3149308739C80142AF440EF763BFF949CA92308FC49A3A84CB9653D70933 9000 (65) [0 ms] - Expected: 04F1A9E97B58F3B52FB0B9733C1E3C62E254A5F8597E9FEC3657F395900B74ABF1 F042DC11CE0339B29F03F77FC0A36BBBE3DDF62F6B37579AA9EE4560E3A03D3F - Obtained: 04F1A9E97B58F3B52FB0B9733C1E3C62E254A5F8597E9FEC3657F395900B74ABF1 4B9D3149308739C80142AF440EF763BFF949CA92308FC49A3A84CB9653D70933 - false (0 ms) -*/ - testAPDU(cardMngr, "B0410000410400047AD7AD297E94E6EA398FB2925E130C3F4710D1963728AA6BCCDB51B9EEDAE564BAA1B1574241FB2BD0AB7570C9ADE06A11E2757D28BE1A08575C894BFBB3", - "04F1A9E97B58F3B52FB0B9733C1E3C62E254A5F8597E9FEC3657F395900B74ABF1F042DC11CE0339B29F03F77FC0A36BBBE3DDF62F6B37579AA9EE4560E3A03D3F"); - - - /* - EC scalar_Point Multiplication: - --> B04321006200E805E802BFECEE919B3D3BD83C7B52A5D5354C4C06898054B976FAB1D35A109104C449C202B3781B0F689894723BB9EB96DA13D51F596824831FDC83A9FD18AB3FE0E26FCE752E7C8CDC0EB5AF70342B7ECFB4D240C1D70333F80552CDAF14B4FE - <-- 0489857CC9D4CB3BBF49D11C324E0A9EDF259335BF5498BECC43A62E5E757EB0BAFFE154BA84053CE85AB62083E6E7E67029B1A7AC66EF5BEB1A361E5B3865655B 9000 (65) [11 ms] - true (11 ms) -*/ - testAPDU(cardMngr, "B04321006200E805E802BFECEE919B3D3BD83C7B52A5D5354C4C06898054B976FAB1D35A109104C449C202B3781B0F689894723BB9EB96DA13D51F596824831FDC83A9FD18AB3FE0E26FCE752E7C8CDC0EB5AF70342B7ECFB4D240C1D70333F80552CDAF14B4FE", - "0489857CC9D4CB3BBF49D11C324E0A9EDF259335BF5498BECC43A62E5E757EB0BAFFE154BA84053CE85AB62083E6E7E67029B1A7AC66EF5BEB1A361E5B3865655B"); - - /* - EC Point Add: will trigger processing where m_ecHelper.y_r.length() < this.TheCurve.COORD_SIZE - -- > B04200008204A0963A315E016F89E8038E95E3FC3BE33F8A84D6BA2650C505473FDAB15C57594E0372E2ED17DF269536BFD615B3C29DAAB44244610DE156D3FCE5B96F1BEADB048A35B870E4ABC095D0CF6F6B0DE9989A7053A2B7125E20CE5C4B8FFBC2E14FE2A5CFD0E6D397412F3811A76E2EFC4EDB57AD6CEFD79DBCD592D139CB25FBDBED - Expected: <-- 0456A4E425F6D55978A7FF2E0ABEFCF56175B6B91E133D5DD1174BC20C320A275DB2730F5F3FEC7E9D811351B5B04A8A4CD31AA31908A06B9BAB028669D97FE2B0 9000 (65) [100849 ms] - */ - testAPDU(cardMngr, "B04200008204A0963A315E016F89E8038E95E3FC3BE33F8A84D6BA2650C505473FDAB15C57594E0372E2ED17DF269536BFD615B3C29DAAB44244610DE156D3FCE5B96F1BEADB048A35B870E4ABC095D0CF6F6B0DE9989A7053A2B7125E20CE5C4B8FFBC2E14FE2A5CFD0E6D397412F3811A76E2EFC4EDB57AD6CEFD79DBCD592D139CB25FBDBED", - "0456A4E425F6D55978A7FF2E0ABEFCF56175B6B91E133D5DD1174BC20C320A275DB2730F5F3FEC7E9D811351B5B04A8A4CD31AA31908A06B9BAB028669D97FE2B0"); - - /* - EC Point Add: - --> B0420000820433C418ABD0ACDB00A7D5D57BFA2084D813BE8E63F99C0954F2041C2E0C2DD5ED40FB5B84C0BDFD16F5CA243422942852438C48CE016751FB0208C6744DE2F75D044EDEBB1CE07F3CA1E1CB0C3ED1F0B6877F709BE567C37C323325CCA9C1E1927854E55A412F53831A970BA0CF8F165EC51BC83C10E95E5F02328F8419A0E40043 - <-- 041EB4C36AC69962332EE1AB5DF684B693DF6E220C3BBFA0527A035CAC976E6BE249590269FE030B34A21446C0A0299D0BDA0D30BDAD9B45F2E0D221051E3BB53E 9000 (65) [1 ms] - Expected: 04C4FE83CD3B4BADD89317A0D24CB15A92604373043B3D999EB475446DB656156EE02589FB8252AA525010CD4FC5C7D2B5C28336192A6F5435560616472E438D6F - Obtained: 041EB4C36AC69962332EE1AB5DF684B693DF6E220C3BBFA0527A035CAC976E6BE249590269FE030B34A21446C0A0299D0BDA0D30BDAD9B45F2E0D221051E3BB53E - false (1 ms) - */ - testAPDU(cardMngr, "B0420000820433C418ABD0ACDB00A7D5D57BFA2084D813BE8E63F99C0954F2041C2E0C2DD5ED40FB5B84C0BDFD16F5CA243422942852438C48CE016751FB0208C6744DE2F75D044EDEBB1CE07F3CA1E1CB0C3ED1F0B6877F709BE567C37C323325CCA9C1E1927854E55A412F53831A970BA0CF8F165EC51BC83C10E95E5F02328F8419A0E40043", - "04C4FE83CD3B4BADD89317A0D24CB15A92604373043B3D999EB475446DB656156EE02589FB8252AA525010CD4FC5C7D2B5C28336192A6F5435560616472E438D6F"); - - /* - EC Point Add: - --> B042000082046162D8D89DC837B2D542934125D16E087A2ED4CD1909E5277F84E0C50CD8993E4A948DFBC2D8FE71590F84356BCC610DBB2A76AD8C12DCB9202FF4B98880A148041261FBB3E74C0ED2D51CE4E4198EE9ACD0787B92740E28F51C2345AFF98D7A09A81EE6FFF5E353C52D35503B85607BB18777BFF873B57808236F3CE101299C2C - <-- 04043D62915081A7D614391BCD839A3F9649F8A787DA520B9B64DB3F6AAF88EB35A65B560A89943097F2A74215FD25BD619DB16362A67B9AA89D0D82C4928B5069 9000 (65) [0 ms] - Expected: 0408B32DAA1CC14F692D5F206EB362A2E200ED4F98D64F5BFD1C585CF0D94FDBB74B5BFA2B982119EC2CEE241AEDE1D33DC3784D104725EA7FF15D8DF8A3268F9A - Obtained: 04043D62915081A7D614391BCD839A3F9649F8A787DA520B9B64DB3F6AAF88EB35A65B560A89943097F2A74215FD25BD619DB16362A67B9AA89D0D82C4928B5069 - false (0 ms) - */ - //cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B042000082046162D8D89DC837B2D542934125D16E087A2ED4CD1909E5277F84E0C50CD8993E4A948DFBC2D8FE71590F84356BCC610DBB2A76AD8C12DCB9202FF4B98880A148041261FBB3E74C0ED2D51CE4E4198EE9ACD0787B92740E28F51C2345AFF98D7A09A81EE6FFF5E353C52D35503B85607BB18777BFF873B57808236F3CE101299C2C"))); - testAPDU(cardMngr, "B042000082046162D8D89DC837B2D542934125D16E087A2ED4CD1909E5277F84E0C50CD8993E4A948DFBC2D8FE71590F84356BCC610DBB2A76AD8C12DCB9202FF4B98880A148041261FBB3E74C0ED2D51CE4E4198EE9ACD0787B92740E28F51C2345AFF98D7A09A81EE6FFF5E353C52D35503B85607BB18777BFF873B57808236F3CE101299C2C", - "0408B32DAA1CC14F692D5F206EB362A2E200ED4F98D64F5BFD1C585CF0D94FDBB74B5BFA2B982119EC2CEE241AEDE1D33DC3784D104725EA7FF15D8DF8A3268F9A"); - - /* - EC Point Add: - --> B042000082041C362ECB030B0B910F75ED5F37FED8EAA2CBA24ECF9A1C93977432E0F0002B64F8176CF7311077272A7DFFD81C736AA3D2B20148242CF203AA7FD4DB260B446F04A50EA35202328E7A005004BE940053F3AF37B9596D26CA4B9F4D774DC66F31E8A63E9D08D6855493CB7F7BDBE163596F7BD3AE13060B249AC37D4E158D0BD5A6 - <-- 048666427C58F6E59225FA389C06C1365648C1100E15FD7316793FD95517F9674B76CCE06B84B32D6D337DDCA6BC54FD54F7CCA53B724C13C5C20FF362B8A52E70 9000 (65) [0 ms] - Expected: 04D702D8F5FD209A76246FCE0CEDD39384E29768C51091D77ABEEE5754CD5F0B7704CE7F968372F3E1CFA99310F97C5CCB86CF65BEDA2BE23DA7188791A7B4D5A5 - Obtained: 048666427C58F6E59225FA389C06C1365648C1100E15FD7316793FD95517F9674B76CCE06B84B32D6D337DDCA6BC54FD54F7CCA53B724C13C5C20FF362B8A52E70 - false (0 ms) - */ - testAPDU(cardMngr, "B042000082041C362ECB030B0B910F75ED5F37FED8EAA2CBA24ECF9A1C93977432E0F0002B64F8176CF7311077272A7DFFD81C736AA3D2B20148242CF203AA7FD4DB260B446F04A50EA35202328E7A005004BE940053F3AF37B9596D26CA4B9F4D774DC66F31E8A63E9D08D6855493CB7F7BDBE163596F7BD3AE13060B249AC37D4E158D0BD5A6", - "04D702D8F5FD209A76246FCE0CEDD39384E29768C51091D77ABEEE5754CD5F0B7704CE7F968372F3E1CFA99310F97C5CCB86CF65BEDA2BE23DA7188791A7B4D5A5"); - - - // EC Point Add: OK - testAPDU(cardMngr, "B042000082046C69B918ACCC8799BBA9D1544B351BF88B8CE48E5E7C94EBD8FBFDA2E9598203452D4EB663FE1160ECD40D21DE388C7718469D80BF22E6DF2F22D1591827D71C040E66560F3EDD0D3B4EDF713262ABB3AD27AE0C0DA133DB9BEFB3BE224FDC099F06F9CD081A4D07E77D6E5242A8C9A68EB5A10F5997D0C96187105CAA6B4C655F", - ""); - testAPDU(cardMngr, "B04200008204D9CF40DD8DA3426ACBE01E3030AA2553FC19AFEAAC1D729E254C4716B2F2048FE5FA773F9A08315F97B30B07DF9F1D6C0F38DFF63EC0E6CAAD91820FBB374D1E04A5A51D44C5312A6AB3228A3581AF1386956C9E09525CD60CF69FE09A7E2D2C42A47C74726513E6E3368F0BE6859FF3AFAC9F61A48FC27830288BD417D022D710", - ""); - testAPDU(cardMngr, "B042000082047BDEC1627643046FD4D05A25515687899F2857D1CCE218BAE0C56F74EE06781F21C849C2EBB2962DA71995450A3AF19F9CE57F48AFB07A3790218F089A4A97D0040523C90A8A9D3DDE94161CBF0EB85A540D174AE07F3DEB61DF0E19E29F0A9CE512AD46063B913693457A6836979308072E1070B7C03B0920828ED4E739945861", - ""); - - /* - EC Point Add: - --> B042000082046C69B918ACCC8799BBA9D1544B351BF88B8CE48E5E7C94EBD8FBFDA2E9598203452D4EB663FE1160ECD40D21DE388C7718469D80BF22E6DF2F22D1591827D71C040E66560F3EDD0D3B4EDF713262ABB3AD27AE0C0DA133DB9BEFB3BE224FDC099F06F9CD081A4D07E77D6E5242A8C9A68EB5A10F5997D0C96187105CAA6B4C655F - <-- 04000E224089BC0E39417EB4B765CEC9EBB5BFC7D3E851D79577FA6FEF3A1A37855CFDADB94B8DDD9A788479216AC64009E9D5A3F198941DE08AD133FDCF620D4D 9000 (65) [0 ms] - Expected: 04860E224189BC0E38417EB4B765CEC9EBB5BFC7D2E851D79577FA6FEF3A1A3786F207180F1E452B6DD3E835CCA1820F9B53B4A258F71A671D0BCE7D19F7AD2F93 - Obtained: 04000E224089BC0E39417EB4B765CEC9EBB5BFC7D3E851D79577FA6FEF3A1A37855CFDADB94B8DDD9A788479216AC64009E9D5A3F198941DE08AD133FDCF620D4D - */ - testAPDU(cardMngr, "B042000082046C69B918ACCC8799BBA9D1544B351BF88B8CE48E5E7C94EBD8FBFDA2E9598203452D4EB663FE1160ECD40D21DE388C7718469D80BF22E6DF2F22D1591827D71C040E66560F3EDD0D3B4EDF713262ABB3AD27AE0C0DA133DB9BEFB3BE224FDC099F06F9CD081A4D07E77D6E5242A8C9A68EB5A10F5997D0C96187105CAA6B4C655F", - "04860E224189BC0E38417EB4B765CEC9EBB5BFC7D2E851D79577FA6FEF3A1A3786F207180F1E452B6DD3E835CCA1820F9B53B4A258F71A671D0BCE7D19F7AD2F93"); - - // BUG fixed - //cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B042000082046C69B918ACCC8799BBA9D1544B351BF88B8CE48E5E7C94EBD8FBFDA2E9598203452D4EB663FE1160ECD40D21DE388C7718469D80BF22E6DF2F22D1591827D71C040E66560F3EDD0D3B4EDF713262ABB3AD27AE0C0DA133DB9BEFB3BE224FDC099F06F9CD081A4D07E77D6E5242A8C9A68EB5A10F5997D0C96187105CAA6B4C655F"))); - /* EC Point Add: - --> B04200008204D9CF40DD8DA3426ACBE01E3030AA2553FC19AFEAAC1D729E254C4716B2F2048FE5FA773F9A08315F97B30B07DF9F1D6C0F38DFF63EC0E6CAAD91820FBB374D1E04A5A51D44C5312A6AB3228A3581AF1386956C9E09525CD60CF69FE09A7E2D2C42A47C74726513E6E3368F0BE6859FF3AFAC9F61A48FC27830288BD417D022D710 - ff02 outof bound - */ - testAPDU(cardMngr, "B042000082046C69B918ACCC8799BBA9D1544B351BF88B8CE48E5E7C94EBD8FBFDA2E9598203452D4EB663FE1160ECD40D21DE388C7718469D80BF22E6DF2F22D1591827D71C040E66560F3EDD0D3B4EDF713262ABB3AD27AE0C0DA133DB9BEFB3BE224FDC099F06F9CD081A4D07E77D6E5242A8C9A68EB5A10F5997D0C96187105CAA6B4C655F", - ""); - - /* - EC Point Add: - --> B042000082046D8DF86760703C37FB25160368EABB2A988E08489E7AA44349190F38E233BA4929F74D2FCD3664BAA784C20C87B82A6411E66FD53D4BF91DCD6E186FE31A5EF6040E0ED978CC8CE4611171088B7E91B6983D0EE2F4851F34BDC8519186D85F5C9A9C405CE119E295D40755FEF3AE097759C65E6D4ACB4694BEB6554A40E51052BF - <-- 0459EEA5882826CF1FF557E11528907E234EB2ED23F0BD2F50D03957784BBC00FED608B66C32C999D4587B3DF37847D4E2EE198D47C2B406293291E7901CE5A334 9000 (65) [12297 ms] - Expected: 0498BF9209C1F8B738D776F1242511C3EE2294F6FA0EFCDC6841E4B6CAB0B1E2C755849BA0AD1BCFBB33845CF686ED4401CA1122E63EE797EB0DE6653A895DEC76 - Obtained: 0459EEA5882826CF1FF557E11528907E234EB2ED23F0BD2F50D03957784BBC00FED608B66C32C999D4587B3DF37847D4E2EE198D47C2B406293291E7901CE5A334 - false (12297 ms) -*/ - testAPDU(cardMngr, "B042000082046D8DF86760703C37FB25160368EABB2A988E08489E7AA44349190F38E233BA4929F74D2FCD3664BAA784C20C87B82A6411E66FD53D4BF91DCD6E186FE31A5EF6040E0ED978CC8CE4611171088B7E91B6983D0EE2F4851F34BDC8519186D85F5C9A9C405CE119E295D40755FEF3AE097759C65E6D4ACB4694BEB6554A40E51052BF", - "0498BF9209C1F8B738D776F1242511C3EE2294F6FA0EFCDC6841E4B6CAB0B1E2C755849BA0AD1BCFBB33845CF686ED4401CA1122E63EE797EB0DE6653A895DEC76"); - - /* - EC scalar_Point Multiplication: - scalar: 00C9BA2ED6251A61FFC84D5FDBC1D9977109086645E9DE4A8EA4621E0B19A504E1 - point : 0466EEC756DD194524F8BE1531E55A777DF9D8C919A6FE738CED6D55A0D59B787F1DF45609795171391F26F45B1F31172B65723689E5ED8D08174AC2E781FBB40D - expect: 04FA5319E41132C2C031462D88B95E8B51EEC334BEBEA3F26EB449D73DE81B606CFFFA95AB76E2FFF7A75E05F378DBCCEF9520DB4B78A9B7786CCE6E18B6D13CBA - --> B04321006200C9BA2ED6251A61FFC84D5FDBC1D9977109086645E9DE4A8EA4621E0B19A504E10466EEC756DD194524F8BE1531E55A777DF9D8C919A6FE738CED6D55A0D59B787F1DF45609795171391F26F45B1F31172B65723689E5ED8D08174AC2E781FBB40D - */ - testAPDU(cardMngr, "B04321006200C9BA2ED6251A61FFC84D5FDBC1D9977109086645E9DE4A8EA4621E0B19A504E10466EEC756DD194524F8BE1531E55A777DF9D8C919A6FE738CED6D55A0D59B787F1DF45609795171391F26F45B1F31172B65723689E5ED8D08174AC2E781FBB40D", - "04FA5319E41132C2C031462D88B95E8B51EEC334BEBEA3F26EB449D73DE81B606CFFFA95AB76E2FFF7A75E05F378DBCCEF9520DB4B78A9B7786CCE6E18B6D13CBA"); - - /* - EC Point Double: - -- > B041000041041D1D96E2B171DFCC457587259E28E597258BF86EA0CFCB97BB6FCE62E7539E2879F3FDE52075AACAD1BA7637F816B6145C01E646831C259409FB89309AB03FD9 - javax.smartcardio.CardException: sun.security.smartcardio.PCSCException : Unknown error 0x8010002f - Expected: 04BEE826372CE4CC0458FF7338E576240BE306CCFA18F83554A5B87FAA81D167DED5425D97120251959AF05BC1BA1BFD92C49726A271B9A6CBACC9E3A7A2145F91 - */ - testAPDU(cardMngr, "B041000041041D1D96E2B171DFCC457587259E28E597258BF86EA0CFCB97BB6FCE62E7539E2879F3FDE52075AACAD1BA7637F816B6145C01E646831C259409FB89309AB03FD9", - ""); - - //EC Point Add: - // cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B042000082047BDEC1627643046FD4D05A25515687899F2857D1CCE218BAE0C56F74EE06781F21C849C2EBB2962DA71995450A3AF19F9CE57F48AFB07A3790218F089A4A97D0040523C90A8A9D3DDE94161CBF0EB85A540D174AE07F3DEB61DF0E19E29F0A9CE512AD46063B913693457A6836979308072E1070B7C03B0920828ED4E739945861"))); - testAPDU(cardMngr, "B042000082047BDEC1627643046FD4D05A25515687899F2857D1CCE218BAE0C56F74EE06781F21C849C2EBB2962DA71995450A3AF19F9CE57F48AFB07A3790218F089A4A97D0040523C90A8A9D3DDE94161CBF0EB85A540D174AE07F3DEB61DF0E19E29F0A9CE512AD46063B913693457A6836979308072E1070B7C03B0920828ED4E739945861", - ""); - - //EC Point Add: (cause x_r to have leading zero) - //cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B04200008204ACFCFA2F50A4DBF92063014CE6656B323766F5588451EFE364DD1A460FD5FE608518CEBB84B030800821EB7BD87A84F0CE12ADDB6386725016EDB0021104543404F54D175A521FB34F0DD2B01BE00E1500AAD4B77FDF4633D059E14864617E440A71E8CCECC0BD66F6E9690326859E49F089767B7D97A233864A50C77E8EFD950F"))); - testAPDU(cardMngr, "B04200008204ACFCFA2F50A4DBF92063014CE6656B323766F5588451EFE364DD1A460FD5FE608518CEBB84B030800821EB7BD87A84F0CE12ADDB6386725016EDB0021104543404F54D175A521FB34F0DD2B01BE00E1500AAD4B77FDF4633D059E14864617E440A71E8CCECC0BD66F6E9690326859E49F089767B7D97A233864A50C77E8EFD950F", - ""); - - - //EC Point Add: (cause y_r to have leading zero) - //cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B04200008204A930A63B0F99734F081363085492B9D8B23E78B020F5F58F7751277AB180C314503A95E75F26BE376B1333271E0A1A2B00A3D4F191697CFE00210620B86EFE4C04B1A72063C23CC6D67468D67FCDBA8719208C06BA98EC71EFA305BFC490A0D0111E12A5F45AC8D8144FB1C063C4645C2ADADDA3BDFD6B49FE125D5FF946F0FAF6"))); - testAPDU(cardMngr, "B04200008204A930A63B0F99734F081363085492B9D8B23E78B020F5F58F7751277AB180C314503A95E75F26BE376B1333271E0A1A2B00A3D4F191697CFE00210620B86EFE4C04B1A72063C23CC6D67468D67FCDBA8719208C06BA98EC71EFA305BFC490A0D0111E12A5F45AC8D8144FB1C063C4645C2ADADDA3BDFD6B49FE125D5FF946F0FAF6", - ""); - - //EC scalar_Point Multiplication: - causing freeze (solved) - // cardMngr.transmit(new CommandAPDU(hexStringToByteArray("B0432000613B9CF893A99F78A70C750CF94544834C5DDF49CFBB51F1AB64BC31560FC4981A0485E1B5D3AE10179BF011090B7DD8380E533A65015EBA63A72F900AEB6FEA4E2B702E87CE6C440A18008353054EA14C96D868A1558AE88131C41F87CD5BCD63F3"))); - //cardMngr.transmit(new CommandAPDU(failedBNSubCommand)); - testAPDU(cardMngr, "B0432000613B9CF893A99F78A70C750CF94544834C5DDF49CFBB51F1AB64BC31560FC4981A0485E1B5D3AE10179BF011090B7DD8380E533A65015EBA63A72F900AEB6FEA4E2B702E87CE6C440A18008353054EA14C96D868A1558AE88131C41F87CD5BCD63F3", - ""); - - /* - EC Point Add: Used to be correct response: - -- > B04200008204E2903869AF98E3C57DFDBB0DC7F6A0031B2AED0DA91E06E7B930DFD6C6C1A5F8706BAFB4604EE70C35934354EC4343044520EE1A4255F4C90F74A28A0B89E22A04B280B8C2E09F93962576C1351E20F18C2FB83FE413A98A736955B4E4FBCF0C3CEDF12D62EA97E27C2EA4B717562F91A14EA4B0602C703F6F2CF1404B5213C320 - < --047AAC87BF2A56E61FE8559E158457E67554567296CDF9916B8C840F7FF88288BA82DD408B4CB5578C971708376E4F596442AEB0BF40886B2C8568920610B05BC6 9000 (65) [7917 ms ] - Now incorrectly returns: - 04011D92032F1C93369AAD6E701F8D8CAC73E2C7D42E9E9BA7B71793E1EE17E7D494CF799FD7AF10DE3BC787975E329D337EDDF6A10C24F77D74DCB6BBE54DB8A2 - */ - testAPDU(cardMngr, "B04200008204E2903869AF98E3C57DFDBB0DC7F6A0031B2AED0DA91E06E7B930DFD6C6C1A5F8706BAFB4604EE70C35934354EC4343044520EE1A4255F4C90F74A28A0B89E22A04B280B8C2E09F93962576C1351E20F18C2FB83FE413A98A736955B4E4FBCF0C3CEDF12D62EA97E27C2EA4B717562F91A14EA4B0602C703F6F2CF1404B5213C320", - "047AAC87BF2A56E61FE8559E158457E67554567296CDF9916B8C840F7FF88288BA82DD408B4CB5578C971708376E4F596442AEB0BF40886B2C8568920610B05BC6"); - - /* EC scalar_Point Multiplication: - scalar: 0074238D4D6B66ACC8B5C13F95BCFAD391BA183AAECA91426948F08C3321A404D0 - point : 04956587BC0F9FAF4036552905F314528E979ADBA403F9BCFD25933C7079B50E9FF6D08911DB9D33BA8FD002E9281066210D6DB58958153FBEFD85843BC6564BD5 - expect: 04D814007D111A81D1E581007B17D1BE167FE6837AA075C1154FBC13E71EDE8392F4691DB277098F466780699FC08C891CDC94A0F6F8EC59157EC8B86695878235 - correct - --> B0432100620074238D4D6B66ACC8B5C13F95BCFAD391BA183AAECA91426948F08C3321A404D004956587BC0F9FAF4036552905F314528E979ADBA403F9BCFD25933C7079B50E9FF6D08911DB9D33BA8FD002E9281066210D6DB58958153FBEFD85843BC6564BD5 - <-- 04D814007D111A81D1E581007B17D1BE167FE6837AA075C1154FBC13E71EDE8392F4691DB277098F466780699FC08C891CDC94A0F6F8EC59157EC8B86695878235 9000 (65) [3362 ms] -*/ - testAPDU(cardMngr, "B0432100620074238D4D6B66ACC8B5C13F95BCFAD391BA183AAECA91426948F08C3321A404D004956587BC0F9FAF4036552905F314528E979ADBA403F9BCFD25933C7079B50E9FF6D08911DB9D33BA8FD002E9281066210D6DB58958153FBEFD85843BC6564BD5", - "04D814007D111A81D1E581007B17D1BE167FE6837AA075C1154FBC13E71EDE8392F4691DB277098F466780699FC08C891CDC94A0F6F8EC59157EC8B86695878235"); - - - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); - System.out.println(" Done."); - - assertTrue(runCfg.failedTestsList.isEmpty(), "Some tests failed"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void bignat_problemInputs(RunConfig.CARD_TYPE cardType) { - try { - // Prepare card - RunConfig runCfg = RunConfig.getConfig(false, false, false, 1, cardType); - CardManager cardMngr = new CardManager(true, OPENCRYPTO_UNITTEST_APPLET_AID); - assertTrue(cardMngr.Connect(runCfg), "Failed to connect to card"); - cardMngr.transmit(new CommandAPDU(PerfTests.PERF_COMMAND_NONE)); - cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); - - // - // BigNatural - // - // BN Power2 (Modulo) experimental implementation: - testAPDU(cardMngr, "B0352020409A8FC09A678E50872FC4A1A138F99F655C6D4FE56EDC6D301056CE6C674CE0DE8FEDC2AF0D510008F4FE592404DDCFC38B3BE8C38FF39D564F81E1869B0D5E1B", - "56cc407db4a3d466aa3539ca3b66ab803a06f540eea79c77357a89a2e76b1169"); - testAPDU(cardMngr, "B0352020407C3C6538457F6C63C5912D04BA113F7171DEF28463A4196D6334CB5D88D12AC954BD2644639814328A4F60FB3E45087648D87985C7ED1E8346BA3F5ECFF63250", - "29369d2b579f166b2ff947df96bf8a0ff4675905415c64fcee91983ebac5d6d1"); - testAPDU(cardMngr, "B0352020406C87246CB00816779431C182084C30C769B1A04C6C8743F8160681B703C58D68C58A50BA1B8A9DF2A64EE81AE54D1C3C1D7E3ECF78B29D3FF294060335D2677E", - "513D96CB8AD8F44AE0447E0C2E2BC687AFF2139D4C561576036F12DE9350402E"); - testAPDU(cardMngr, "B0352020405F152D45F30A25237509F42D5EC3B01D9864835C1795ABA3E0ADF0452F60DD0113D154FC2548A9269B24BA617866F68588DF9B4AB17FF1015F96434BB52C915E", - "0d2168149af362b3b2efe09ec9c9d8fe463675ca3c844db149ccb3c4ba3d0b61"); - testAPDU(cardMngr, "B035202040D129C0794C0E4412E14C63907C142DFAFC97688EB1F53FCF9AAF466B06CC325EDC8FA4439BCD8E3F6392CB345A52BE128553F51E6BDFEA4E16CCB171B7B49C65", - "1492eec916bd16177f35b6e36c66139a58772d7cebe2ca6790020bf003f6c6d9"); - testAPDU(cardMngr, "B035202040E98E1277553A77AE51944A1F4C5CA0EE431CB1616F73B26A57E997A61FD4D7283A2EF0F52311B5C4156DAB4604306AA3621ADBEEC01654C1A34053CA936BB571", - "011AD0B74B558E2FCF1CCA035828993E45295861E5842CABA54EC8C4B956D226"); - testAPDU(cardMngr, "B03520204024B7BB2271FA9E0FD4D10A2E7F9594E660034863E103020EC1B1ACC14BE2A5C50F0C4063305383E4578E076527227D25A7CCB7B9BA631627D53C114115FF0663", - ""); - - // BigNatural Inversion (Modulo) - testAPDU(cardMngr, "B034300050B70EF3C6B8397C093E403D0BE1230557A0B701103DB659ED5AF81A841120C323D7C01C8BC7A2B42D7ECC22B37DEF7B5BFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", - "8EC0632A4E35CE9F1E45A35A9DCB2EDD546973D16D9A12D2BBA193DBF2754EFC"); - - // BigNatural Exponentiation: B0240100020E08 fails with FF02 - testAPDU(cardMngr, "B0240100020E08", - ""); - // BigNatural Exponentiation (Modulo): (reintroduced problem with jcardsim trimmming of result with leading zeroes) - testAPDU(cardMngr, "B033200141AF830BDC53A63B531030870D7B065223CC837DE4F9EB59C5FEAD4FBA7EBFF1A50203BC5F27F2EFE641CB11AF114A0CEFE680792A02425A257472B5F14235ADAD83", - "509360e9092835050296e07edae32577cc85aa5b2826545749c2d1f7a87abf"); - - // SQRT: this input will call mod_exp() with this to be zero => subsequent problem in shrink() - testAPDU(cardMngr, "B02620002000DF0EFC062866435464C1BCBF84D63A4A0FCB014E0D99666152F582787DEF78", - ""); - - // BigNatural Exponentiation (Modulo): - testAPDU(cardMngr, "B0332001410DE9847BA48DB897190C7DAA01B671035D2F5D3C3AA4C4C42EE373D4551E023902C5F01D0548C751376E587A019ACC1FEFA2332E535804C78CEDF43806E6B73351", - "0778b9572a6a589a7c5a2a2004862b0365e5d8af57839644e8f58d427c2eb784"); - - // BigNatural Exponentiation (Modulo): - testAPDU(cardMngr, "B03320014104E83559CB11AA9E4FC4E9BD30A7561B16C4FA35A0E1FD9E928EB9B131474CBD02D896150E59B429E89E54C116E51FD8D5FE71090C80472FFC7D8C652D65A509E5", - "d3cd532b396dd52ac64affd1bfee9790912e867735941d75a163102e0ce7aa"); - testAPDU(cardMngr, "B03320013FC509E0ABDD401F1586F88627866AFD469CB6FD1380B53ACF200E22FA7E4810EF0235FD5AAAD2ADB623BE5DCF80D67E603F269E568F6F1C3BBD6A8627EC3140", - ""); - - /* BigNatural Exponentiation (Modulo): - num1: 9a8c640610ba423c257ac4b839b82966ff92ab183a3b16cfc4b2a8884d546ed - num2: 2 - num3: eaf125899a9f23872f816450608837ba204fe6c1cd524fb208532a870d76 - --> B03320013F09A8C640610BA423C257AC4B839B82966FF92AB183A3B16CFC4B2A8884D546ED02EAF125899A9F23872F816450608837BA204FE6C1CD524FB208532A870D76 - <-- 25BB994E37B9A731D460D523016F08D9ADAB2A4911A4F6D8C0CF0F66A738 9000 (30) [3725 ms] - Expected: 6343776f5b72dca439def7270bbae68b5f4f60840bb05e95f443e5006055 - Obtained: 25bb994e37b9a731d460d523016f08d9adab2a4911a4f6d8c0cf0f66a738 - false - */ - testAPDU(cardMngr, "B03320013F09A8C640610BA423C257AC4B839B82966FF92AB183A3B16CFC4B2A8884D546ED02EAF125899A9F23872F816450608837BA204FE6C1CD524FB208532A870D76", - "6343776F5B72DCA439DEF7270BBAE68B5F4F60840BB05E95F443E5006055"); - - System.out.print("Disconnecting from card..."); - cardMngr.Disconnect(true); - System.out.println(" Done."); - - assertTrue(runCfg.failedTestsList.isEmpty(), "Some tests failed"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void openCrypto_ECExample() throws Exception { - RunConfig runCfg = RunConfig.getConfig(false, false, false, 1, RunConfig.CARD_TYPE.JCARDSIMLOCAL); - //RunConfig runCfg = RunConfig.getConfig(false, false, false, 1, RunConfig.CARD_TYPE.PHYSICAL); - runCfg.appletToSimulate = ECExample.class; - CardManager cardMngr = new CardManager(true, OPENCRYPTO_UNITTEST_APPLET_AID); - assertTrue(cardMngr.Connect(runCfg), "Failed to connect to card"); - cardMngr.transmit(new CommandAPDU(PerfTests.PERF_COMMAND_NONE)); - cardMngr.Disconnect(true); - } - - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @BeforeMethod - public void setUpMethod() throws Exception { - } - - @AfterMethod - public void tearDownMethod() throws Exception { - } -} diff --git a/PERFORMANCE.md b/PERFORMANCE.md new file mode 100644 index 00000000..cb9120a8 --- /dev/null +++ b/PERFORMANCE.md @@ -0,0 +1,50 @@ +## Performance results +The results presented are extracted from the unit tests execution; values shown are in milliseconds (ms). If the operation is **unsupported**, the `--` value is shown. The time measured starts with APDU send (triggering the target operation) and ends when the response is received, thus containing also data transmission and on-card data preparation overhead (the operation itself is somewhat faster). Consult the source code in UnitTests.java for target instruction (INS) to see all steps included in measurement. + +### Notes + * Taisys SIMoME Vault does not support all JCMathLib operations and we do not know how to make full support + * Infineon SECORA ID S can be likely optimized for faster performance, working on it + + +| Operation (time in ms) | NXP JCOP4 J3R200 P71 (16.7.2023) | NXP JCOP3 J3H145 P60 (16.7.2023) | Infineon SECORA ID S (16.7.2023) | GD Smartcafe 7.0 (16.7.2023) | Taisys SIMoME Vault (16.7.2023) | +| --- | --- | --- | --- | --- | --- | +| bigNatAddition/INS_BN_ADD | 27 | 38 | 26 | 18 | 55 | +| bigNatMod/INS_BN_MOD | 47 | 49 | 61 | 43 | 67 | +| bigNatModAdd/INS_BN_ADD_MOD | 45 | 57 | 54 | 32 | 66 | +| bigNatModExp/INS_BN_EXP_MOD | 55 | 67 | 1677 | 537 | -- | +| bigNatModInv/INS_BN_INV_MOD | 58 | 72 | 1686 | 556 | -- | +| bigNatModMult/INS_BN_MUL_MOD | 180 | 233 | 1064 | 660 | 760 | +| bigNatModSq/INS_BN_SQ_MOD | 65 | 75 | 1075 | 564 | -- | +| bigNatModSqrt/INS_BN_SQRT_MOD | 328 | 445 | 4722 | 1438 | -- | +| bigNatModSub/INS_BN_SUB_MOD | 45 | 75 | 55 | 45 | 54 | +| bigNatMultiplication/INS_BN_MUL | 145 | 199 | 517 | 164 | 400 | +| bigNatMultiplicationSlow/INS_BN_MUL_SCHOOL | 340 | 590 | 540 | 461 | 769 | +| bigNatSetValue/INS_BN_SET_VALUE | 19 | 21 | 31 | 17 | 18 | +| bigNatShiftRight/INS_BN_SHIFT_RIGHT | 21 | 29 | 22 | 14 | 46 | +| bigNatSq/INS_BN_SQ | 41 | 37 | 514 | 23 | 47 | +| bigNatStorage/INS_BN_STR | 20 | 21 | 22 | 10 | 23 | +| bigNatSubtraction/INS_BN_SUB | 40 | 51 | 51 | 30 | 54 | +| eccAdd/INS_EC_ADD | 86 | 250 | 5291 | 2723 | -- | +| eccDoubleGenerator/INS_EC_DBL | 60 | 201 | 182 | 3113 | -- | +| eccDoubleRandom/INS_EC_DBL | 64 | 202 | 179 | 3106 | -- | +| eccEncode(compressed_in)/INS_EC_ENCODE | 576 | 797 | 6943 | 2718 | -- | +| eccEncode(compressed_in_out)/INS_EC_ENCODE | 572 | 794 | 6944 | 2724 | -- | +| eccEncode(compressed_out)/INS_EC_ENCODE | 25 | 25 | 32 | 14 | 60 | +| eccEncode(uncompressed_in_out)/INS_EC_ENCODE | 29 | 37 | 46 | 20 | 51 | +| eccFromX/INS_EC_FROM_X | 604 | 773 | 6989 | 2737 | -- | +| eccGen/INS_EC_GEN | 45 | 226 | 127 | 201 | 1244 | +| eccIsEqual/INS_EC_COMPARE | 47 | 75 | 158 | 57 | 134 | +| eccIsYEven/INS_EC_IS_Y_EVEN | 23 | 36 | 65 | 24 | 69 | +| eccMultRandomAndAdd/INS_EC_MUL_ADD | 91 | 255 | 5441 | 5823 | -- | +| eccMultiplyGenerator/INS_EC_MUL | 73 | 209 | 211 | 3131 | -- | +| eccMultiplyRandom/INS_EC_MUL | 71 | 206 | 207 | 3110 | -- | +| eccNegation/INS_EC_NEG | 60 | 91 | 145 | 69 | 370 | +| integerAddition/INS_INT_ADD | 12 | 22 | 18 | 14 | 28 | +| integerDivision/INS_INT_DIV | 31 | 29 | 42 | 26 | 49 | +| integerModulo/INS_INT_MOD | 14 | 18 | 26 | 14 | 27 | +| integerMultiplication/INS_INT_MUL | 61 | 81 | 110 | 65 | 104 | +| integerStorage/INS_INT_STR | 9 | 11 | 13 | 7 | 15 | +| integerSubtraction/INS_INT_SUB | 20 | 41 | 61 | 20 | 31 | + + + diff --git a/README.md b/README.md index 40ef1794..f3225d27 100644 --- a/README.md +++ b/README.md @@ -1,246 +1,177 @@ [![MIT licensed](https://img.shields.io/github/license/OpenCryptoProject/JCMathLib)](https://github.com/OpenCryptoProject/JCMathLib/blob/master/LICENSE)

- +

-The JCMathLib is an open-source library for Java Card platform which provides objects and operations otherwise missing from standard Java Card API. Namely, we focus on adding support for low-level operations like addition or multiplication of points on elliptic curves in resource efficient way. As a bonus, we provide tooling for [shared memory management](https://github.com/OpenCryptoProject/JCMathLib/wiki/Main-components) and [performance optimization](https://github.com/OpenCryptoProject/JCProfiler). +JCMathLib is an open-source library for the JavaCard platform that aims to enable low-level cryptographic computations +unavailable in the standard JavaCard API. In particular, it focuses on providing efficient modular arithmetic and +elliptic curve operations. -The project comes in three parts: -* **JCMathLib** - the javacard library itself (on-card code) -* **JCMathLibExamples** - the simple testing Java client (PC-side client code with simple examples) -* **JCMathLibTests** - the client to thoroughly test all operations and measure performance (PC-side client) +If you want to get into the technical details of JCMathLib, you can find them in this +paper: https://arxiv.org/abs/1810.01662. -If you want get into the math and the technical details explaining why things in JCMathLib work the way they do, you can find our paper here: https://arxiv.org/abs/1810.01662 +## Table of Contents + +- [Features and Limitations](#features-and-limitations) +- [Getting Started](#getting-started) +- [Integration With Your Applet](#integration-with-your-applet) +- [Community](#community) + +## Features and Limitations + +JCMathLib includes the following features: + +- BigNat arithmetic including modular operations +- Elliptic curve point addition and multiplication +- Option to accelerate computation by utilizing `int` native type on smartcards that support it ( + branch `ints`) +- No dependencies on proprietary interfaces (only public JavaCard API) +- Selection of appropriate algorithm implementation based on the card's algorithm support (`OperationSupport`) +- Resource management (`ObjectAllocator`, `ObjectLocker`) +- Predefined common elliptic curves (`SecP256r1`, `SecP256k1`, `SecP512r1`) +- Tool for packaging JCMathLib into a single file for easy integration + +Although higher-level cryptographic primitives and protocols can be constructed using JCMathLib, they are not included +in the library. In case you need a higher-level implementation, you may try looking for projects building on top +of JCMathLib (e.g., see [our users](#our-users)). + +As JCMathLib is implemented for the JavaCard Platform and relies only on public JavaCard API, it is not as efficient +as a native implementation could be. This approach has a number of advantages, like easy portability and the possibility +to open-source code. However, it makes it much harder (if not impossible) to perform the operations in constant time, +and we do not aim to. The library is thus vulnerable to timing side-channel attacks and **is NOT suited for production +use**. + +## Getting Started + +Clone this repository: -If you want to cite this library: ``` -@article{2020-jcmathlib-cybercert, - Title = {JCMathLib: Wrapper Cryptographic Library for Transparent and Certifiable JavaCard Applets}, - Author = {Vasilios Mavroudis and Petr Svenda}, - Conference = {2020 IEEE European Symposium on Security and Privacy Workshops}, - Year = {2020}, - Pages = {89--96}, - Publisher = {IEEE}, -} +git clone --recurse-submodules https://github.com/OpenCryptoProject/JCMathLib.git ``` +For compilation for JavaCards, you need to obtain JavaCard SDKs, which are included as submodule. If you did not use `--recurse-submodules` in the previous command and your libs-sdks folder is empty, run: -### Project supporters -JCMathLib is kindly supported by: -


- -

+``` +git submodule update --init --recursive +``` +Before using JCMathLib in your projects, you should test that it works properly on your smartcard. For that, you may want to run UnitTests. If you plan to work only with a simulator, you can skip to the last step of [the following section](#running-unit-tests). -## Quickstart +### Running unit tests -### Example Applet Compilation, Upload and Use +1. Set your card type in the `JCMathLib/applet/src/main/java/opencrypto/jcmathlib/UnitTests` class. The supported options are listed in class `OperationSupport.{SIMULATOR, JCOP21, JCOP3_P60, JCOP4_P71, GD60, GD70, SECORA}`. -Install [Apache Ant](https://ant.apache.org/). +```java +public class UnitTests extends Applet { + public final static short CARD_TYPE = OperationSupport.SIMULATOR; // TODO set your card here +``` + +2. OPTIONAL (depending on card selected in step 1). Change the JavaCard API version in `applet/build.gradle` file if you wish to run the code on cards with a JavaCard API version different from 3.0.5. -Download the whole repo and open command line in project's root directory. +``` +// JC310b43 supports building also for lower versions (cap.targetsdk). +// If another SDK is selected, please comment the cap.targetsdk setting. +final def JC_SELECTED = JC310b43 <---- +... +// JC310b43 supports compilation targeting for lower API versions. +// Here you can specify path to the SDK you want to use. +// Only JC304 and higher are supported for targeting. +// If JC310b43 is not used, targetsdk cannot be set. +targetsdk JC305 <---- +``` +If you would like to build for lower versions, comment out line with `targetsdk JC305` and set `final def JC_SELECTED = JC310b43` to other value like `final def JC_SELECTED = JC222`. +The list of settings is summarized here: +| Card | `OperationSupport` | `JC_SELECTED` | `targetsdk` | Notes | +| --- | --- | --- | --- | --- | +| [jCardSim simulator](https://github.com/licel/jcardsim/) | SIMULATOR | -- | -- | (JavaCard API settings are ignored) | +| [NXP J2E145G](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/NXP_J2E145G_ICFabDate_2013_025_ALGSUPPORT__3b_f9_13_00_00_81_31_fe_45_4a_43_4f_50_32_34_32_52_33_a2_(provided_by_PetrS_and_Lukas_Malina).csv) | JCOP21 | JC303 | remove | | +| [NXP JCOP3 J3H145 P60](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/NXP_JCOP3_J3H145_SECID_P60_ALGSUPPORT__3b_11_95_80_(provided_by_Luka_Logar_and_Rowland_Watkins_and_PetrS).csv) | JCOP3_P60 | JC310b43 | JC304 | | +| [NXP JCOP4 J3Rxxx P71](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/NXP_JCOP4_J3R180_P71_ALGSUPPORT__3b_fa_18_00_ff_10_00_4a_54_61_78_43_6f_72_65_56_31_(provided_by_PetrS).csv) | JCOP4_P71 | JC310b43 | JC305 | | +| [G+D Sm@rtcafe 6.0](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/G%2BD_Smartcafe_6.0_80K_ICFabDate_2015_024_ALGSUPPORT__3b_fe_18_00_00_80_31_fe_45_53_43_45_36_30_2d_43_44_30_38_31_2d_6e_46_a9_(provided_by_PetrS).csv) | GD60 | JC303 | remove | | +| [G+D Sm@rtcafe 7.0](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/G%2BD_SmartCafe_7.0_215K_USB_Token_S_ALGSUPPORT__3b_f9_96_00_00_81_31_fe_45_53_43_45_37_20_0e_00_20_20_28_(provided_by_PetrS).csv) | GD70 | JC310b43 | JC304 | | +| [Infineon Secora ID S](https://github.com/crocs-muni/jcalgtest_results/blob/main/javacard/Profiles/results/Infineon_SECORA_ID_S_(SCP02_with_RSA2k_JC305_GP230_NOT_FOR_SALE_-_PROTOTYPE_ONLY)_ALGSUPPORT__3b_b8_97_00_c0_08_31_fe_45_ff_ff_13_57_30_50_23_00_6a_(provided_by_Thoth).csv) | SECORA | JC310b43 | JC305 | (may require AES256 GP keys) | -To compile the repo, navigate in the JCMathLib directory and run: +3. Build the applet by running the following command. ``` -ant -f jcbuild.xml unittests +./gradlew buildJavaCard ``` -This will generate an output similar to this: +4. If the build completes successfully, you may install it on a card by running the following command. In case you +encounter some issues, you may want to try using [GlobalPlatformPro](https://github.com/martinpaljak/GlobalPlatformPro) +directly and install the built cap file `applet/build/javacard/unit_tests.cap`. + +``` +./gradlew installJavaCard ``` ->ant -f jcbuild.xml unittests -Buildfile: C:\Users\pc\Desktop\JCMathLib\JCMathLib\jcbuild.xml -unittests: - [cap] INFO: using JavaCard 3.0.1 SDK in ext\java_card_kit-3_0_3-win - [cap] INFO: Setting package name to opencrypto.jcmathlib - [cap] Building CAP with 1 applet from package opencrypto.jcmathlib (AID: 556E697454657374) - [cap] opencrypto.jcmathlib.OCUnitTests 556E69745465737473 - [compile] Compiling files from C:\Users\pc\Desktop\JCMathLib\JCMathLib\src\opencrypto\jcmathlib - [compile] Compiling 17 source files to C:\Users\pc\AppData\Local\Temp\jccpro2108652080958352651 - [convert] [ INFO: ] Converter [v3.0.3] - [convert] [ INFO: ] Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - [convert] - [convert] - [convert] [ INFO: ] conversion completed with 0 errors and 0 warnings. - [javacard] NB! Please use JavaCard SDK 3.0.5u3 or later for verifying! - [verify] Verification passed - [cap] CAP saved to C:\Users\pc\Desktop\JCMathLib\JCMathLib\!uploader\jcmathlib_unittests.cap +If the installation completes successfully, you can run the tests. If the `UnitTests` contain your card type, the +following command will try to run the tests with a connected card. Otherwise, it will run the tests just in a simulator. + +``` +./gradlew --rerun-tasks test ``` -If you are using windows and you get the error message ```No usable JavaCard SDK referenced```, edit jcbuild.xml to use one of the Windows SDKs. To download a compatible JDK please use 1.8.0-152 (8u152, https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html) and set your Java path to it. +If you have multiple readers connected to your device, you may need to adjust the reader +index (`runCfg.setTargetReaderIndex` in `JCMathLib/applet/src/test/java/tests/BaseTest`). +### Example usage -**Upload and Install Applet to Card** +For an example usage of the library, see the [`Example`](applet/src/main/java/opencrypto/jcmathlib/Example.java) applet. + +## Integration With Your Applet + +To enable easy integration of JCMathLib with your applet, we provide a Python script that bundles JCMathLib into a +single `.java` that can be included in your code. + +The script provides the following interface, allowing to specify which parts of JCMathLib to include (to save memory). -From the '!uploader' directory, use [GlobalPlatformPro](https://github.com/martinpaljak/GlobalPlatformPro) to upload jcmathlib_example.cap. ``` -gp -install jcmathlib_unittests.cap -v +$ python package.py -h +usage: package.py [-h] [-d DIR] [-k] [-c {SecP256k1,SecP256r1,SecP512r1} [{SecP256k1,SecP256r1,SecP512r1} ...]] [-p PACKAGE] [-o OUTPUT] + +Package the JCMathLib library into a single file. + +options: + -h, --help show this help message and exit + -d DIR, --dir DIR Directory to package + -k, --keep-locks Keep locks + -c {SecP256k1,SecP256r1,SecP512r1} [{SecP256k1,SecP256r1,SecP512r1} ...], --curves {SecP256k1,SecP256r1,SecP512r1} [{SecP256k1,SecP256r1,SecP512r1} ...] + Curves to include + -p PACKAGE, --package PACKAGE + Package name + -o OUTPUT, --output OUTPUT + Output file ``` -This will generate an output similar to this: + +For example, to bundle JCMathLib for your applet `test` in which you use curve `SecP256k1`, use the following. The +output will be stored in `jcmathlib.java` file. + ``` ->gp -install jcmathlib_unittests.cap -v -Reader: Generic EMV Smartcard Reader 0 -... -CAP file (v2.1) generated on Tue Jul 25 14:34:17 CEST 2017 -By Sun Microsystems Inc. converter 1.3 with JDK 1.8.0_65 (Oracle Corporation) -Package: opencrypto.jcmathlib v0.0 -Applet: UnitTests with AID 556E69745465737473 -Import: A0000000620001 v1.0 -Import: A0000000620101 v1.3 -Import: A0000000620102 v1.3 -Import: A0000000620201 v1.3 -Installing applet from package opencrypto.jcmathlib -``` -If applet is already installed, you can uninstall it first using the *-uninstall* switch. - -**Trigger EC operations in process() method: 'gp -apdu '** -``` -gp --apdu 00a4040009556e69745465737473 --apdu 0b000000 -d -``` -(which results in output similar to this) -``` ->gp --apdu 00a4040009556e69745465737473 --apdu 0b000000 -d -# Detected readers from SunPCSC -[*] Generic EMV Smartcard Reader 0 -SCardConnect("Generic EMV Smartcard Reader 0", T=*) -> T=1, 3BF91300008131FE454A434F503234325233A2 -SCardBeginTransaction("Generic EMV Smartcard Reader 0") -A>> T=1 (4+0009) 00A40400 09 556E69745465737473 -A<< (0000+2) (21ms) 9000 -A>> T=1 (4+0000) 0B000000 <---------------- THIS COMMAND TRIGGERED OUR EC OPERATIONS! -A<< (0000+2) (8s378ms) 9000 -... -SCardEndTransaction() -SCardDisconnect("Generic EMV Smartcard Reader 0", false) +$ python package.py -p test -c SecP256k1 -o jcmathlib.java ``` -The code below shows a very simple applet demonstrating the use of the ECPoint class and other basic operations. Notice that memory allocation is happening only in the applet's constructor. This is common (and good) Java Card development practice. +## Community -```java -package opencrypto.jcmathlib; - -public class ECExample extends javacard.framework.Applet { - ECConfig ecc = null; - ECCurve curve = null; - ECPoint point1 = null; - ECPoint point2 = null; - - final static byte[] ECPOINT_TEST_VALUE = {(byte)0x04, (byte) 0x3B, (byte) 0xC1, (byte) 0x5B, (byte) 0xE5, (byte) 0xF7, (byte) 0x52, (byte) 0xB3, (byte) 0x27, (byte) 0x0D, (byte) 0xB0, (byte) 0xAE, (byte) 0xF2, (byte) 0xBC, (byte) 0xF0, (byte) 0xEC, (byte) 0xBD, (byte) 0xB5, (byte) 0x78, (byte) 0x8F, (byte) 0x88, (byte) 0xE6, (byte) 0x14, (byte) 0x32, (byte) 0x30, (byte) 0x68, (byte) 0xC4, (byte) 0xC4, (byte) 0x88, (byte) 0x6B, (byte) 0x43, (byte) 0x91, (byte) 0x4C, (byte) 0x22, (byte) 0xE1, (byte) 0x67, (byte) 0x68, (byte) 0x3B, (byte) 0x32, (byte) 0x95, (byte) 0x98, (byte) 0x31, (byte) 0x19, (byte) 0x6D, (byte) 0x41, (byte) 0x88, (byte) 0x0C, (byte) 0x9F, (byte) 0x8C, (byte) 0x59, (byte) 0x67, (byte) 0x60, (byte) 0x86, (byte) 0x1A, (byte) 0x86, (byte) 0xF8, (byte) 0x0D, (byte) 0x01, (byte) 0x46, (byte) 0x0C, (byte) 0xB5, (byte) 0x8D, (byte) 0x86, (byte) 0x6C, (byte) 0x09}; - - final static byte[] SCALAR_TEST_VALUE = {(byte) 0xE8, (byte) 0x05, (byte) 0xE8, (byte) 0x02, (byte) 0xBF, (byte) 0xEC, (byte) 0xEE, (byte) 0x91, (byte) 0x9B, (byte) 0x3D, (byte) 0x3B, (byte) 0xD8, (byte) 0x3C, (byte) 0x7B, (byte) 0x52, (byte) 0xA5, (byte) 0xD5, (byte) 0x35, (byte) 0x4C, (byte) 0x4C, (byte) 0x06, (byte) 0x89, (byte) 0x80, (byte) 0x54, (byte) 0xB9, (byte) 0x76, (byte) 0xFA, (byte) 0xB1, (byte) 0xD3, (byte) 0x5A, (byte) 0x10, (byte) 0x91}; - - - public ECExample() { - // Pre-allocate all helper structures - ecc = new ECConfig((short) 256); - // Pre-allocate standard SecP256r1 curve and two EC points on this curve - curve = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r); - point1 = new ECPoint(curve, ecc.ech); - point2 = new ECPoint(curve, ecc.ech); - } - // Installation of our applet - public static void install(byte[] bArray, short bOffset, byte bLength) { - new ECExample().register(); - } - public boolean select() { - // Restore values which were cleared after card reset - ecc.refreshAfterReset(); - return true; - } - - // NOTE: very simple EC usage example - no cla/ins, no communication with host... - public void process(javacard.framework.APDU apdu) { - if (selectingApplet()) { return; } // Someone is going to use our applet! - - // Generate first point at random - point1.randomize(); - // Set second point to predefined value - point2.setW(ECPOINT_TEST_VALUE, (short) 0, (short) ECPOINT_TEST_VALUE.length); - // Add two points together - point1.add(point2); - // Multiply point by large scalar - point1.multiplication(SCALAR_TEST_VALUE, (short) 0, (short) SCALAR_TEST_VALUE.length); - } -} -``` -### Run Example Client -Browse into the JCMathLibExamples directory and run: - -```ant -f build.xml compile``` - -This will compile the Java testing client. In the case of errors during the compilation, edit build.xml for your setup (e.g., use the Windows versions of the dependencies). If the compilation succeeds, then run: - -```ant -f build.xml run``` - -The run task uses the "noverify" flag for the JVM. If this generates an error in your setup, you can edit the relevant section in build.xml. - -## Example Code -```java -package opencrypto.jcmathlib; - - // ... in applet's constructor - // Pre-allocate all helper structures - ECConfig ecc = new ECConfig((short) 256); - // Pre-allocate standard SecP256r1 curve and two EC points on this curve - ECCurve curve = new ECCurve(false, SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r); - ECPoint point1 = new ECPoint(curve, ecc.ech); - ECPoint point2 = new ECPoint(curve, ecc.ech); - - // ... in standard Java Card applet code - // Generate first point at random - point1.randomize(); - // Set second point to predefined value - point2.setW(ECPOINT_TEST_VALUE, (short) 0, (short) ECPOINT_TEST_VALUE.length); - // Add two points together - point1.add(point2); - // Multiply point by large scalar - point1.multiplication(SCALAR_TEST_VALUE, (short) 0, (short) SCALAR_TEST_VALUE.length); -``` - -## FAQ -**Q:** Hold on, I thought elliptic curves are already supported on smart cards, right?
-**A:** Definitely not on each one. Take a look at [jcalgtest.org](http://jcalgtest.org) - out of 65 cards listed, only about 1/3 have some support. - -**Q:** I will just download some 3rd party implementation like Bouncy Castle and run it on a card. So why are you developing this library?
-**A:** Not that easy. The most Java Cards don't support *BigInteger* and usually not even *int* datatype. Even if you will change the code and finally compile, it will be impractically slow due to card's 40MHz CPU and 3KB RAM. That's why smart card manufacturers add dedicated coprocessor to speed up operations like modular multiplication (RSA) or elliptic curve point manipulation (ECC). - -**Q:** So if there is cryptographic coprocessor, I can do decrypt, sign or run key establishment directly on the card, right?
-**A:** Yes, usually in the order of hundreds of milliseconds for asymmetric crypto. But if you like to build something fancier like multi-party secure communication protocols, blind signatures or attribute-based crypto which requires low-level operations, you are out of luck with standard Java Card API. - -**Q:** ECPoint is not included in standard Java Card API?
-**A:** No, it is not supported. You can still get ECPoint operations you want via additional manufacturer proprietary API which usually means also signing NDA and get bound to a particular manufacturer. - -**Q:** How your library can provide ECPoint if the port from Bouncy Castle is not a viable option?
-**A:** We use card's fast co-processors in unintended ways (raw RSA for fast multiplication, ECDH KeyAgreement for point multiplication...) and combine with software-only snippets to construct the required operations running as fast possible. - -**Q:** So you provide these missing operations in an efficient way. Are there any disadvantages with respect to a manufacturer's native implementation?
-**A:** We are slower if an operation requires computing lot of additional steps in a software-only manner. Also, native implementation is more resistant against side-channel and fault induction attacks. - -**Q:** Do you support ECPoint operations on cards which are complete without the EC support?
-**A:** No, we need at least ECDH key agreement operation and new EC key pair generation supported on a target card. However, you can use fast operations with big numbers (Bignat, BigInteger - part of JCMathLib) even on cards without EC support. - -**Q:** Sounds good, how can I start to fiddle with the JCMathLibrary library?
-**A:** Buy [suitable](https://www.fi.muni.cz/~xsvenda/jcalgtest/) JavaCard for $10-20 with EC support ([buyers'guide](https://github.com/martinpaljak/GlobalPlatformPro/tree/master/docs/JavaCardBuyersGuide#javacard-buyers-guide-of-2015)), download this library source code, compile example project with [ant-javacard](https://github.com/martinpaljak/ant-javacard) and start playing. Don't forget to read [wiki](https://github.com/mavroudisv/JCMathLib/wiki) for examples and tutorials. - -## Advantages and potential drawbacks -**Advantages:** - * Availability of low-level ECPoint operations (not included in standard javacard API) without a need to use a proprietary API (which usually requires signing a non-disclosure agreement). - * Code portability between smart cards from different manufacturers. - * Possibility to use open-source simulator [JCardSim](https://jcardsim.org/) instead of vendor-specific one. - -**Potential drawbacks (in comparison to vendor-specific API):** - * Slower speed for some EC operations like addition or scalar multiplication (see [wiki](https://github.com/OpenCryptoProject/JCMathLib/wiki#performance-and-memory-overhead) for times measured on real cards - * RAM memory overhead (about 1kB for fastest performance). Is configurable with an option to place all temporary objects in EEPROM (slower performance). - * Lower resilience against various side-channel and fault-induction attacks. - - -## Future work -* Additional optimizations and methods (remainder_divide is particular target) -* Support for other curves like Ed25519 -* Long-term vision: support for easy transfer of the Bouncy Castle-enabled crypto code to Java Card environment - -### Happy users so far -(If you can't find yourself here, please let us know via [Issues](https://github.com/OpenCryptoProject/JCMathLib/issues)) +JCMathLib is kindly supported by: + +

+ +

+ +### How to contribute + +We welcome all contributions, but we especially appreciate contributions in the following form: + +- **Code improvements.** If you discover a bug or have an idea for improving the code, please, submit the change in a [Pull Request](https://github.com/OpenCryptoProject/JCMathLib/pulls). +- **Features.** If you wish certain feature was included in JCMathLib, let us know via [Issues](https://github.com/OpenCryptoProject/JCMathLib/issues) or implement it yourself and submit a [Pull Request](https://github.com/OpenCryptoProject/JCMathLib/pulls). +- **Testing on cards.** If you have a smart card model that is not yet included in JCMathLib and you manage to get it working, please, create a pull request with the corresponding `OperationSupport` configuration and include information about the smart card. Also consider submitting your card results to [JCAlgTest](https://jcalgtest.cz/). + +### Our users * [Myst](https://github.com/OpenCryptoProject/Myst): Secure Multiparty Key Generation, Signature and Decryption JavaCard applet and host application + * [BioID](https://eprint.iacr.org/2019/894.pdf): a Privacy-Friendly Identity Document + * [JCEd25519](https://github.com/dufkan/JCEd25519): a JavaCard implementation of Ed25519 signing + +(If you can't find yourself here, please let us know via [Issues](https://github.com/OpenCryptoProject/JCMathLib/issues)) diff --git a/applet/build.gradle b/applet/build.gradle new file mode 100644 index 00000000..3ee48f70 --- /dev/null +++ b/applet/build.gradle @@ -0,0 +1,183 @@ +group 'test-applet' +version '2.0' + +// Buildscript configuration for the javacard-gradle plugin. +// Do not modify this particular block. Dependencies for the project are lower. +buildscript { + repositories { + mavenCentral() + maven { url "https://javacard.pro/maven" } + maven { url "https://deadcode.me/mvn" } + // mavenLocal() + } + dependencies { + classpath 'com.klinec:gradle-javacard:1.8.0' + } +} + +apply plugin: 'com.klinec.gradle.javacard' +apply plugin: 'idea' +apply plugin: 'application' +sourceCompatibility = 1.8 + +// Common settings, definitions +final def rootPath = rootDir.absolutePath +final def libs = rootPath + '/libs' +final def libsSdk = rootPath + '/libs-sdks' + +// Repositories for your project +repositories { + mavenCentral() + // mavenLocal() // for local maven repository if needed + + // Repository with JCardSim, Globalplatform, etc, ... + maven { url "https://javacard.pro/maven" } + maven { url "https://deadcode.me/mvn" } + + // Local lib repository + flatDir { + dirs libs + } +} + +// Dependencies for your project +dependencies { + jcardsim 'com.klinec:jcardsim:3.0.6.0' + + implementation 'com.klinec:jcardsim:3.0.6.0' + implementation 'org.bouncycastle:bcprov-jdk15on:1.58' + + testImplementation 'org.testng:testng:6.1.1' + testImplementation 'org.slf4j:slf4j-api:1.7.33' + testImplementation 'org.slf4j:slf4j-log4j12:1.7.33' + testImplementation 'org.apache.logging.log4j:log4j-core:2.17.0' + testImplementation 'junit:junit:4.13.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1' + + testImplementation(group: 'com.klinec', name: 'javacard-tools', version: '1.0.4') { + exclude group: "com.klinec", module: "jcardsim" + } + + // Include plugin as it has bundled GP & other tools. + // Alternative: include GP manually, but the included + // version has to be compatible with the plugin. + runtimeOnly 'com.klinec:gradle-javacard:1.8.0' +} + +task dumpClassPath(dependsOn: ['idea']) { + doLast { + println "Gradle classpath:\n- " + configurations.compile.files*.name.join("\n- ") + println "-------\n" + println "IDEA classpath: \n- " + file(project.name + ".iml").readLines() + .grep(~/.*"jar:.*/).collect { it.split("[\\/]")[-3].trim() }.join("\n- ") + println "-------\n" + } +} + +application { + mainClass = 'main.Run' +} + +test { + // useTestNG() + useJUnitPlatform { + excludeTags 'manual' + } + + task manualTests(type: Test) { + useJUnitPlatform { + includeTags 'manual' + } + check.dependsOn it + shouldRunAfter test + } +} + +// JavaCard SDKs and libraries +final def JC212 = libsSdk + '/jc212_kit' +final def JC221 = libsSdk + '/jc221_kit' +final def JC222 = libsSdk + '/jc222_kit' +final def JC303 = libsSdk + '/jc303_kit' +final def JC304 = libsSdk + '/jc304_kit' +final def JC305 = libsSdk + '/jc305u1_kit' +final def JC305u2 = libsSdk + '/jc305u2_kit' +final def JC305u3 = libsSdk + '/jc305u3_kit' +final def JC310b43 = libsSdk + '/jc310b43_kit' + +// Which JavaCard SDK to use - select +// In order to compile JC222 and lower you have to have Java SDK <= 1.8 +// For more info on JavaCard vs JDK version requirements inspect: +// https://github.com/martinpaljak/ant-javacard/wiki/Version-compatibility +// +// JC310b43 supports building also for lower versions (cap.targetsdk). +// If another SDK is selected, please comment the cap.targetsdk setting. +final def JC_SELECTED = JC310b43 + +javacard { + + //noinspection GroovyAssignabilityCheck + config { + jckit JC_SELECTED + + // Using custom repo with jcardsim + debugGpPro true + addImplicitJcardSim false + addImplicitJcardSimJunit false + + //noinspection GroovyAssignabilityCheck + cap { + packageName 'opencrypto.jcmathlib' + version project.version + aid '4a:43:4d:61:74:68:4c:69:62' + output 'unit_tests.cap' + sources 'src/main/java/opencrypto' + + // JC310b43 supports compilation targeting for lower API versions. + // Here you can specify path to the SDK you want to use. + // Only JC304 and higher are supported for targeting. + // If JC310b43 is not used, targetsdk cannot be set. + targetsdk JC305 + + // Override java bytecode version if needed. + // javaversion '1.7' + + //noinspection GroovyAssignabilityCheck + applet { + className 'opencrypto.jcmathlib.UnitTests' + aid '4a:43:4d:61:74:68:4c:69:62:55:54' + } + + //noinspection GroovyAssignabilityCheck + // dependencies { + // remote 'com.klinec:globalplatform:2.1.1' + // } + } + + // When both cap configurations are present, task installJavaCard cannot be used + // cap { + // packageName 'opencrypto.jcmathlib' + // version project.version + // aid '4a:43:4d:61:74:68:4c:69:62' + // output 'example.cap' + // sources 'src/main/java/opencrypto' + + // targetsdk JC304 + + // // Override java bytecode version if needed. + // // javaversion '1.7' + + // //noinspection GroovyAssignabilityCheck + // applet { + // className 'opencrypto.jcmathlib.Example' + // aid '4a:43:4d:61:74:68:4c:69:62:45:43' + // } + + // //noinspection GroovyAssignabilityCheck + // // dependencies { + // // remote 'com.klinec:globalplatform:2.1.1' + // // } + // } + } +} + diff --git a/applet/src/main/java/main/Run.java b/applet/src/main/java/main/Run.java new file mode 100644 index 00000000..2adb80a7 --- /dev/null +++ b/applet/src/main/java/main/Run.java @@ -0,0 +1,21 @@ +package main; + +import com.licel.jcardsim.smartcardio.CardSimulator; +import com.licel.jcardsim.utils.AIDUtil; +import javacard.framework.AID; +import opencrypto.jcmathlib.Example; +import org.bouncycastle.util.encoders.Hex; +import javax.smartcardio.CommandAPDU; + +public class Run { + public static void main(String[] args) throws Exception { + CardSimulator simulator = new CardSimulator(); + + AID appletAID = AIDUtil.create("Example".getBytes()); + simulator.installApplet(appletAID, Example.class); + + simulator.selectApplet(appletAID); + + System.out.println(Hex.toHexString(simulator.transmitCommand(new CommandAPDU(0, 0, 0, 0)).getData())); + } +} \ No newline at end of file diff --git a/applet/src/main/java/opencrypto/jcmathlib/BigNat.java b/applet/src/main/java/opencrypto/jcmathlib/BigNat.java new file mode 100644 index 00000000..a4849a8d --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/BigNat.java @@ -0,0 +1,473 @@ +package opencrypto.jcmathlib; + +import javacard.framework.ISOException; +import javacard.framework.Util; +import javacard.security.RSAPrivateKey; +import javacard.security.RSAPublicKey; +import javacardx.crypto.Cipher; +import javacard.security.KeyBuilder; + +/** + * @author Vasilios Mavroudis and Petr Svenda and Antonin Dufka + */ +public class BigNat extends BigNatInternal { + + /** + * Construct a BigNat of a given size in bytes. + */ + public BigNat(short size, byte allocatorType, ResourceManager rm) { + super(size, allocatorType, rm); + } + + /** + * Division of this BigNat by provided other BigNat. + */ + public void divide(BigNat other) { + BigNat tmp = rm.BN_E; + + tmp.lock(); + tmp.clone(this); + tmp.remainderDivide(other, this); + copy(tmp); + tmp.unlock(); + } + + /** + * Greatest common divisor of this BigNat with other BigNat. Result is stored into this. + */ + public void gcd(BigNat other) { + BigNat tmp = rm.BN_A; + BigNat tmpOther = rm.BN_B; + + tmp.lock(); + tmpOther.lock(); + + tmpOther.clone(other); + + // TODO: optimise? + while (!other.isZero()) { + tmp.clone(tmpOther); + mod(tmpOther); + tmpOther.clone(this); + clone(tmp); + } + + tmp.unlock(); + tmpOther.unlock(); + } + + /** + * Decides whether the arguments are co-prime or not. + */ + public boolean isCoprime(BigNat a, BigNat b) { + BigNat tmp = rm.BN_C; + + tmp.lock(); + tmp.clone(a); + + tmp.gcd(b); + boolean result = tmp.isOne(); + tmp.unlock(); + return result; + } + + /** + * Square computation supporting base greater than MAX_BIGNAT_LENGTH. + */ + public void sq() { + if (!OperationSupport.getInstance().RSA_SQ) { + BigNat tmp = rm.BN_E; + tmp.lock(); + tmp.setSize(length()); + tmp.copy(this); + super.mult(tmp); + return; + } + if ((short) (rm.MAX_SQ_LENGTH - 1) < (short) (2 * length())) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDSQ); + } + + byte[] resultBuffer = rm.ARRAY_A; + short offset = (short) (rm.MAX_SQ_LENGTH - length()); + + rm.lock(resultBuffer); + Util.arrayFillNonAtomic(resultBuffer, (short) 0, offset, (byte) 0x00); + copyToByteArray(resultBuffer, offset); + short len = rm.sqCiph.doFinal(resultBuffer, (short) 0, rm.MAX_SQ_LENGTH, resultBuffer, (short) 0); + if (len != rm.MAX_SQ_LENGTH) { + if (OperationSupport.getInstance().RSA_PREPEND_ZEROS) { + Util.arrayCopyNonAtomic(resultBuffer, (short) 0, resultBuffer, (short) (rm.MAX_SQ_LENGTH - len), len); + Util.arrayFillNonAtomic(resultBuffer, (short) 0, (short) (rm.MAX_SQ_LENGTH - len), (byte) 0); + } else { + ISOException.throwIt(ReturnCodes.SW_ECPOINT_UNEXPECTED_KA_LEN); + } + } + short zeroPrefix = (short) (rm.MAX_SQ_LENGTH - (short) 2 * length()); + fromByteArray(resultBuffer, zeroPrefix, (short) (rm.MAX_SQ_LENGTH - zeroPrefix)); + rm.unlock(resultBuffer); + shrink(); + } + + /** + * Computes this * other and stores the result into this. + */ + public void mult(BigNat other) { + if (OperationSupport.getInstance().RSA_CHECK_ONE && isOne()) { + clone(other); + return; + } + if (!OperationSupport.getInstance().RSA_SQ || length() <= (short) 16) { + super.mult(other); + return; + } + + BigNat result = rm.BN_F; + BigNat tmp = rm.BN_G; + + result.lock(); + result.setSize((short) ((length() > other.length() ? length() : other.length()) + 1)); + result.copy(this); + result.add(other); + result.sq(); + + tmp.lock(); + if (isLesser(other)) { + tmp.clone(other); + tmp.subtract(this); + } else { + tmp.clone(this); + tmp.subtract(other); + } + tmp.sq(); + + result.subtract(tmp); + tmp.unlock(); + result.shiftRight((short) 2); + + setSizeToMax(false); + copy(result); + shrink(); + result.unlock(); + } + + /** + * Computes modulo and stores the result in this. + */ + public void mod(BigNat mod) { + remainderDivide(mod, null); + } + + /** + * Negate current BigNat modulo provided modulus. + */ + public void modNegate(BigNat mod) { + BigNat tmp = rm.BN_B; + + tmp.lock(); + tmp.clone(mod); + tmp.subtract(this); + setSize(mod.length()); + copy(tmp); + tmp.unlock(); + } + + /** + * Modular addition of a BigNat to this. + */ + public void modAdd(BigNat other, BigNat mod) { + resize((short) (mod.length() + 1)); + add(other); + if (!isLesser(mod)) { + subtract(mod); + } + setSize(mod.length()); + } + + /** + * Modular subtraction of a BigNat from this. + */ + public void modSub(BigNat other, BigNat mod) { + resize((short) (mod.length() + 1)); + if (isLesser(other)) { + add(mod); + } + subtract(other); + setSize(mod.length()); + } + + /** + * Square this mod a modulus fixed with fixModSqMod method. + */ + private void modSqFixed() { + BigNat tmpMod = rm.BN_F; + byte[] tmpBuffer = rm.ARRAY_A; + short modLength; + + tmpMod.setSize(rm.MAX_EXP_LENGTH); + if (OperationSupport.getInstance().RSA_RESIZE_MOD) { + modLength = rm.MAX_EXP_LENGTH; + } else { + modLength = rm.fixedMod.length(); + } + + prependZeros(modLength, tmpBuffer, (short) 0); + short len = rm.modSqCiph.doFinal(tmpBuffer, (short) 0, modLength, tmpBuffer, (short) 0); + + if (len != rm.MAX_EXP_LENGTH) { + if (OperationSupport.getInstance().RSA_PREPEND_ZEROS) { + Util.arrayCopyNonAtomic(tmpBuffer, (short) 0, tmpBuffer, (short) (rm.MAX_EXP_LENGTH - len), len); + Util.arrayFillNonAtomic(tmpBuffer, (short) 0, (short) (rm.MAX_EXP_LENGTH - len), (byte) 0); + } else { + ISOException.throwIt(ReturnCodes.SW_ECPOINT_UNEXPECTED_KA_LEN); + } + } + tmpMod.fromByteArray(tmpBuffer, (short) 0, rm.MAX_EXP_LENGTH); + + if (OperationSupport.getInstance().RSA_EXTRA_MOD) { + tmpMod.mod(rm.fixedMod); + } + setSize(rm.fixedMod.length()); + copy(tmpMod); + } + + /** + * Computes (this ^ exp % mod) using RSA algorithm and store results into this. + */ + public void modExp(BigNat exp, BigNat mod) { + if (!OperationSupport.getInstance().RSA_EXP) + ISOException.throwIt(ReturnCodes.SW_OPERATION_NOT_SUPPORTED); + + BigNat tmpMod = rm.BN_F; // modExp is called from modSqrt => requires BN_F not being locked when modExp is called + byte[] tmpBuffer = rm.ARRAY_A; + short modLength; + + tmpMod.lock(); + tmpMod.setSize(rm.MAX_EXP_LENGTH); + + if (OperationSupport.getInstance().RSA_PUB) { + // Verify if pre-allocated engine match the required values + if (rm.expPub.getSize() < (short) (mod.length() * 8) || rm.expPub.getSize() < (short) (length() * 8)) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_MODULOTOOLARGE); + } + if (OperationSupport.getInstance().RSA_KEY_REFRESH) { + // Simulator fails when reusing the original object + rm.expPub = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, rm.MAX_EXP_BIT_LENGTH, false); + } + rm.lock(tmpBuffer); + short len = exp.copyToByteArray(tmpBuffer, (short) 0); + rm.expPub.setExponent(tmpBuffer, (short) 0, len); + if (OperationSupport.getInstance().RSA_RESIZE_MOD) { + if (OperationSupport.getInstance().RSA_APPEND_MOD) { + mod.appendZeros(rm.MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } else { + mod.prependZeros(rm.MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } + rm.expPub.setModulus(tmpBuffer, (short) 0, rm.MAX_EXP_LENGTH); + modLength = rm.MAX_EXP_LENGTH; + } else { + modLength = mod.copyToByteArray(tmpBuffer, (short) 0); + rm.expPub.setModulus(tmpBuffer, (short) 0, modLength); + } + rm.expCiph.init(rm.expPub, Cipher.MODE_DECRYPT); + } else { + // Verify if pre-allocated engine match the required values + if (rm.expPriv.getSize() < (short) (mod.length() * 8) || rm.expPriv.getSize() < (short) (length() * 8)) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_MODULOTOOLARGE); + } + if (OperationSupport.getInstance().RSA_KEY_REFRESH) { + // Simulator fails when reusing the original object + rm.expPriv = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, rm.MAX_EXP_BIT_LENGTH, false); + } + rm.lock(tmpBuffer); + short len = exp.copyToByteArray(tmpBuffer, (short) 0); + rm.expPriv.setExponent(tmpBuffer, (short) 0, len); + if (OperationSupport.getInstance().RSA_RESIZE_MOD) { + if (OperationSupport.getInstance().RSA_APPEND_MOD) { + mod.appendZeros(rm.MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } else { + mod.prependZeros(rm.MAX_EXP_LENGTH, tmpBuffer, (short) 0); + + } + rm.expPriv.setModulus(tmpBuffer, (short) 0, rm.MAX_EXP_LENGTH); + modLength = rm.MAX_EXP_LENGTH; + } else { + modLength = mod.copyToByteArray(tmpBuffer, (short) 0); + rm.expPriv.setModulus(tmpBuffer, (short) 0, modLength); + } + rm.expCiph.init(rm.expPriv, Cipher.MODE_DECRYPT); + } + + prependZeros(modLength, tmpBuffer, (short) 0); + short len = rm.expCiph.doFinal(tmpBuffer, (short) 0, modLength, tmpBuffer, (short) 0); + + if (len != rm.MAX_EXP_LENGTH) { + if (OperationSupport.getInstance().RSA_PREPEND_ZEROS) { + // Decrypted length can be either tmp_size or less because of leading zeroes consumed by simulator engine implementation + // Move obtained value into proper position with zeroes prepended + Util.arrayCopyNonAtomic(tmpBuffer, (short) 0, tmpBuffer, (short) (rm.MAX_EXP_LENGTH - len), len); + Util.arrayFillNonAtomic(tmpBuffer, (short) 0, (short) (rm.MAX_EXP_LENGTH - len), (byte) 0); + } else { + // real cards should keep whole length of block + ISOException.throwIt(ReturnCodes.SW_ECPOINT_UNEXPECTED_KA_LEN); + } + } + tmpMod.fromByteArray(tmpBuffer, (short) 0, rm.MAX_EXP_LENGTH); + rm.unlock(tmpBuffer); + + if (OperationSupport.getInstance().RSA_EXTRA_MOD) { + tmpMod.mod(mod); + } + setSize(mod.length()); + copy(tmpMod); + tmpMod.unlock(); + } + + /** + * Computes modular inversion. The result is stored into this. + */ + public void modInv(BigNat mod) { + BigNat tmp = rm.BN_B; + tmp.lock(); + tmp.clone(mod); + tmp.decrement(); + tmp.decrement(); + + modExp(tmp, mod); + tmp.unlock(); + } + + /** + * Multiplication of this and other modulo mod. The result is stored to this. + */ + public void modMult(BigNat other, BigNat mod) { + BigNat tmp = rm.BN_D; + BigNat result = rm.BN_E; + + if (OperationSupport.getInstance().RSA_CHECK_ONE && isOne()) { + copy(other); + return; + } + + result.lock(); + if (!OperationSupport.getInstance().RSA_SQ || OperationSupport.getInstance().RSA_EXTRA_MOD) { + result.clone(this); + result.mult(other); + result.mod(mod); + } else { + result.setSize((short) (mod.length() + 1)); + result.copy(this); + result.add(other); + + short carry = (byte) 0; + if (result.isOdd()) { + if (result.isLesser(mod)) { + carry = result.add(mod); + } else { + result.subtract(mod); + } + } + result.shiftRight((short) 1, carry); + result.resize(mod.length()); + + tmp.lock(); + tmp.clone(result); + tmp.modSub(other, mod); + + result.modSq(mod); + tmp.modSq(mod); + + result.modSub(tmp, mod); + tmp.unlock(); + } + setSize(mod.length()); + copy(result); + result.unlock(); + } + + /** + * Computes modulo square of this BigNat. + */ + public void modSq(BigNat mod) { + if (OperationSupport.getInstance().RSA_SQ) { + if (rm.fixedMod != null && rm.fixedMod == mod) { + modSqFixed(); + } else { + modExp(ResourceManager.TWO, mod); + } + } else { + modMult(this, mod); + } + } + + /** + * Computes square root of provided BigNat which MUST be prime using Tonelli Shanks Algorithm. The result (one of + * the two roots) is stored to this. + */ + public void modSqrt(BigNat p) { + BigNat s = rm.BN_A; + BigNat exp = rm.BN_A; + BigNat p1 = rm.BN_B; + BigNat q = rm.BN_C; + BigNat tmp = rm.BN_D; + BigNat z = rm.BN_E; + + // 1. By factoring out powers of 2, find Q and S such that p-1=Q2^S p-1=Q*2^S and Q is odd + p1.lock(); + p1.clone(p); + p1.decrement(); + + // Compute Q + q.lock(); + q.clone(p1); + q.shiftRight((short) 1); // Q /= 2 + + // Compute S + s.lock(); + s.setSize(p.length()); + s.zero(); + tmp.lock(); + tmp.setSize(p.length()); + tmp.zero(); + + while (!tmp.equals(q)) { + s.increment(); + // TODO replace with modMult(s, q, p) + tmp.setSizeToMax(false); + tmp.clone(s); + tmp.mult(q); + tmp.mod(p); + tmp.shrink(); + } + tmp.unlock(); + s.unlock(); + + // 2. Find the first quadratic non-residue z by brute-force search + exp.lock(); + exp.clone(p1); + exp.shiftRight((short) 1); + + + z.lock(); + z.setSize(p.length()); + z.setValue((byte) 1); + tmp.lock(); + tmp.setValue((byte) 1); + + while (!tmp.equals(p1)) { + z.increment(); + tmp.copy(z); + tmp.modExp(exp, p); + } + p1.unlock(); + tmp.unlock(); + z.unlock(); + exp.copy(q); + q.unlock(); + exp.increment(); + exp.shiftRight((short) 1); + + mod(p); + modExp(exp, p); + exp.unlock(); + } +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/BigNatInternal.java b/applet/src/main/java/opencrypto/jcmathlib/BigNatInternal.java new file mode 100644 index 00000000..c607cc9a --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/BigNatInternal.java @@ -0,0 +1,640 @@ +package opencrypto.jcmathlib; + +import javacard.framework.ISOException; +import javacard.framework.Util; + +/** + * Based on BigNat library from OV-chip project. by Radboud University Nijmegen + * + * @author Vasilios Mavroudis and Petr Svenda + */ +public class BigNatInternal { + protected final ResourceManager rm; + private static final short DIGIT_MASK = 0xff, DIGIT_LEN = 8, DOUBLE_DIGIT_LEN = 16, POSITIVE_DOUBLE_DIGIT_MASK = 0x7fff; + + private byte[] value; + private short size; // The current size of internal representation in bytes. + private short offset; + + /** + * Construct a BigNat of at least a given size in bytes. + */ + public BigNatInternal(short size, byte allocatorType, ResourceManager rm) { + this.rm = rm; + this.offset = 1; + this.size = size; + this.value = rm.memAlloc.allocateByteArray((short) (size + 1), allocatorType); + } + + /** + * Set value of this from a byte array representation. + * + * @param source the byte array + * @param sourceOffset offset in the byte array + * @param length length of the value representation + * @return number of bytes read + */ + public short fromByteArray(byte[] source, short sourceOffset, short length) { + short read = length <= (short) value.length ? length : (short) value.length; + setSize(read); + Util.arrayCopyNonAtomic(source, sourceOffset, value, offset, size); + return size; + } + + /** + * Serialize this BigNat value into a provided byte array. + * + * @param dst the byte array + * @param dstOffset offset in the byte array + * @return number of bytes written + */ + public short copyToByteArray(byte[] dst, short dstOffset) { + Util.arrayCopyNonAtomic(value, offset, dst, dstOffset, size); + return size; + } + + /** + * Get size of this BigNat in bytes. + * + * @return size in bytes + */ + public short length() { + return size; + } + + /** + * Sets the size of this BigNat in bytes. + * + * Previous value is kept so value is either non-destructively trimmed or enlarged. + * + * @param newSize the new size + */ + public void setSize(short newSize) { + if (newSize < 0 || newSize > value.length) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER); + } + size = newSize; + offset = (short) (value.length - size); + } + + /** + * Set size of this BigNat to the maximum size given during object creation. + * + * @param erase flag indicating whether to set internal representation to zero + */ + public void setSizeToMax(boolean erase) { + setSize((short) value.length); + if (erase) { + erase(); + } + } + + /** + * Resize this BigNat value to given size in bytes. May result in truncation. + * + * @param newSize new size in bytes + */ + public void resize(short newSize) { + if (newSize > (short) value.length) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_REALLOCATIONNOTALLOWED); + } + + short diff = (short) (newSize - size); + setSize(newSize); + if (diff > 0) { + Util.arrayFillNonAtomic(value, offset, diff, (byte) 0); + } + } + + /** + * Append zeros to reach the defined byte length and store the result in an output buffer. + * + * @param targetLength required length including appended zeroes + * @param outBuffer output buffer for value with appended zeroes + * @param outOffset start offset inside outBuffer for write + */ + public void appendZeros(short targetLength, byte[] outBuffer, short outOffset) { + Util.arrayCopyNonAtomic(value, offset, outBuffer, outOffset, size); + Util.arrayFillNonAtomic(outBuffer, (short) (outOffset + size), (short) (targetLength - size), (byte) 0); + } + + /** + * Prepend zeros to reach the defined byte length and store the result in an output buffer. + * + * @param targetLength required length including prepended zeroes + * @param outBuffer output buffer for value with prepended zeroes + * @param outOffset start offset inside outBuffer for write + */ + public void prependZeros(short targetLength, byte[] outBuffer, short outOffset) { + short start = (short) (targetLength - size); + if (start > 0) { + Util.arrayFillNonAtomic(outBuffer, outOffset, start, (byte) 0); + } + Util.arrayCopyNonAtomic(value, offset, outBuffer, (short) (outOffset + start), size); + } + + /** + * Remove leading zeroes from this BigNat and decrease its byte size accordingly. + */ + public void shrink() { + short i; + for (i = offset; i < value.length; i++) { // Find first non-zero byte + if (value[i] != 0) { + break; + } + } + + short newSize = (short) (value.length - i); + if (newSize < 0) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDRESIZE); + } + resize(newSize); + } + + /** + * Set this BigNat value to zero. Previous size is kept. + */ + public void zero() { + Util.arrayFillNonAtomic(value, offset, size, (byte) 0); + } + + /** + * Erase the internal array of this BigNat. + */ + public void erase() { + Util.arrayFillNonAtomic(value, (short) 0, (short) value.length, (byte) 0); + } + + /** + * Set this BigNat to a given value. Previous size is kept. + */ + public void setValue(byte newValue) { + zero(); + value[(short) (value.length - 1)] = (byte) (newValue & DIGIT_MASK); + } + + /** + * Set this BigNat to a given value. Previous size is kept. + */ + public void setValue(short newValue) { + zero(); + value[(short) (value.length - 1)] = (byte) (newValue & DIGIT_MASK); + value[(short) (value.length - 2)] = (byte) ((short) (newValue >> 8) & DIGIT_MASK); + } + + /** + * Copies a BigNat into this without changing size. May throw an exception if this is too small. + */ + public void copy(BigNatInternal other) { + short thisStart, otherStart, len; + short diff = (short) (size - other.size); + if (diff >= 0) { + thisStart = (short) (diff + offset); + otherStart = other.offset; + len = other.size; + + if (diff > 0) { + Util.arrayFillNonAtomic(value, offset, diff, (byte) 0); + } + } else { + thisStart = offset; + otherStart = (short) (other.offset - diff); + len = size; + // Verify here that other have leading zeroes up to otherStart + for (short i = other.offset; i < otherStart; i++) { + if (other.value[i] != 0) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDCOPYOTHER); + } + } + } + Util.arrayCopyNonAtomic(other.value, otherStart, value, thisStart, len); + } + + /** + * Copies a BigNat into this including its size. May require reallocation. + */ + public void clone(BigNatInternal other) { + if (other.size > (short) value.length) { + ISOException.throwIt(ReturnCodes.SW_BIGNAT_REALLOCATIONNOTALLOWED); + } + + short diff = (short) ((short) value.length - other.size); + other.copyToByteArray(value, diff); + if (diff > 0) { + Util.arrayFillNonAtomic(value, (short) 0, diff, (byte) 0); + } + setSize(other.size); + } + + /** + * Test equality with zero. + */ + public boolean isZero() { + for (short i = offset; i < value.length; i++) { + if (value[i] != 0) { + return false; // CTO + } + } + return true; + } + + /** + * Test equality with one. + */ + public boolean isOne() { + for (short i = offset; i < (short) (value.length - 1); i++) { + if (value[i] != 0) { + return false; // CTO + } + } + return value[(short) (value.length - 1)] == (byte) 0x01; + } + + /** + * Check if stored BigNat is odd. + */ + public boolean isOdd() { + return (byte) (value[(short) (value.length - 1)] & (byte) 1) != (byte) 0; + } + + /** + * Returns true if this BigNat is lesser than the other. + */ + public boolean isLesser(BigNatInternal other) { + return isLesser(other, (short) 0, (short) 0); + } + + /** + * Returns true if this is lesser than other shifted by a given number of digits. + */ + private boolean isLesser(BigNatInternal other, short shift, short start) { + short j = (short) (other.size + shift - size + start + other.offset); + + for (short i = (short) (start + other.offset); i < j; ++i) { + if (other.value[i] != 0) { + return true; + } + } + + for (short i = (short) (start + offset); i < (short) value.length; i++, j++) { + short thisValue = (short) (value[i] & DIGIT_MASK); + short otherValue = (j >= other.offset && j < (short) other.value.length) ? (short) (other.value[j] & DIGIT_MASK) : (short) 0; + if (thisValue < otherValue) { + return true; // CTO + } + if (thisValue > otherValue) { + return false; + } + } + return false; + } + + /** + * Value equality check. + * + * @param other BigNat to compare + * @return true if this and other have the same value, false otherwise. + */ + public boolean equals(BigNatInternal other) { + short diff = (short) (size - other.size); + + if (diff == 0) { + return Util.arrayCompare(value, offset, other.value, other.offset, size) == 0; + } + + + if (diff < 0) { + short end = (short) (other.offset - diff); + for (short i = other.offset; i < end; ++i) { + if (other.value[i] != (byte) 0) { + return false; + } + } + return Util.arrayCompare(value, (short) 0, other.value, end, size) == 0; + } + + short end = diff; + for (short i = (short) 0; i < end; ++i) { + if (value[i] != (byte) 0) { + return false; + } + } + return Util.arrayCompare(value, end, other.value, other.offset, other.size) == 0; + } + + /** + * Increment this BigNat. + */ + public void increment() { + for (short i = (short) (value.length - 1); i >= offset; i--) { + short tmp = (short) (value[i] & 0xff); + value[i] = (byte) (tmp + 1); + if (tmp < 255) { + break; // CTO + } + } + } + + /** + * Decrement this BigNat. + */ + public void decrement() { + short tmp; + for (short i = (short) (value.length - 1); i >= offset; i--) { + tmp = (short) (value[i] & 0xff); + value[i] = (byte) (tmp - 1); + if (tmp != 0) { + break; // CTO + } + } + } + + /** + * Add short value to this BigNat + * + * @param other short value to add + */ + public byte add(short other) { + rm.BN_WORD.lock(); + rm.BN_WORD.setValue(other); + byte carry = add(rm.BN_WORD); + rm.BN_WORD.unlock(); + return carry; + } + + /** + * Adds other to this. Outputs carry bit. + * + * @param other BigNat to add + * @return true if carry occurs, false otherwise + */ + public byte add(BigNatInternal other) { + return add(other, (short) 0, (short) 1); + } + + /** + * Computes other * multiplier, shifts the results by shift and adds it to this. + * Multiplier must be in range [0; 2^8 - 1]. + * This must be large enough to fit the results. + */ + private byte add(BigNatInternal other, short shift, short multiplier) { + short acc = 0; + short i = (short) (other.size - 1 + other.offset); + short j = (short) (size - 1 - shift + offset); + for (; i >= other.offset && j >= offset; i--, j--) { + acc += (short) ((short) (value[j] & DIGIT_MASK) + (short) (multiplier * (other.value[i] & DIGIT_MASK))); + + value[j] = (byte) (acc & DIGIT_MASK); + acc = (short) ((acc >> DIGIT_LEN) & DIGIT_MASK); + } + + for (; acc > 0 && j >= offset; --j) { + acc += (short) (value[j] & DIGIT_MASK); + value[j] = (byte) (acc & DIGIT_MASK); + acc = (short) ((acc >> DIGIT_LEN) & DIGIT_MASK); + } + + // output carry bit if present + return (byte) (((byte) (((short) (acc | -acc) & (short) 0xFFFF) >>> 15) & 0x01) << 7); + } + + /** + * Subtract provided other BigNat from this BigNat. + * + * @param other BigNat to be subtracted from this + */ + public void subtract(BigNatInternal other) { + subtract(other, (short) 0, (short) 1); + } + + /** + * Computes other * multiplier, shifts the results by shift and subtract it from this. + * Multiplier must be in range [0; 2^8 - 1]. + */ + private void subtract(BigNatInternal other, short shift, short multiplier) { + short acc = 0; + short i = (short) (size - 1 - shift + offset); + short j = (short) (other.size - 1 + other.offset); + for (; i >= offset && j >= other.offset; i--, j--) { + acc += (short) (multiplier * (other.value[j] & DIGIT_MASK)); + short tmp = (short) ((value[i] & DIGIT_MASK) - (acc & DIGIT_MASK)); + + value[i] = (byte) (tmp & DIGIT_MASK); + acc = (short) ((acc >> DIGIT_LEN) & DIGIT_MASK); + if (tmp < 0) { + acc++; + } + } + + // deal with carry as long as there are digits left in this + for (; i >= offset && acc != 0; --i) { + short tmp = (short) ((value[i] & DIGIT_MASK) - (acc & DIGIT_MASK)); + value[i] = (byte) (tmp & DIGIT_MASK); + acc = (short) ((acc >> DIGIT_LEN) & DIGIT_MASK); + if (tmp < 0) { + acc++; + } + } + } + + /** + * Multiplies this and other using software multiplications and stores results into this. + */ + public void mult(BigNatInternal other) { + BigNatInternal tmp = rm.BN_F; + tmp.lock(); + tmp.clone(this); + setSizeToMax(true); + for (short i = (short) (other.value.length - 1); i >= other.offset; i--) { + add(tmp, (short) (other.value.length - 1 - i), (short) (other.value[i] & DIGIT_MASK)); + } + shrink(); + tmp.unlock(); + } + + /** + * Right bit shift with carry + * + * @param bits number of bits to shift by + * @param carry XORed into the highest byte + */ + protected void shiftRight(short bits, short carry) { + // assumes 0 <= bits < 8 + short mask = (short) ((short) (1 << bits) - 1); // lowest `bits` bits set to 1 + for (short i = offset; i < (short) value.length; i++) { + short current = (short) (value[i] & 0xff); + short previous = current; + current >>= bits; + value[i] = (byte) (current | carry); + carry = (short) (previous & mask); + carry <<= (short) (8 - bits); + } + } + + /** + * Right bit shift + * + * @param bits number of bits to shift by + */ + public void shiftRight(short bits) { + shiftRight(bits, (short) 0); + } + + /** + * Divide this by divisor and store the remained in this and quotient in quotient. + * + * Quadratic complexity in digit difference of this and divisor. + * + * @param divisor non-zero number + * @param quotient may be null + */ + public void remainderDivide(BigNatInternal divisor, BigNatInternal quotient) { + if (quotient != null) { + quotient.zero(); + } + + short divisorIndex = divisor.offset; + while (divisor.value[divisorIndex] == 0) { + divisorIndex++; + } + + short divisorShift = (short) (size - divisor.size + divisorIndex - divisor.offset); + short divisionRound = 0; + short firstDivisorDigit = (short) (divisor.value[divisorIndex] & DIGIT_MASK); + short divisorBitShift = (short) (highestOneBit((short) (firstDivisorDigit + 1)) - 1); + byte secondDivisorDigit = divisorIndex < (short) (divisor.value.length - 1) ? divisor.value[(short) (divisorIndex + 1)] : 0; + byte thirdDivisorDigit = divisorIndex < (short) (divisor.value.length - 2) ? divisor.value[(short) (divisorIndex + 2)] : 0; + + while (divisorShift >= 0) { + while (!isLesser(divisor, divisorShift, (short) (divisionRound > 0 ? divisionRound - 1 : 0))) { + short divisionRoundOffset = (short) (divisionRound + offset); + short dividentDigits = divisionRound == 0 ? 0 : (short) ((short) (value[(short) (divisionRoundOffset - 1)]) << DIGIT_LEN); + dividentDigits |= (short) (value[(short) (divisionRound + offset)] & DIGIT_MASK); + + short divisorDigit; + if (dividentDigits < 0) { + dividentDigits = (short) ((dividentDigits >>> 1) & POSITIVE_DOUBLE_DIGIT_MASK); + divisorDigit = (short) ((firstDivisorDigit >>> 1) & POSITIVE_DOUBLE_DIGIT_MASK); + } else { + short dividentBitShift = (short) (highestOneBit(dividentDigits) - 1); + short bitShift = dividentBitShift <= divisorBitShift ? dividentBitShift : divisorBitShift; + + dividentDigits = shiftBits( + dividentDigits, divisionRound < (short) (size - 1) ? value[(short) (divisionRoundOffset + 1)] : 0, + divisionRound < (short) (size - 2) ? value[(short) (divisionRoundOffset + 2)] : 0, + bitShift + ); + divisorDigit = shiftBits(firstDivisorDigit, secondDivisorDigit, thirdDivisorDigit, bitShift); + } + + short multiple = (short) (dividentDigits / (short) (divisorDigit + 1)); + if (multiple < 1) { + multiple = 1; + } + + subtract(divisor, divisorShift, multiple); + + if (quotient != null) { + short divisorShiftOffset = (short) (divisorShift - quotient.offset); + short quotientDigit = (short) ((quotient.value[(short) (quotient.size - 1 - divisorShiftOffset)] & DIGIT_MASK) + multiple); + quotient.value[(short) (quotient.size - 1 - divisorShiftOffset)] = (byte) quotientDigit; + } + } + divisionRound++; + divisorShift--; + } + } + + /** + * Get the index of the highest bit set to 1. Used in remainderDivide. + */ + private static short highestOneBit(short x) { + for (short i = 0; i < DOUBLE_DIGIT_LEN; ++i) { + if (x < 0) { + return i; + } + x <<= 1; + } + return DOUBLE_DIGIT_LEN; + } + + /** + * Shift to the left and fill. Used in remainderDivide. + * + * @param high most significant 16 bits + * @param middle middle 8 bits + * @param low least significant 8 bits + * @param shift the left shift + * @return most significant 16 bits as short + */ + private static short shiftBits(short high, byte middle, byte low, short shift) { + // shift high + high <<= shift; + + // merge middle bits + byte mask = (byte) (DIGIT_MASK << (shift >= DIGIT_LEN ? 0 : DIGIT_LEN - shift)); + short bits = (short) ((short) (middle & mask) & DIGIT_MASK); + if (shift > DIGIT_LEN) { + bits <<= shift - DIGIT_LEN; + } else { + bits >>>= DIGIT_LEN - shift; + } + high |= bits; + + if (shift <= DIGIT_LEN) { + return high; + } + + // merge low bits + mask = (byte) (DIGIT_MASK << DOUBLE_DIGIT_LEN - shift); + bits = (short) ((((short) (low & mask) & DIGIT_MASK) >> DOUBLE_DIGIT_LEN - shift)); + high |= bits; + + return high; + } + + /// [DependencyBegin:ObjectLocker] + private boolean ERASE_ON_LOCK = false; + private boolean ERASE_ON_UNLOCK = false; + private boolean locked = false; // Logical flag to store info if this BigNat is currently used for some operation. Used as a prevention of unintentional parallel use of same temporary pre-allocated BigNat. + + /** + * Lock/reserve this BigNat for subsequent use. + * Used to protect corruption of pre-allocated temporary BigNat used in different, + * potentially nested operations. Must be unlocked by unlock() later on. + */ + public void lock() { + if (locked) { + ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED); + } + locked = true; + if (ERASE_ON_LOCK) { + erase(); + } + } + + /** + * Unlock/release this BigNat from use. Used to protect corruption + * of pre-allocated temporary BigNat used in different nested operations. + * Must be locked before. + */ + public void unlock() { + if (!locked) { + ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED); + } + locked = false; + if (ERASE_ON_UNLOCK) { + erase(); + } + } + + /** + * Return current state of logical lock of this object + * + * @return true if object is logically locked (reserved), false otherwise + */ + public boolean isLocked() { + return locked; + } + /// [DependencyEnd:ObjectLocker] +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/ECCurve.java b/applet/src/main/java/opencrypto/jcmathlib/ECCurve.java new file mode 100644 index 00000000..e3638da8 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/ECCurve.java @@ -0,0 +1,106 @@ +package opencrypto.jcmathlib; + +import javacard.framework.JCSystem; +import javacard.framework.Util; +import javacard.security.ECPrivateKey; +import javacard.security.ECPublicKey; +import javacard.security.KeyBuilder; +import javacard.security.KeyPair; + +/** + * @author Vasilios Mavroudis and Petr Svenda + */ +public class ECCurve { + public final short KEY_BIT_LENGTH, POINT_SIZE, COORD_SIZE; + public ResourceManager rm; + + public byte[] p, a, b, G, r; + public BigNat pBN, aBN, bBN, rBN; + + + public KeyPair disposablePair; + public ECPrivateKey disposablePriv; + public ECPublicKey disposablePub; + + /** + * Creates new curve object from provided parameters. Parameters are not copied, the + * arrays must not be changed. + * + * @param p array with p + * @param a array with a + * @param b array with b + * @param G array with base point G + * @param r array with r + */ + public ECCurve(byte[] p, byte[] a, byte[] b, byte[] G, byte[] r, ResourceManager rm) { + KEY_BIT_LENGTH = (short) (p.length * 8); + POINT_SIZE = (short) G.length; + COORD_SIZE = (short) ((short) (G.length - 1) / 2); + + this.p = p; + this.a = a; + this.b = b; + this.G = G; + this.r = r; + this.rm = rm; + + pBN = new BigNat(COORD_SIZE, JCSystem.MEMORY_TYPE_TRANSIENT_RESET, rm); + pBN.fromByteArray(p, (short) 0, (short) p.length); + aBN = new BigNat(COORD_SIZE, JCSystem.MEMORY_TYPE_PERSISTENT, rm); + aBN.fromByteArray(a, (short) 0, (short) a.length); + bBN = new BigNat(COORD_SIZE, JCSystem.MEMORY_TYPE_PERSISTENT, rm); + bBN.fromByteArray(b, (short) 0, (short) b.length); + rBN = new BigNat(COORD_SIZE, JCSystem.MEMORY_TYPE_TRANSIENT_RESET, rm); + rBN.fromByteArray(r, (short) 0, (short) r.length); + + disposablePair = newKeyPair(null); + disposablePriv = (ECPrivateKey) disposablePair.getPrivate(); + disposablePub = (ECPublicKey) disposablePair.getPublic(); + } + + /** + * Refresh critical information stored in RAM for performance reasons after a card reset (RAM was cleared). + */ + public void updateAfterReset() { + pBN.fromByteArray(p, (short) 0, (short) p.length); + aBN.fromByteArray(a, (short) 0, (short) a.length); + bBN.fromByteArray(b, (short) 0, (short) b.length); + rBN.fromByteArray(r, (short) 0, (short) r.length); + } + + /** + * Creates a new keyPair based on this curve parameters. KeyPair object is reused if provided. Fresh keyPair value is generated. + * @param keyPair existing KeyPair object which is reused if required. If null, new KeyPair is allocated + * @return new or existing object with fresh key pair value + */ + KeyPair newKeyPair(KeyPair keyPair) { + ECPublicKey pubKey; + ECPrivateKey privKey; + if (keyPair == null) { + pubKey = (ECPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC, KEY_BIT_LENGTH, false); + privKey = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KEY_BIT_LENGTH, false); + keyPair = new KeyPair(pubKey, privKey); + } else { + pubKey = (ECPublicKey) keyPair.getPublic(); + privKey = (ECPrivateKey) keyPair.getPrivate(); + } + + privKey.setFieldFP(p, (short) 0, (short) p.length); + privKey.setA(a, (short) 0, (short) a.length); + privKey.setB(b, (short) 0, (short) b.length); + privKey.setG(G, (short) 0, (short) G.length); + privKey.setR(r, (short) 0, (short) r.length); + privKey.setK((short) 1); + + pubKey.setFieldFP(p, (short) 0, (short) p.length); + pubKey.setA(a, (short) 0, (short) a.length); + pubKey.setB(b, (short) 0, (short) b.length); + pubKey.setG(G, (short) 0, (short) G.length); + pubKey.setR(r, (short) 0, (short) r.length); + pubKey.setK((short) 1); + + keyPair.genKeyPair(); + + return keyPair; + } +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/ECPoint.java b/applet/src/main/java/opencrypto/jcmathlib/ECPoint.java new file mode 100644 index 00000000..b07c7843 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/ECPoint.java @@ -0,0 +1,848 @@ +package opencrypto.jcmathlib; + +import javacard.framework.ISOException; +import javacard.framework.Util; +import javacard.security.*; + +/** + * @author Vasilios Mavroudis and Petr Svenda and Antonin Dufka + */ +public class ECPoint { + private final ResourceManager rm; + + private ECPublicKey point; + private KeyPair pointKeyPair; + private final ECCurve curve; + + /** + * Creates new ECPoint object for provided {@code curve}. Random initial point value is generated. + * + * @param curve point's elliptic curve + */ + public ECPoint(ECCurve curve) { + this.curve = curve; + this.rm = curve.rm; + updatePointObjects(); + } + + /** + * Returns length of this point in bytes. + * + * @return length of this point in bytes + */ + public short length() { + return (short) (point.getSize() / 8); + } + + /** + * Properly updates all point values in case of a change of an underlying curve. + * New random point value is generated. + */ + public final void updatePointObjects() { + pointKeyPair = curve.newKeyPair(pointKeyPair); + point = (ECPublicKey) pointKeyPair.getPublic(); + } + + /** + * Generates new random point value. + */ + public void randomize() { + pointKeyPair.genKeyPair(); + } + + /** + * Copy value of provided point into this. This and other point must have + * curve with same parameters, only length is checked. + * + * @param other point to be copied + */ + public void copy(ECPoint other) { + if (length() != other.length()) { + ISOException.throwIt(ReturnCodes.SW_ECPOINT_INVALIDLENGTH); + } + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + short len = other.getW(pointBuffer, (short) 0); + setW(pointBuffer, (short) 0, len); + rm.unlock(pointBuffer); + } + + /** + * Set this point value (parameter W) from array with value encoded as per ANSI X9.62. + * The uncompressed form is always supported. If underlying native JavaCard implementation + * of {@code ECPublicKey} supports compressed points, then this method accepts also compressed points. + * + * @param buffer array with serialized point + * @param offset start offset within input array + * @param length length of point + */ + public void setW(byte[] buffer, short offset, short length) { + point.setW(buffer, offset, length); + } + + /** + * Returns current value of this point. + * + * @param buffer memory array where to store serailized point value + * @param offset start offset for output serialized point + * @return length of serialized point (number of bytes) + */ + public short getW(byte[] buffer, short offset) { + return point.getW(buffer, offset); + } + + /** + * Returns this point value as ECPublicKey object. No copy of point is made + * before return, so change of returned object will also change this point value. + * + * @return point as ECPublicKey object + */ + public ECPublicKey asPublicKey() { + return point; + } + + /** + * Returns curve associated with this point. No copy of curve is made + * before return, so change of returned object will also change curve for + * this point. + * + * @return curve as ECCurve object + */ + public ECCurve getCurve() { + return curve; + } + + /** + * Returns the X coordinate of this point in uncompressed form. + * + * @param buffer output array for X coordinate + * @param offset start offset within output array + * @return length of X coordinate (in bytes) + */ + public short getX(byte[] buffer, short offset) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + point.getW(pointBuffer, (short) 0); + Util.arrayCopyNonAtomic(pointBuffer, (short) 1, buffer, offset, curve.COORD_SIZE); + rm.unlock(pointBuffer); + return curve.COORD_SIZE; + } + + /** + * Returns the Y coordinate of this point in uncompressed form. + * + * @param buffer output array for Y coordinate + * @param offset start offset within output array + * @return length of Y coordinate (in bytes) + */ + public short getY(byte[] buffer, short offset) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + point.getW(pointBuffer, (short) 0); + Util.arrayCopyNonAtomic(pointBuffer, (short) (1 + curve.COORD_SIZE), buffer, offset, curve.COORD_SIZE); + rm.unlock(pointBuffer); + return curve.COORD_SIZE; + } + + /** + * Double this point. Pure implementation without KeyAgreement. + */ + public void swDouble() { + byte[] pointBuffer = rm.POINT_ARRAY_A; + BigNat pX = rm.EC_BN_B; + BigNat pY = rm.EC_BN_C; + BigNat lambda = rm.EC_BN_D; + BigNat tmp = rm.EC_BN_E; + + rm.lock(pointBuffer); + getW(pointBuffer, (short) 0); + + pX.lock(); + pX.fromByteArray(pointBuffer, (short) 1, curve.COORD_SIZE); + + pY.lock(); + pY.fromByteArray(pointBuffer, (short) (1 + curve.COORD_SIZE), curve.COORD_SIZE); + + lambda.lock(); + lambda.clone(pX); + lambda.modSq(curve.pBN); + lambda.modMult(ResourceManager.THREE, curve.pBN); + lambda.modAdd(curve.aBN, curve.pBN); + + tmp.lock(); + tmp.clone(pY); + tmp.modAdd(tmp, curve.pBN); + tmp.modInv(curve.pBN); + lambda.modMult(tmp, curve.pBN); + tmp.clone(lambda); + tmp.modSq(curve.pBN); + tmp.modSub(pX, curve.pBN); + tmp.modSub(pX, curve.pBN); + tmp.prependZeros(curve.COORD_SIZE, pointBuffer, (short) 1); + + tmp.modSub(pX, curve.pBN); + pX.unlock(); + tmp.modMult(lambda, curve.pBN); + lambda.unlock(); + tmp.modAdd(pY, curve.pBN); + tmp.modNegate(curve.pBN); + pY.unlock(); + tmp.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (1 + curve.COORD_SIZE)); + tmp.unlock(); + + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + } + + + /** + * Doubles the current value of this point. + */ + public void makeDouble() { + // doubling via add sometimes causes exception inside KeyAgreement engine + // this.add(this); + // Use bit slower, but more robust version via multiplication by 2 + this.multiplication(ResourceManager.TWO); + } + + /** + * Adds this (P) and provided (Q) point. Stores a resulting value into this point. + * + * @param other point to be added to this. + */ + public void add(ECPoint other) { + if (OperationSupport.getInstance().EC_HW_ADD) { + hwAdd(other); + } else { + swAdd(other); + } + } + + /** + * Implements adding of two points without ALG_EC_PACE_GM. + * + * @param other point to be added to this. + */ + private void swAdd(ECPoint other) { + boolean samePoint = this == other || isEqual(other); + if (samePoint && OperationSupport.getInstance().EC_HW_XY) { + multiplication(ResourceManager.TWO); + return; + } + + byte[] pointBuffer = rm.POINT_ARRAY_A; + BigNat xR = rm.EC_BN_B; + BigNat yR = rm.EC_BN_C; + BigNat xP = rm.EC_BN_D; + BigNat yP = rm.EC_BN_E; + BigNat xQ = rm.EC_BN_F; + BigNat nominator = rm.EC_BN_B; + BigNat denominator = rm.EC_BN_C; + BigNat lambda = rm.EC_BN_A; + + rm.lock(pointBuffer); + point.getW(pointBuffer, (short) 0); + xP.lock(); + xP.setSize(curve.COORD_SIZE); + xP.fromByteArray(pointBuffer, (short) 1, curve.COORD_SIZE); + yP.lock(); + yP.setSize(curve.COORD_SIZE); + yP.fromByteArray(pointBuffer, (short) (1 + curve.COORD_SIZE), curve.COORD_SIZE); + rm.unlock(pointBuffer); + + + // l = (y_q-y_p)/(x_q-x_p)) + // x_r = l^2 - x_p -x_q + // y_r = l(x_p-x_r)-y_p + + // P + Q = R + nominator.lock(); + denominator.lock(); + if (samePoint) { + // lambda = (3(x_p^2)+a)/(2y_p) + // (3(x_p^2)+a) + nominator.clone(xP); + nominator.modSq(curve.pBN); + nominator.modMult(ResourceManager.THREE, curve.pBN); + nominator.modAdd(curve.aBN, curve.pBN); + // (2y_p) + denominator.clone(yP); + denominator.modMult(ResourceManager.TWO, curve.pBN); + denominator.modInv(curve.pBN); + + } else { + // lambda = (y_q-y_p) / (x_q-x_p) mod p + rm.lock(pointBuffer); + other.point.getW(pointBuffer, (short) 0); + xQ.lock(); + xQ.setSize(curve.COORD_SIZE); + xQ.fromByteArray(pointBuffer, (short) 1, other.curve.COORD_SIZE); + nominator.setSize(curve.COORD_SIZE); + nominator.fromByteArray(pointBuffer, (short) (1 + curve.COORD_SIZE), curve.COORD_SIZE); + rm.unlock(pointBuffer); + + nominator.mod(curve.pBN); + + nominator.modSub(yP, curve.pBN); + + // (x_q-x_p) + denominator.clone(xQ); + denominator.mod(curve.pBN); + denominator.modSub(xP, curve.pBN); + denominator.modInv(curve.pBN); + } + + lambda.lock(); + lambda.clone(nominator); + lambda.modMult(denominator, curve.pBN); + nominator.unlock(); + denominator.unlock(); + + // (x_p, y_p) + (x_q, y_q) = (x_r, y_r) + // lambda = (y_q - y_p) / (x_q - x_p) + + // x_r = lambda^2 - x_p - x_q + xR.lock(); + if (samePoint) { + rm.lock(pointBuffer); + short len = multXKA(ResourceManager.TWO, pointBuffer, (short) 0); + xR.fromByteArray(pointBuffer, (short) 0, len); + rm.unlock(pointBuffer); + } else { + xR.clone(lambda); + xR.modSq(curve.pBN); + xR.modSub(xP, curve.pBN); + xR.modSub(xQ, curve.pBN); + } + xQ.unlock(); + + // y_r = lambda(x_p - x_r) - y_p + yR.lock(); + yR.clone(xP); + xP.unlock(); + yR.modSub(xR, curve.pBN); + yR.modMult(lambda, curve.pBN); + lambda.unlock(); + yR.modSub(yP, curve.pBN); + yP.unlock(); + + rm.lock(pointBuffer); + pointBuffer[0] = (byte) 0x04; + // If x_r.length() and y_r.length() is smaller than curve.COORD_SIZE due to leading zeroes which were shrunk before, then we must add these back + xR.prependZeros(curve.COORD_SIZE, pointBuffer, (short) 1); + xR.unlock(); + yR.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (1 + curve.COORD_SIZE)); + yR.unlock(); + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + } + + /** + * Implements adding of two points via ALG_EC_PACE_GM. + * + * @param other point to be added to this. + */ + private void hwAdd(ECPoint other) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + setW(pointBuffer, (short) 0, multAndAddKA(ResourceManager.ONE_COORD, other, pointBuffer, (short) 0)); + rm.unlock(pointBuffer); + } + + /** + * Multiply value of this point by provided scalar. Stores the result into this point. + * + * @param scalarBytes value of scalar for multiplication + */ + public void multiplication(byte[] scalarBytes, short scalarOffset, short scalarLen) { + BigNat scalar = rm.EC_BN_F; + + scalar.lock(); + scalar.setSize(scalarLen); + scalar.fromByteArray(scalarBytes, scalarOffset, scalarLen); + multiplication(scalar); + scalar.unlock(); + } + + /** + * Multiply value of this point by provided scalar. Stores the result into this point. + * + * @param scalar value of scalar for multiplication + */ + public void multiplication(BigNat scalar) { + if (OperationSupport.getInstance().EC_SW_DOUBLE && scalar.equals(ResourceManager.TWO)) { + swDouble(); + // } else if (rm.ecMultKA.getAlgorithm() == KeyAgreement.ALG_EC_SVDP_DH_PLAIN_XY) { + } else if (rm.ecMultKA.getAlgorithm() == (byte) 6) { + multXY(scalar); + //} else if (rm.ecMultKA.getAlgorithm() == KeyAgreement.ALG_EC_SVDP_DH_PLAIN) { + } else if (rm.ecMultKA.getAlgorithm() == (byte) 3) { + multX(scalar); + } else { + ISOException.throwIt(ReturnCodes.SW_OPERATION_NOT_SUPPORTED); + } + } + + /** + * Multiply this point by a given scalar and add another point to the result. + * + * @param scalar value of scalar for multiplication + * @param point the other point + */ + public void multAndAdd(BigNat scalar, ECPoint point) { + if (OperationSupport.getInstance().EC_HW_ADD) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + setW(pointBuffer, (short) 0, multAndAddKA(scalar, point, pointBuffer, (short) 0)); + rm.unlock(pointBuffer); + } else { + multiplication(scalar); + add(point); + } + } + + /** + * Multiply this point by a given scalar and add another point to the result and store the result into outBuffer. + * + * @param scalar value of scalar for multiplication + * @param point the other point + * @param outBuffer output buffer + * @param outBufferOffset offset in the output buffer + */ + private short multAndAddKA(BigNat scalar, ECPoint point, byte[] outBuffer, short outBufferOffset) { + byte[] pointBuffer = rm.POINT_ARRAY_B; + + rm.lock(pointBuffer); + short len = getW(pointBuffer, (short) 0); + curve.disposablePriv.setG(pointBuffer, (short) 0, len); + len = scalar.copyToByteArray(pointBuffer, (short) 0); + curve.disposablePriv.setS(pointBuffer, (short) 0, len); + rm.ecAddKA.init(curve.disposablePriv); + + len = point.getW(pointBuffer, (short) 0); + len = rm.ecAddKA.generateSecret(pointBuffer, (short) 0, len, outBuffer, outBufferOffset); + rm.unlock(pointBuffer); + return len; + } + + /** + * Multiply value of this point by provided scalar using XY key agreement. Stores the result into this point. + * + * @param scalar value of scalar for multiplication + */ + public void multXY(BigNat scalar) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + short len = multXYKA(scalar, pointBuffer, (short) 0); + setW(pointBuffer, (short) 0, len); + rm.unlock(pointBuffer); + } + + /** + * Multiplies this point value with provided scalar and stores result into + * provided array. No modification of this point is performed. + * Native XY KeyAgreement engine is used. + * + * @param scalar value of scalar for multiplication + * @param outBuffer output array for resulting value + * @param outBufferOffset offset within output array + * @return length of resulting value (in bytes) + */ + public short multXYKA(BigNat scalar, byte[] outBuffer, short outBufferOffset) { + byte[] pointBuffer = rm.POINT_ARRAY_B; + + rm.lock(pointBuffer); + short len = scalar.copyToByteArray(pointBuffer, (short) 0); + curve.disposablePriv.setS(pointBuffer, (short) 0, len); + rm.ecMultKA.init(curve.disposablePriv); + + len = getW(pointBuffer, (short) 0); + len = rm.ecMultKA.generateSecret(pointBuffer, (short) 0, len, outBuffer, outBufferOffset); + rm.unlock(pointBuffer); + return len; + } + + /** + * Multiply value of this point by provided scalar using X-only key agreement. Stores the result into this point. + * + * @param scalar value of scalar for multiplication + */ + private void multX(BigNat scalar) { + byte[] pointBuffer = rm.POINT_ARRAY_A; + byte[] resultBuffer = rm.ARRAY_A; + BigNat x = rm.EC_BN_B; + BigNat ySq = rm.EC_BN_C; + BigNat y1 = rm.EC_BN_D; + BigNat y2 = rm.EC_BN_B; + + rm.lock(pointBuffer); + short len = multXKA(scalar, pointBuffer, (short) 0); + x.lock(); + x.fromByteArray(pointBuffer, (short) 0, len); + rm.unlock(pointBuffer); + + //Y^2 = X^3 + XA + B = x(x^2+A)+B + ySq.lock(); + ySq.clone(x); + ySq.modExp(ResourceManager.TWO, curve.pBN); + ySq.modAdd(curve.aBN, curve.pBN); + ySq.modMult(x, curve.pBN); + ySq.modAdd(curve.bBN, curve.pBN); + y1.lock(); + y1.clone(ySq); + ySq.unlock(); + y1.modSqrt(curve.pBN); + + // Prepare for SignVerify + rm.lock(pointBuffer); + getW(pointBuffer, (short) 0); + curve.disposablePriv.setG(pointBuffer, (short) 0, curve.POINT_SIZE); + curve.disposablePub.setG(pointBuffer, (short) 0, curve.POINT_SIZE); + + // Construct public key with + pointBuffer[0] = 0x04; + x.prependZeros(curve.COORD_SIZE, pointBuffer, (short) 1); + x.unlock(); + y1.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (1 + curve.COORD_SIZE)); + + // Check if public point corresponds to the "secret" (i.e., our scalar) + rm.lock(resultBuffer); + len = scalar.copyToByteArray(resultBuffer, (short) 0); + curve.disposablePriv.setS(resultBuffer, (short) 0, len); + curve.disposablePub.setW(pointBuffer, (short) 0, curve.POINT_SIZE); + if (!SignVerifyECDSA(curve.disposablePriv, curve.disposablePub, rm.verifyEcdsa, resultBuffer)) { // If verification fails, then pick the + y2.lock(); + y2.clone(curve.pBN); // y_2 = p - y_1 + y2.modSub(y1, curve.pBN); + y2.copyToByteArray(pointBuffer, (short) (1 + curve.COORD_SIZE)); + y2.unlock(); + } + rm.unlock(resultBuffer); + y1.unlock(); + + + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + } + + /** + * Multiplies this point value with provided scalar and stores result into + * provided array. No modification of this point is performed. + * Native X-only KeyAgreement engine is used. + * + * @param scalar value of scalar for multiplication + * @param outBuffer output array for resulting value + * @param outBufferOffset offset within output array + * @return length of resulting value (in bytes) + */ + private short multXKA(BigNat scalar, byte[] outBuffer, short outBufferOffset) { + byte[] pointBuffer = rm.POINT_ARRAY_B; + // NOTE: potential problem on real cards (j2e) - when small scalar is used (e.g., BigNat.TWO), operation sometimes freezes + rm.lock(pointBuffer); + short len = scalar.copyToByteArray(pointBuffer, (short) 0); + curve.disposablePriv.setS(pointBuffer, (short) 0, len); + + rm.ecMultKA.init(curve.disposablePriv); + + len = getW(pointBuffer, (short) 0); + rm.ecMultKA.generateSecret(pointBuffer, (short) 0, len, outBuffer, outBufferOffset); + rm.unlock(pointBuffer); + // Return always length of whole coordinate X instead of len - some real cards returns shorter value equal to SHA-1 output size although PLAIN results is filled into buffer (GD60) + return curve.COORD_SIZE; + } + + /** + * Computes negation of this point. + * The operation will dump point into uncompressed_point_arr, negate Y and restore back + */ + public void negate() { + byte[] pointBuffer = rm.POINT_ARRAY_A; + BigNat y = rm.EC_BN_C; + + y.lock(); + rm.lock(pointBuffer); + point.getW(pointBuffer, (short) 0); + y.setSize(curve.COORD_SIZE); + y.fromByteArray(pointBuffer, (short) (1 + curve.COORD_SIZE), curve.COORD_SIZE); + y.modNegate(curve.pBN); + y.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (1 + curve.COORD_SIZE)); + y.unlock(); + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + } + + /** + * Restore point from X coordinate. Stores one of the two results into this point. + * + * @param xCoord byte array containing the X coordinate + * @param xOffset offset in the byte array + * @param xLen length of the X coordinate + */ + public void fromX(byte[] xCoord, short xOffset, short xLen) { + BigNat x = rm.EC_BN_F; + + x.lock(); + x.setSize(xLen); + x.fromByteArray(xCoord, xOffset, xLen); + fromX(x); + x.unlock(); + } + + /** + * Restore point from X coordinate. Stores one of the two results into this point. + * + * @param x the x coordinate + */ + private void fromX(BigNat x) { + BigNat ySq = rm.EC_BN_C; + BigNat y = rm.EC_BN_D; + byte[] pointBuffer = rm.POINT_ARRAY_A; + + //Y^2 = X^3 + XA + B = x(x^2+A)+B + ySq.lock(); + ySq.clone(x); + ySq.modSq(curve.pBN); + ySq.modAdd(curve.aBN, curve.pBN); + ySq.modMult(x, curve.pBN); + ySq.modAdd(curve.bBN, curve.pBN); + y.lock(); + y.clone(ySq); + ySq.unlock(); + y.modSqrt(curve.pBN); + + // Construct public key with + rm.lock(pointBuffer); + pointBuffer[0] = 0x04; + x.prependZeros(curve.COORD_SIZE, pointBuffer, (short) 1); + y.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (1 + curve.COORD_SIZE)); + y.unlock(); + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + } + + /** + * Returns true if Y coordinate is even; false otherwise. + * + * @return true if Y coordinate is even; false otherwise + */ + public boolean isYEven() { + byte[] pointBuffer = rm.POINT_ARRAY_A; + + rm.lock(pointBuffer); + point.getW(pointBuffer, (short) 0); + boolean result = pointBuffer[(short) (curve.POINT_SIZE - 1)] % 2 == 0; + rm.unlock(pointBuffer); + return result; + } + + /** + * Compares this and provided point for equality. The comparison is made using hash of both values to prevent leak of position of mismatching byte. + * + * @param other second point for comparison + * @return true if both point are exactly equal (same length, same value), false otherwise + */ + public boolean isEqual(ECPoint other) { + if (length() != other.length()) { + return false; + } + // The comparison is made with hash of point values instead of directly values. + // This way, offset of first mismatching byte is not leaked via timing side-channel. + // Additionally, only single array is required for storage of plain point values thus saving some RAM. + byte[] pointBuffer = rm.POINT_ARRAY_A; + byte[] hashBuffer = rm.HASH_ARRAY; + + rm.lock(pointBuffer); + rm.lock(hashBuffer); + short len = getW(pointBuffer, (short) 0); + rm.hashEngine.doFinal(pointBuffer, (short) 0, len, hashBuffer, (short) 0); + len = other.getW(pointBuffer, (short) 0); + len = rm.hashEngine.doFinal(pointBuffer, (short) 0, len, pointBuffer, (short) 0); + boolean bResult = Util.arrayCompare(hashBuffer, (short) 0, pointBuffer, (short) 0, len) == 0; + rm.unlock(hashBuffer); + rm.unlock(pointBuffer); + + return bResult; + } + + static byte[] msg = {(byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03}; + + public static boolean SignVerifyECDSA(ECPrivateKey privateKey, ECPublicKey publicKey, Signature signEngine, byte[] tmpSignArray) { + signEngine.init(privateKey, Signature.MODE_SIGN); + short signLen = signEngine.sign(msg, (short) 0, (short) msg.length, tmpSignArray, (short) 0); + signEngine.init(publicKey, Signature.MODE_VERIFY); + return signEngine.verify(msg, (short) 0, (short) msg.length, tmpSignArray, (short) 0, signLen); + } + + + /** + * Decode SEC1-encoded point and load it into this. + * + * @param point array containing SEC1-encoded point + * @param offset offset within the output buffer + * @param length length of the encoded point + * @return true if the point was compressed; false otherwise + */ + public boolean decode(byte[] point, short offset, short length) { + if(length == (short) (1 + 2 * curve.COORD_SIZE) && point[offset] == 0x04) { + setW(point, offset, length); + return false; + } + if (length == (short) (1 + curve.COORD_SIZE)) { + BigNat y = rm.EC_BN_C; + BigNat x = rm.EC_BN_D; + BigNat p = rm.EC_BN_E; + byte[] pointBuffer = rm.POINT_ARRAY_A; + + x.lock(); + x.fromByteArray(point, (short) (offset + 1), curve.COORD_SIZE); + + //Y^2 = X^3 + XA + B = x(x^2+A)+B + y.lock(); + y.clone(x); + y.modSq(curve.pBN); + y.modAdd(curve.aBN, curve.pBN); + y.modMult(x, curve.pBN); + y.modAdd(curve.bBN, curve.pBN); + y.modSqrt(curve.pBN); + + rm.lock(pointBuffer); + pointBuffer[0] = 0x04; + x.prependZeros(curve.COORD_SIZE, pointBuffer, (short) 1); + x.unlock(); + + p.lock(); + boolean odd = y.isOdd(); + if ((!odd && point[offset] != (byte) 0x02) || (odd && point[offset] != (byte) 0x03)) { + p.clone(curve.pBN); + p.subtract(y); + p.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (curve.COORD_SIZE + 1)); + } else { + y.prependZeros(curve.COORD_SIZE, pointBuffer, (short) (curve.COORD_SIZE + 1)); + } + y.unlock(); + p.unlock(); + setW(pointBuffer, (short) 0, curve.POINT_SIZE); + rm.unlock(pointBuffer); + return true; + } + ISOException.throwIt(ReturnCodes.SW_ECPOINT_INVALID); + return true; // unreachable + } + + /** + * Encode this point into the output buffer. + * + * @param output output buffer; MUST be able to store offset + uncompressed size bytes + * @param offset offset within the output buffer + * @param compressed output compressed point if true; uncompressed otherwise + * @return length of output point + */ + public short encode(byte[] output, short offset, boolean compressed) { + getW(output, offset); + + if(compressed) { + if(output[offset] == (byte) 0x04) { + output[offset] = (byte) (((output[(short) (offset + 2 * curve.COORD_SIZE)] & 0xff) % 2) == 0 ? 2 : 3); + } + return (short) (curve.COORD_SIZE + 1); + } + + if(output[offset] != (byte) 0x04) { + BigNat y = rm.EC_BN_C; + BigNat x = rm.EC_BN_D; + BigNat p = rm.EC_BN_E; + x.lock(); + x.fromByteArray(output, (short) (offset + 1), curve.COORD_SIZE); + + //Y^2 = X^3 + XA + B = x(x^2+A)+B + y.lock(); + y.clone(x); + y.modSq(curve.pBN); + y.modAdd(curve.aBN, curve.pBN); + y.modMult(x, curve.pBN); + x.unlock(); + y.modAdd(curve.bBN, curve.pBN); + y.modSqrt(curve.pBN); + p.lock(); + boolean odd = y.isOdd(); + if ((!odd && output[offset] != (byte) 0x02) || (odd && output[offset] != (byte) 0x03)) { + p.clone(curve.pBN); + p.subtract(y); + p.prependZeros(curve.COORD_SIZE, output, (short) (offset + curve.COORD_SIZE + 1)); + } else { + y.prependZeros(curve.COORD_SIZE, output, (short) (offset + curve.COORD_SIZE + 1)); + } + y.unlock(); + p.unlock(); + output[offset] = (byte) 0x04; + } + return (short) (2 * curve.COORD_SIZE + 1); + } + + + + // + // ECKey methods + // + public void setFieldFP(byte[] bytes, short s, short s1) throws CryptoException { + point.setFieldFP(bytes, s, s1); + } + + public void setFieldF2M(short s) throws CryptoException { + point.setFieldF2M(s); + } + + public void setFieldF2M(short s, short s1, short s2) throws CryptoException { + point.setFieldF2M(s, s1, s2); + } + + public void setA(byte[] bytes, short s, short s1) throws CryptoException { + point.setA(bytes, s, s1); + } + + public void setB(byte[] bytes, short s, short s1) throws CryptoException { + point.setB(bytes, s, s1); + } + + public void setG(byte[] bytes, short s, short s1) throws CryptoException { + point.setG(bytes, s, s1); + } + + public void setR(byte[] bytes, short s, short s1) throws CryptoException { + point.setR(bytes, s, s1); + } + + public void setK(short s) { + point.setK(s); + } + + public short getField(byte[] bytes, short s) throws CryptoException { + return point.getField(bytes, s); + } + + public short getA(byte[] bytes, short s) throws CryptoException { + return point.getA(bytes, s); + } + + public short getB(byte[] bytes, short s) throws CryptoException { + return point.getB(bytes, s); + } + + public short getG(byte[] bytes, short s) throws CryptoException { + return point.getG(bytes, s); + } + + public short getR(byte[] bytes, short s) throws CryptoException { + return point.getR(bytes, s); + } + + public short getK() throws CryptoException { + return point.getK(); + } +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/Example.java b/applet/src/main/java/opencrypto/jcmathlib/Example.java new file mode 100644 index 00000000..0ca37a32 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/Example.java @@ -0,0 +1,106 @@ +package opencrypto.jcmathlib; + +import javacard.framework.APDU; +import javacard.framework.Applet; +import javacard.framework.JCSystem; + +/** + * @author Petr Svenda + */ +public class Example extends Applet { + ResourceManager rm; + ECCurve curve; + ECPoint point1, point2; + BigNat scalar1, scalar2; + boolean initialized = false; + + final static byte[] ECPOINT_TEST_VALUE = { + (byte) 0x04, + (byte) 0x3b, (byte) 0xc1, (byte) 0x5b, (byte) 0xe5, + (byte) 0xf7, (byte) 0x52, (byte) 0xb3, (byte) 0x27, + (byte) 0x0d, (byte) 0xb0, (byte) 0xae, (byte) 0xf2, + (byte) 0xbc, (byte) 0xf0, (byte) 0xec, (byte) 0xbd, + (byte) 0xb5, (byte) 0x78, (byte) 0x8f, (byte) 0x88, + (byte) 0xe6, (byte) 0x14, (byte) 0x32, (byte) 0x30, + (byte) 0x68, (byte) 0xc4, (byte) 0xc4, (byte) 0x88, + (byte) 0x6b, (byte) 0x43, (byte) 0x91, (byte) 0x4c, + (byte) 0x22, (byte) 0xe1, (byte) 0x67, (byte) 0x68, + (byte) 0x3b, (byte) 0x32, (byte) 0x95, (byte) 0x98, + (byte) 0x31, (byte) 0x19, (byte) 0x6d, (byte) 0x41, + (byte) 0x88, (byte) 0x0c, (byte) 0x9f, (byte) 0x8c, + (byte) 0x59, (byte) 0x67, (byte) 0x60, (byte) 0x86, + (byte) 0x1a, (byte) 0x86, (byte) 0xf8, (byte) 0x0d, + (byte) 0x01, (byte) 0x46, (byte) 0x0c, (byte) 0xb5, + (byte) 0x8d, (byte) 0x86, (byte) 0x6c, (byte) 0x09 + }; + final static byte[] SCALAR_TEST_VALUE = { + (byte) 0xe8, (byte) 0x05, (byte) 0xe8, (byte) 0x02, + (byte) 0xbf, (byte) 0xec, (byte) 0xee, (byte) 0x91, + (byte) 0x9b, (byte) 0x3d, (byte) 0x3b, (byte) 0xd8, + (byte) 0x3c, (byte) 0x7b, (byte) 0x52, (byte) 0xa5, + (byte) 0xd5, (byte) 0x35, (byte) 0x4c, (byte) 0x4c, + (byte) 0x06, (byte) 0x89, (byte) 0x80, (byte) 0x54, + (byte) 0xb9, (byte) 0x76, (byte) 0xfa, (byte) 0xb1, + (byte) 0xd3, (byte) 0x5a, (byte) 0x10, (byte) 0x91 + }; + + public Example() { + OperationSupport.getInstance().setCard(OperationSupport.SIMULATOR); // TODO set your card + if (!OperationSupport.getInstance().DEFERRED_INITIALIZATION) { + initialize(); + } + } + + public void initialize() { + if (initialized) { + return; + } + + // Allocate resources for a required elliptic curve size (in bits) + rm = new ResourceManager((short) 256); + // Allocate SecP256r1 curve and two EC points on this curve + curve = new ECCurve(SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r, rm); + point1 = new ECPoint(curve); + point2 = new ECPoint(curve); + // Allocate two BigNats large enough to hold scalars of the elliptic curve + scalar1 = new BigNat(curve.rBN.length(), JCSystem.MEMORY_TYPE_TRANSIENT_RESET, rm); + scalar2 = new BigNat(curve.rBN.length(), JCSystem.MEMORY_TYPE_TRANSIENT_RESET, rm); + + initialized = true; + } + + public static void install(byte[] bArray, short bOffset, byte bLength) { + new Example().register(); + } + + public boolean select() { + if (initialized) { + rm.refreshAfterReset(); + curve.updateAfterReset(); + } + return true; + } + + public void process(APDU apdu) { + if (selectingApplet()) { + return; + } + if (!initialized) { + initialize(); + } + + point1.randomize(); // Generate the first point at random + point2.setW(ECPOINT_TEST_VALUE, (short) 0, (short) ECPOINT_TEST_VALUE.length); // Set the second point to a predefined value + point1.add(point2); // Add the second point to the first one + + scalar1.setValue((byte) 42); // Set the first scalar to 42 + scalar2.fromByteArray(SCALAR_TEST_VALUE, (short) 0, (short) SCALAR_TEST_VALUE.length); // Set the second scalar to a predefined value + scalar1.modSq(curve.rBN); // Square the first scalar modulo curve order + scalar1.modMult(scalar2, curve.rBN); // Multiply the two scalars modulo curve order + + point1.multiplication(scalar1); // Multiply the resulting point by the resulting scalar + + short len = point1.getW(apdu.getBuffer(), (short) 0); // Serialize the point to APDU buffer + apdu.setOutgoingAndSend((short) 0, len); // Send the result to the host + } +} diff --git a/JCMathLib/src/opencrypto/jcmathlib/Integer.java b/applet/src/main/java/opencrypto/jcmathlib/Integer.java similarity index 59% rename from JCMathLib/src/opencrypto/jcmathlib/Integer.java rename to applet/src/main/java/opencrypto/jcmathlib/Integer.java index 5b9a6ef7..b09606a1 100644 --- a/JCMathLib/src/opencrypto/jcmathlib/Integer.java +++ b/applet/src/main/java/opencrypto/jcmathlib/Integer.java @@ -4,116 +4,122 @@ import javacard.framework.Util; /** - * -* @author Vasilios Mavroudis and Petr Svenda + * @author Vasilios Mavroudis and Petr Svenda */ public class Integer { - private Bignat_Helper bnh; - - private Bignat magnitude; + private ResourceManager rm; + private BigNat magnitude; private byte sign; - /** - * Allocates integer with provided length and sets to zero. - * @param size - * @param bnh Bignat_Helper with all supporting objects + * Allocates integer with provided length and sets to zero. + * + * @param size Integer size + * @param rm ResourceManager with all supporting objects */ - public Integer(short size, Bignat_Helper bnh) { - allocate(size, (byte) 0, null, (byte) -1, bnh); + public Integer(short size, ResourceManager rm) { + allocate(size, (byte) 0, null, (byte) -1, rm); } /** * Allocates integer from provided buffer and initialize by provided value. * Sign is expected as first byte of value. - * @param value array with initial value + * + * @param value array with initial value * @param valueOffset start offset within value - * @param length length of array - * @param bnh Bignat_Helper with all supporting objects + * @param length length of array + * @param rm ResourceManager with all supporting objects */ - public Integer(byte[] value, short valueOffset, short length, Bignat_Helper bnh) { - allocate(length, (value[valueOffset] == (byte) 0x00) ? (byte) 0 : (byte) 1, value, (short) (valueOffset + 1), bnh); + public Integer(byte[] value, short valueOffset, short length, ResourceManager rm) { + allocate(length, (value[valueOffset] == (byte) 0x00) ? (byte) 0 : (byte) 1, value, (short) (valueOffset + 1), rm); } /** * Allocates integer from provided array with explicit sign. No sign is expected in provided array. * * @param sign sign of integer - * @param value array with initial value - * @param bnh Bignat_Helper with all supporting objects + * @param value array with initial value + * @param rm ResourceManager with all supporting objects */ - public Integer(byte sign, byte[] value, Bignat_Helper bnh) { - allocate((short) value.length, sign, value, (short) 0, bnh); + public Integer(byte sign, byte[] value, ResourceManager rm) { + allocate((short) value.length, sign, value, (short) 0, rm); } /** * Copy constructor of integer from other already existing value + * * @param other integer to copy from */ public Integer(Integer other) { - allocate(other.getSize(), other.getSign(), other.getMagnitude_b(), (short) 0, other.bnh); + rm.lock(rm.ARRAY_A); + short len = magnitude.copyToByteArray(rm.ARRAY_A, (short) 0); + allocate(len, other.getSign(), rm.ARRAY_A, (short) 0, other.rm); + rm.unlock(rm.ARRAY_A); } /** - * Creates integer from existing Bignat and provided sign. If required, - * copy is performed, otherwise bignat is used as magnitude. - * @param sign sign of integer + * Creates integer from existing Bignat and provided sign. If required, + * copy is performed, otherwise BigNat is used as magnitude. + * + * @param sign sign of integer * @param magnitude initial magnitude - * @param bMakeCopy if true, magnitude is directly used (no copy). If false, new storage array is allocated. + * @param copy if true, magnitude is directly used (no copy). If false, new storage array is allocated. */ - public Integer(byte sign, Bignat magnitude, boolean bMakeCopy, Bignat_Helper bnh) { - if (bMakeCopy) { - // Copy from provided bignat - allocate(magnitude.length(), sign, magnitude.as_byte_array(), (short) 0, bnh); - } - else { - // Use directly provided Bignat as storage - no allocation - initialize(sign, magnitude, bnh); + public Integer(byte sign, BigNat magnitude, boolean copy, ResourceManager rm) { + if (copy) { + // Copy from provided BigNat + rm.lock(rm.ARRAY_A); + short len = magnitude.copyToByteArray(rm.ARRAY_A, (short) 0); + allocate(len, sign, rm.ARRAY_A, (short) 0, rm); + rm.unlock(rm.ARRAY_A); + } else { + // Use directly provided BigNat as storage - no allocation + initialize(sign, magnitude, rm); } } - + /** * Initialize integer object with provided sign and already allocated Bignat * as magnitude * - * @param sign sign of integer - * @param bnStorage magnitude (object is directly used, no copy is - * preformed) + * @param sign sign of integer + * @param bnStorage magnitude (object is directly used, no copy is performed) */ - private void initialize(byte sign, Bignat bnStorage, Bignat_Helper bnh) { + private void initialize(byte sign, BigNat bnStorage, ResourceManager rm) { this.sign = sign; this.magnitude = bnStorage; - this.bnh = bnh; + this.rm = rm; } /** * Allocates and initializes Integer. * - * @param size length of integer - * @param sign sign of integer - * @param fromArray input array with initial value (copy of value is - * performed) + * @param size length of integer + * @param sign sign of integer + * @param fromArray input array with initial value (copy of value is + * performed) * @param fromArrayOffset start offset within fromArray */ - private void allocate(short size, byte sign, byte[] fromArray, short fromArrayOffset, Bignat_Helper bignatHelper) { - this.bnh = bignatHelper; - Bignat mag = new Bignat(size, JCSystem.MEMORY_TYPE_TRANSIENT_RESET, this.bnh); + private void allocate(short size, byte sign, byte[] fromArray, short fromArrayOffset, ResourceManager rm) { + this.rm = rm; + BigNat mag = new BigNat(size, JCSystem.MEMORY_TYPE_TRANSIENT_RESET, this.rm); if (fromArray != null) { - mag.from_byte_array(size, (short) 0, fromArray, fromArrayOffset); + mag.fromByteArray(fromArray, fromArrayOffset, size); } - initialize(sign, mag, this.bnh); + initialize(sign, mag, this.rm); } - + /** * Clone value into this Integer from other Integer. Updates size of integer. - * @param other other integer to copy from + * + * @param other other integer to copy from */ public void clone(Integer other) { this.sign = other.getSign(); this.magnitude.copy(other.getMagnitude()); } - /** + /** * set this integer to zero */ public void zero() { @@ -123,13 +129,16 @@ public void zero() { /** * Return sign of this integer + * * @return current sign */ public byte getSign() { return this.sign; } + /** * Set sign of this integer + * * @param s new sign */ public void setSign(byte s) { @@ -138,17 +147,20 @@ public void setSign(byte s) { /** * Return length (in bytes) of this integer + * * @return length of this integer */ public short getSize() { return this.magnitude.length(); - } + } + /** * Set length of this integer + * * @param newSize new length */ public void setSize(short newSize) { - this.magnitude.set_size(newSize); + this.magnitude.setSize(newSize); } /** @@ -162,27 +174,19 @@ public void negate() { } } - /** - * Returns internal array as byte array. No copy is performed so change of - * values in array also changes this integer - * @return byte array with magnitude - */ - public byte[] getMagnitude_b() { - return this.magnitude.as_byte_array(); - } - /** * Returns magnitude as Bignat. No copy is performed so change of Bignat also changes this integer * * @return Bignat representing magnitude */ - public Bignat getMagnitude() { + public BigNat getMagnitude() { return this.magnitude; } /** - * Set magnitude of this integer from other one. Will not change this integer length. + * Set magnitude of this integer from other one. Will not change this integer length. * No sign is copied from other. + * * @param other other integer to copy from */ public void setMagnitude(Integer other) { @@ -191,22 +195,24 @@ public void setMagnitude(Integer other) { /** * Serializes this integer value into array. Sign is serialized as first byte - * @param outBuffer output array + * + * @param outBuffer output array * @param outBufferOffset start offset within output array - * @return length of resulting serialized number including sign (number of bytes) + * @return length of resulting serialized number including sign (number of bytes) */ public short toByteArray(byte[] outBuffer, short outBufferOffset) { //Store sign outBuffer[outBufferOffset] = sign; //Store magnitude - Util.arrayCopyNonAtomic(this.getMagnitude_b(), (short) 0, outBuffer, (short) (outBufferOffset + 1), this.getSize()); + magnitude.copyToByteArray(outBuffer, (short) (outBufferOffset + 1)); return (short) (this.getSize() + 1); } - + /** - * Deserialize value of this integer from provided array including sign. + * Deserialize value of this integer from provided array including sign. * Sign is expected to be as first byte - * @param value array with value + * + * @param value array with value * @param valueOffset start offset within value * @param valueLength length of value */ @@ -214,11 +220,12 @@ public void fromByteArray(byte[] value, short valueOffset, short valueLength) { //Store sign this.sign = value[valueOffset]; //Store magnitude - this.magnitude.from_byte_array((short) (valueLength - 1), (short) 0, value, (short) (valueOffset + 1)); + this.magnitude.fromByteArray(value, (short) (valueOffset + 1), (short) (valueLength - 1)); } /** * Return true if integer is negative. + * * @return true if integer is negative, false otherwise */ public boolean isNegative() { @@ -236,6 +243,7 @@ public boolean isPositive() { /** * Compares two integers. Return true, if this is smaller than other. + * * @param other other integer to compare * @return true, if this is strictly smaller than other. False otherwise. */ @@ -245,17 +253,20 @@ public boolean lesser(Integer other) { } else if (this.sign == 0 && other.sign == 1) { return false; } else if ((this.sign == 0 && other.sign == 0)) { - return this.magnitude.lesser(other.magnitude); + return this.magnitude.isLesser(other.magnitude); } else { //if ((this.sign == 1 && other.sign==1)) - return (!this.magnitude.lesser(other.magnitude)); + return (!this.magnitude.isLesser(other.magnitude)); } } /** * Add other integer to this and store result into this. - * @param other other integer to add + * + * @param other other integer to add */ public void add(Integer other) { + BigNat tmp = rm.BN_A; + if (this.isPositive() && other.isPositive()) { //this and other are (+) this.sign = 0; this.magnitude.add(other.magnitude); @@ -263,27 +274,27 @@ public void add(Integer other) { this.sign = 1; this.magnitude.add(other.magnitude); } else { - if (this.isPositive() && other.getMagnitude().lesser(this.getMagnitude())) { //this(+) is larger than other(-) + if (this.isPositive() && other.getMagnitude().isLesser(this.getMagnitude())) { //this(+) is larger than other(-) this.sign = 0; this.magnitude.subtract(other.magnitude); - } else if (this.isNegative() && other.getMagnitude().lesser(this.getMagnitude())) { //this(-) has larger magnitude than other(+) + } else if (this.isNegative() && other.getMagnitude().isLesser(this.getMagnitude())) { //this(-) has larger magnitude than other(+) this.sign = 1; this.magnitude.subtract(other.magnitude); - } else if (this.isPositive() && this.getMagnitude().lesser(other.getMagnitude())) { //this(+) has smaller magnitude than other(-) + } else if (this.isPositive() && this.getMagnitude().isLesser(other.getMagnitude())) { //this(+) has smaller magnitude than other(-) this.sign = 1; - bnh.fnc_int_add_tmpMag.lock(); - bnh.fnc_int_add_tmpMag.clone(other.getMagnitude()); - bnh.fnc_int_add_tmpMag.subtract(this.magnitude); - this.magnitude.copy(bnh.fnc_int_add_tmpMag); - bnh.fnc_int_add_tmpMag.unlock(); - } else if (this.isNegative() && this.getMagnitude().lesser(other.getMagnitude())) { //this(-) has larger magnitude than other(+) + tmp.lock(); + tmp.clone(other.getMagnitude()); + tmp.subtract(this.magnitude); + this.magnitude.copy(tmp); + tmp.unlock(); + } else if (this.isNegative() && this.getMagnitude().isLesser(other.getMagnitude())) { //this(-) has larger magnitude than other(+) this.sign = 0; - bnh.fnc_int_add_tmpMag.lock(); - bnh.fnc_int_add_tmpMag.clone(other.getMagnitude()); - bnh.fnc_int_add_tmpMag.subtract(this.magnitude); - this.magnitude.copy(bnh.fnc_int_add_tmpMag); - bnh.fnc_int_add_tmpMag.unlock(); - } else if (this.getMagnitude().same_value(other.getMagnitude())) { //this has opposite sign than other, and the same magnitude + tmp.lock(); + tmp.clone(other.getMagnitude()); + tmp.subtract(this.magnitude); + this.magnitude.copy(tmp); + tmp.unlock(); + } else if (this.getMagnitude().equals(other.getMagnitude())) { //this has opposite sign than other, and the same magnitude this.sign = 0; this.zero(); } @@ -308,6 +319,8 @@ public void subtract(Integer other) { * @param other other integer to multiply */ public void multiply(Integer other) { + BigNat tmp = rm.BN_B; + if (this.isPositive() && other.isNegative()) { this.setSign((byte) 1); } else if (this.isNegative() && other.isPositive()) { @@ -316,18 +329,11 @@ public void multiply(Integer other) { this.setSign((byte) 0); } - // Make mod BN as maximum value (positive, leading 0x80) - bnh.fnc_int_multiply_mod.lock(); - bnh.fnc_int_multiply_mod.set_size(this.magnitude.length()); - bnh.fnc_int_multiply_mod.zero(); - bnh.fnc_int_multiply_mod.as_byte_array()[0] = (byte) 0x80; // Max INT+1 Value - - bnh.fnc_int_multiply_tmpThis.lock(); - bnh.fnc_int_multiply_tmpThis.set_size(this.magnitude.length()); - bnh.fnc_int_multiply_tmpThis.mod_mult(this.getMagnitude(), other.getMagnitude(), bnh.fnc_int_multiply_mod); - this.magnitude.copy(bnh.fnc_int_multiply_tmpThis); - bnh.fnc_int_multiply_mod.unlock(); - bnh.fnc_int_multiply_tmpThis.unlock(); + tmp.lock(); + tmp.clone(this.magnitude); + tmp.mult(other.getMagnitude()); + this.magnitude.copy(tmp); + tmp.unlock(); } /** @@ -336,6 +342,8 @@ public void multiply(Integer other) { * @param other divisor */ public void divide(Integer other) { + BigNat tmp = rm.BN_A; + if (this.isPositive() && other.isNegative()) { this.setSign((byte) 1); } else if (this.isNegative() && other.isPositive()) { @@ -344,17 +352,17 @@ public void divide(Integer other) { this.setSign((byte) 0); } - bnh.fnc_int_divide_tmpThis.lock(); - bnh.fnc_int_divide_tmpThis.clone(this.magnitude); - bnh.fnc_int_divide_tmpThis.remainder_divide(other.getMagnitude(), this.magnitude); - bnh.fnc_int_divide_tmpThis.unlock(); + tmp.lock(); + tmp.clone(this.magnitude); + tmp.remainderDivide(other.getMagnitude(), this.magnitude); + tmp.unlock(); } /** * Computes modulo of this by other integer and store result into this. * * @param other modulus - */ + */ public void modulo(Integer other) { this.magnitude.mod(other.getMagnitude()); } diff --git a/JCMathLib/src/opencrypto/jcmathlib/ObjectAllocator.java b/applet/src/main/java/opencrypto/jcmathlib/ObjectAllocator.java similarity index 58% rename from JCMathLib/src/opencrypto/jcmathlib/ObjectAllocator.java rename to applet/src/main/java/opencrypto/jcmathlib/ObjectAllocator.java index 15cf0bde..fbda91fa 100644 --- a/JCMathLib/src/opencrypto/jcmathlib/ObjectAllocator.java +++ b/applet/src/main/java/opencrypto/jcmathlib/ObjectAllocator.java @@ -15,27 +15,30 @@ public class ObjectAllocator { short allocatedInRAM = 0; short allocatedInEEPROM = 0; - byte[] ALLOCATOR_TYPE_ARRAY = null; + byte[] ALLOCATOR_TYPE_ARRAY; - public static final byte BNH_helper_BN_array1 = 0; - public static final byte BNH_helper_BN_array2 = 1; - public static final byte BNH_helper_BN_A = 2; - public static final byte BNH_helper_BN_B = 3; - public static final byte BNH_helper_BN_C = 4; - public static final byte BNH_helper_BN_D = 5; - public static final byte BNH_helper_BN_E = 6; - public static final byte BNH_helper_BN_F = 7; - - public static final byte ECPH_helperEC_BN_A = 8; - public static final byte ECPH_helperEC_BN_B = 9; - public static final byte ECPH_helperEC_BN_C = 10; - public static final byte ECPH_helperEC_BN_D = 11; - public static final byte ECPH_helperEC_BN_E = 12; - public static final byte ECPH_helperEC_BN_F = 13; - public static final byte ECPH_uncompressed_point_arr1 = 14; - public static final byte ECPH_hashArray = 15; + public static final byte ARRAY_A = 0; + public static final byte ARRAY_B = 1; + public static final byte BN_WORD = 2; + public static final byte BN_A = 3; + public static final byte BN_B = 4; + public static final byte BN_C = 5; + public static final byte BN_D = 6; + public static final byte BN_E = 7; + public static final byte BN_F = 8; + public static final byte BN_G = 9; + + public static final byte EC_BN_A = 10; + public static final byte EC_BN_B = 11; + public static final byte EC_BN_C = 12; + public static final byte EC_BN_D = 13; + public static final byte EC_BN_E = 14; + public static final byte EC_BN_F = 15; + public static final byte POINT_ARRAY_A = 16; + public static final byte POINT_ARRAY_B = 17; + public static final byte HASH_ARRAY = 18; - public static final short ALLOCATOR_TYPE_ARRAY_LENGTH = (short) (ECPH_hashArray + 1); + public static final short ALLOCATOR_TYPE_ARRAY_LENGTH = (short) (HASH_ARRAY + 1); /** * Creates new allocator control object, resets performance counters @@ -66,17 +69,20 @@ public void setAllocatorsTradeoff() { setAllAllocatorsEEPROM(); // Put only the most perfromance relevant ones into RAM - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_array1] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_array2] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_A] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_C] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_D] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_E] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[BNH_helper_BN_F] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[ECPH_helperEC_BN_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[ECPH_helperEC_BN_C] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; - ALLOCATOR_TYPE_ARRAY[ECPH_uncompressed_point_arr1] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[ARRAY_A] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[ARRAY_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_WORD] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_A] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_C] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_D] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_E] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_F] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[BN_G] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[EC_BN_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[EC_BN_C] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[POINT_ARRAY_A] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + ALLOCATOR_TYPE_ARRAY[POINT_ARRAY_B] = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; } /** @@ -102,6 +108,29 @@ public byte[] allocateByteArray(short length, byte allocatorType) { return null; } + /** + * Allocates new short[] array with provided length either in RAM or EEPROM based on an allocator type. + * Method updates internal counters of bytes allocated with specific allocator. Use {@code getAllocatedInRAM()} + * or {@code getAllocatedInEEPROM} for counters readout. + * @param length length of array + * @param allocatorType type of allocator + * @return allocated array + */ + public short[] allocateShortArray(short length, byte allocatorType) { + switch (allocatorType) { + case JCSystem.MEMORY_TYPE_PERSISTENT: + allocatedInEEPROM += (short) (2 * length); + return new short[length]; + case JCSystem.MEMORY_TYPE_TRANSIENT_RESET: + allocatedInRAM += (short) (2 * length); + return JCSystem.makeTransientShortArray(length, JCSystem.CLEAR_ON_RESET); + case JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT: + allocatedInRAM += (short) (2 * length); + return JCSystem.makeTransientShortArray(length, JCSystem.CLEAR_ON_DESELECT); + } + return null; + } + /** * Returns pre-set allocator type for provided object identified by unique objectAllocatorID * @param objectAllocatorID unique id of target object diff --git a/JCMathLib/src/opencrypto/jcmathlib/ObjectLocker.java b/applet/src/main/java/opencrypto/jcmathlib/ObjectLocker.java similarity index 100% rename from JCMathLib/src/opencrypto/jcmathlib/ObjectLocker.java rename to applet/src/main/java/opencrypto/jcmathlib/ObjectLocker.java diff --git a/applet/src/main/java/opencrypto/jcmathlib/OperationSupport.java b/applet/src/main/java/opencrypto/jcmathlib/OperationSupport.java new file mode 100644 index 00000000..2c25e2f4 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/OperationSupport.java @@ -0,0 +1,95 @@ +package opencrypto.jcmathlib; + +/** + * OperationSupport class + * + * @author Antonin Dufka + */ +public class OperationSupport { + private static OperationSupport instance; + + public static final short SIMULATOR = 0x0000; // jCardSim.org simulator + public static final short JCOP21 = 0x0001; // NXP J2E145G + public static final short JCOP3_P60 = 0x0002; // NXP JCOP3 J3H145 P60 + public static final short JCOP4_P71 = 0x0003; // NXP JCOP4 J3Rxxx P71 + public static final short GD60 = 0x0004; // G+D Sm@rtcafe 6.0 + public static final short GD70 = 0x0005; // G+D Sm@rtcafe 7.0 + public static final short SECORA = 0x0006; // Infineon Secora ID S + + public short MIN_RSA_BIT_LENGTH = 512; + public boolean DEFERRED_INITIALIZATION = false; + + public boolean RSA_EXP = true; + public boolean RSA_SQ = true; + public boolean RSA_PUB = false; + public boolean RSA_CHECK_ONE = false; + public boolean RSA_KEY_REFRESH = false; + public boolean RSA_PREPEND_ZEROS = false; + public boolean RSA_EXTRA_MOD = false; + public boolean RSA_RESIZE_MOD = true; + public boolean RSA_APPEND_MOD = false; + + public boolean EC_HW_XY = false; + public boolean EC_HW_X = true; + public boolean EC_HW_ADD = false; + public boolean EC_SW_DOUBLE = false; + + private OperationSupport() { + } + + public static OperationSupport getInstance() { + if (OperationSupport.instance == null) OperationSupport.instance = new OperationSupport(); + return OperationSupport.instance; + } + + public void setCard(short card_identifier) { + switch (card_identifier) { + case SIMULATOR: + RSA_KEY_REFRESH = true; + RSA_PREPEND_ZEROS = true; + RSA_RESIZE_MOD = false; + EC_HW_XY = true; + EC_HW_ADD = true; + EC_SW_DOUBLE = true; + break; + case JCOP21: + RSA_PUB = true; + RSA_EXTRA_MOD = true; + RSA_APPEND_MOD = true; + EC_SW_DOUBLE = true; + break; + case GD60: + RSA_PUB = true; + RSA_EXTRA_MOD = true; + RSA_APPEND_MOD = true; + break; + case GD70: + RSA_PUB = true; + RSA_CHECK_ONE = true; + RSA_EXTRA_MOD = true; + RSA_APPEND_MOD = true; + break; + case JCOP3_P60: + DEFERRED_INITIALIZATION = true; + RSA_PUB = true; + EC_HW_XY = true; + EC_HW_ADD = true; + break; + case JCOP4_P71: + DEFERRED_INITIALIZATION = true; + EC_HW_XY = true; + EC_HW_ADD = true; + break; + case SECORA: + MIN_RSA_BIT_LENGTH = 1024; + RSA_SQ = false; + RSA_PUB = true; + RSA_EXTRA_MOD = true; + RSA_APPEND_MOD = true; + EC_HW_XY = true; + break; + default: + break; + } + } +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/ResourceManager.java b/applet/src/main/java/opencrypto/jcmathlib/ResourceManager.java new file mode 100644 index 00000000..c281a316 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/ResourceManager.java @@ -0,0 +1,316 @@ +package opencrypto.jcmathlib; + +import javacard.framework.ISOException; +import javacard.framework.JCSystem; +import javacard.framework.Util; +import javacard.security.*; +import javacardx.crypto.Cipher; + +/** + * @author Petr Svenda + */ +public class ResourceManager { + public ObjectAllocator memAlloc; + + MessageDigest hashEngine; + KeyAgreement ecMultKA; + KeyAgreement ecAddKA; + Signature verifyEcdsa; + Cipher sqCiph, modSqCiph, expCiph; + RSAPublicKey sqPub, modSqPub, expPub; + RSAPrivateKey sqPriv, modSqPriv, expPriv; + BigNat fixedMod; + + byte[] ARRAY_A, ARRAY_B, POINT_ARRAY_A, POINT_ARRAY_B, HASH_ARRAY; + + static byte[] CONST_TWO = {0x02}; + + BigNat BN_WORD; + BigNat BN_A, BN_B, BN_C, BN_D, BN_E, BN_F, BN_G; + BigNat EC_BN_A, EC_BN_B, EC_BN_C, EC_BN_D, EC_BN_E, EC_BN_F; + public static BigNat TWO, THREE, ONE_COORD; + + public final short MAX_EXP_BIT_LENGTH; + public final short MAX_EXP_LENGTH; + public final short MAX_SQ_BIT_LENGTH; + public final short MAX_SQ_LENGTH; + public final short MAX_BIGNAT_SIZE; + public final short MAX_POINT_SIZE; + public final short MAX_COORD_SIZE; + + public ResourceManager(short maxEcLength) { + short min = OperationSupport.getInstance().MIN_RSA_BIT_LENGTH; + if (maxEcLength <= (short) 256) { + MAX_EXP_BIT_LENGTH = (short) 512 < min ? min : (short) 512; + MAX_SQ_BIT_LENGTH = (short) 768 < min ? min : (short) 768; + MAX_POINT_SIZE = (short) 64; + } + else if (maxEcLength <= (short) 384) { + MAX_EXP_BIT_LENGTH = (short) 768 < min ? min : (short) 768; + MAX_SQ_BIT_LENGTH = (short) 1024 < min ? min : (short) 1024; + MAX_POINT_SIZE = (short) 96; + } + else if (maxEcLength <= (short) 512) { + MAX_EXP_BIT_LENGTH = (short) 1024 < min ? min : (short) 1024; + MAX_SQ_BIT_LENGTH = (short) 1280 < min ? min : (short) 1280; + MAX_POINT_SIZE = (short) 128; + } + else { + MAX_EXP_BIT_LENGTH = (short) 0; + MAX_SQ_BIT_LENGTH = (short) 0; + MAX_POINT_SIZE = (short) 0; + ISOException.throwIt(ReturnCodes.SW_ECPOINT_INVALIDLENGTH); + } + MAX_SQ_LENGTH = (short) (MAX_SQ_BIT_LENGTH / 8); + MAX_EXP_LENGTH = (short) (MAX_EXP_BIT_LENGTH / 8); + MAX_BIGNAT_SIZE = (short) (MAX_EXP_BIT_LENGTH / 8); + MAX_COORD_SIZE = (short) (MAX_POINT_SIZE / 2); + + memAlloc = new ObjectAllocator(); + memAlloc.setAllAllocatorsRAM(); + // if required, memory for helper objects and arrays can be in persistent memory to save RAM (or some tradeoff) + // ObjectAllocator.setAllAllocatorsEEPROM(); + // ObjectAllocator.setAllocatorsTradeoff(); + + + ARRAY_A = memAlloc.allocateByteArray(MAX_SQ_LENGTH, memAlloc.getAllocatorType(ObjectAllocator.ARRAY_A)); + locker.registerLock(ARRAY_A); + ARRAY_B = memAlloc.allocateByteArray(MAX_SQ_LENGTH, memAlloc.getAllocatorType(ObjectAllocator.ARRAY_B)); + locker.registerLock(ARRAY_B); + POINT_ARRAY_A = memAlloc.allocateByteArray((short) (MAX_POINT_SIZE + 1), memAlloc.getAllocatorType(ObjectAllocator.POINT_ARRAY_A)); + locker.registerLock(POINT_ARRAY_A); + POINT_ARRAY_B = memAlloc.allocateByteArray((short) (MAX_POINT_SIZE + 1), memAlloc.getAllocatorType(ObjectAllocator.POINT_ARRAY_B)); + locker.registerLock(POINT_ARRAY_B); + hashEngine = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false); + HASH_ARRAY = memAlloc.allocateByteArray(hashEngine.getLength(), memAlloc.getAllocatorType(ObjectAllocator.HASH_ARRAY)); + locker.registerLock(HASH_ARRAY); + + BN_WORD = new BigNat((short) 2, memAlloc.getAllocatorType(ObjectAllocator.BN_WORD), this); + + BN_A = new BigNat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BN_A), this); + BN_B = new BigNat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BN_B), this); + BN_C = new BigNat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BN_C), this); + BN_D = new BigNat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BN_D), this); + BN_E = new BigNat(MAX_BIGNAT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.BN_E), this); + BN_F = new BigNat(MAX_SQ_LENGTH, memAlloc.getAllocatorType(ObjectAllocator.BN_F), this); + BN_G = new BigNat(MAX_SQ_LENGTH, memAlloc.getAllocatorType(ObjectAllocator.BN_G), this); + + EC_BN_A = new BigNat(MAX_POINT_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_A), this); + EC_BN_B = new BigNat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_B), this); + EC_BN_C = new BigNat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_C), this); + EC_BN_D = new BigNat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_D), this); + EC_BN_E = new BigNat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_E), this); + EC_BN_F = new BigNat(MAX_COORD_SIZE, memAlloc.getAllocatorType(ObjectAllocator.EC_BN_F), this); + + // Allocate BN constants always in EEPROM (only reading) + TWO = new BigNat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this); + TWO.setValue((byte) 2); + THREE = new BigNat((short) 1, JCSystem.MEMORY_TYPE_PERSISTENT, this); + THREE.setValue((byte) 3); + ONE_COORD = new BigNat(MAX_COORD_SIZE, JCSystem.MEMORY_TYPE_PERSISTENT, this); + ONE_COORD.setValue((byte) 1); + // ECC Helpers + if (OperationSupport.getInstance().EC_HW_XY) { + // ecMultKA = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DH_PLAIN_XY, false); + ecMultKA = KeyAgreement.getInstance((byte) 6, false); + } else if (OperationSupport.getInstance().EC_HW_X) { + // ecMultKA = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DH_PLAIN, false); + ecMultKA = KeyAgreement.getInstance((byte) 3, false); + } + // verifyEcdsa = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false); + verifyEcdsa = Signature.getInstance((byte) 33, false); + if (OperationSupport.getInstance().EC_HW_ADD) { + // ecAddKA = KeyAgreement.getInstance(KeyAgreement.ALG_EC_PACE_GM, false); + ecAddKA = KeyAgreement.getInstance((byte) 5, false); + } + + // RSA Sq Helpers + if (OperationSupport.getInstance().RSA_SQ) { + Util.arrayFillNonAtomic(ARRAY_A, (short) 0, MAX_SQ_LENGTH, (byte) 0xff); + sqCiph = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false); + modSqCiph = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false); + if (OperationSupport.getInstance().RSA_PUB) { + modSqPub = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, MAX_EXP_BIT_LENGTH, false); + sqPub = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, MAX_SQ_BIT_LENGTH, false); + sqPub.setExponent(CONST_TWO, (short) 0, (short) CONST_TWO.length); + sqPub.setModulus(ARRAY_A, (short) 0, MAX_SQ_LENGTH); + sqCiph.init(sqPub, Cipher.MODE_ENCRYPT); + } else { + modSqPriv = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, MAX_EXP_BIT_LENGTH, false); + sqPriv = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, MAX_SQ_BIT_LENGTH, false); + sqPriv.setExponent(CONST_TWO, (short) 0, (short) CONST_TWO.length); + sqPriv.setModulus(ARRAY_A, (short) 0, MAX_SQ_LENGTH); + sqCiph.init(sqPriv, Cipher.MODE_DECRYPT); + } + } + + // RSA Exp Helpers + expPub = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, MAX_EXP_BIT_LENGTH, false); + expPriv = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, MAX_EXP_BIT_LENGTH, false); + expCiph = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false); + } + + /** + * Preloads modSq engine with a given mod. Can increase performance when the same mod is used repeatedly. The + * provided mod is assumed to be fixed. + */ + public void fixModSqMod(BigNat mod) { + if (!OperationSupport.getInstance().RSA_SQ) { + return; // modSq engine is not used + } + fixedMod = mod; + if (mod == null) { + return; + } + BigNat tmpMod = BN_F; + byte[] tmpBuffer = ARRAY_A; + + tmpMod.lock(); + lock(ARRAY_A); + tmpMod.setSize(MAX_EXP_LENGTH); + if (OperationSupport.getInstance().RSA_PUB) { + if (OperationSupport.getInstance().RSA_KEY_REFRESH) { + modSqPub = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC, MAX_EXP_BIT_LENGTH, false); + } + modSqPub.setExponent(ResourceManager.CONST_TWO, (short) 0, (short) ResourceManager.CONST_TWO.length); + if (OperationSupport.getInstance().RSA_RESIZE_MOD) { + if (OperationSupport.getInstance().RSA_APPEND_MOD) { + mod.appendZeros(MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } else { + mod.prependZeros(MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } + modSqPub.setModulus(tmpBuffer, (short) 0, MAX_EXP_LENGTH); + } else { + short modLength = mod.copyToByteArray(tmpBuffer, (short) 0); + modSqPub.setModulus(tmpBuffer, (short) 0, modLength); + } + modSqCiph.init(modSqPub, Cipher.MODE_DECRYPT); + } else { + if (OperationSupport.getInstance().RSA_KEY_REFRESH) { + modSqPriv = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE, MAX_EXP_BIT_LENGTH, false); + } + modSqPriv.setExponent(ResourceManager.CONST_TWO, (short) 0, (short) ResourceManager.CONST_TWO.length); + if (OperationSupport.getInstance().RSA_RESIZE_MOD) { + if (OperationSupport.getInstance().RSA_APPEND_MOD) { + mod.appendZeros(MAX_EXP_LENGTH, tmpBuffer, (short) 0); + } else { + mod.prependZeros(MAX_EXP_LENGTH, tmpBuffer, (short) 0); + + } + modSqPriv.setModulus(tmpBuffer, (short) 0, MAX_EXP_LENGTH); + } else { + short modLength = mod.copyToByteArray(tmpBuffer, (short) 0); + modSqPriv.setModulus(tmpBuffer, (short) 0, modLength); + } + modSqCiph.init(modSqPriv, Cipher.MODE_DECRYPT); + } + unlock(ARRAY_A); + tmpMod.unlock(); + } + + /** + * Erase all values stored in helper objects + */ + void erase() { + BN_WORD.erase(); + + BN_A.erase(); + BN_B.erase(); + BN_C.erase(); + BN_D.erase(); + BN_E.erase(); + BN_F.erase(); + BN_G.erase(); + + EC_BN_A.erase(); + EC_BN_B.erase(); + EC_BN_C.erase(); + EC_BN_D.erase(); + EC_BN_E.erase(); + EC_BN_F.erase(); + + Util.arrayFillNonAtomic(ARRAY_A, (short) 0, (short) ARRAY_A.length, (byte) 0); + Util.arrayFillNonAtomic(ARRAY_B, (short) 0, (short) ARRAY_B.length, (byte) 0); + Util.arrayFillNonAtomic(POINT_ARRAY_A, (short) 0, (short) POINT_ARRAY_A.length, (byte) 0); + } + + /// [DependencyBegin:ObjectLocker] + public static final byte LOCKER_ARRAYS = 5; + public static final byte LOCKER_OBJECTS = 1; + public ObjectLocker locker = new ObjectLocker((short) (LOCKER_ARRAYS + LOCKER_OBJECTS)); + + /** + * Refresh RAM objects after reset. + */ + public void refreshAfterReset() { + if (locker != null) { + locker.refreshAfterReset(); + } + } + /** + * Lock a byte array + * + * @param objToLock the byte array + */ + public void lock(byte[] objToLock) { + locker.lock(objToLock); + } + + /** + * Unlock a byte array + * + * @param objToUnlock the byte array + */ + public void unlock(byte[] objToUnlock) { + locker.unlock(objToUnlock); + } + + /** + * Unlocks all locked objects + */ + public void unlockAll() { + if (BN_A.isLocked()) { + BN_A.unlock(); + } + if (BN_B.isLocked()) { + BN_B.unlock(); + } + if (BN_C.isLocked()) { + BN_C.unlock(); + } + if (BN_D.isLocked()) { + BN_D.unlock(); + } + if (BN_E.isLocked()) { + BN_E.unlock(); + } + if (BN_F.isLocked()) { + BN_F.unlock(); + } + if (BN_G.isLocked()) { + BN_G.unlock(); + } + + if (EC_BN_A.isLocked()) { + EC_BN_A.unlock(); + } + if (EC_BN_B.isLocked()) { + EC_BN_B.unlock(); + } + if (EC_BN_C.isLocked()) { + EC_BN_C.unlock(); + } + if (EC_BN_D.isLocked()) { + EC_BN_D.unlock(); + } + if (EC_BN_E.isLocked()) { + EC_BN_E.unlock(); + } + if (EC_BN_F.isLocked()) { + EC_BN_F.unlock(); + } + + locker.unlockAll(); + } + /// [DependencyEnd:ObjectLocker] +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/ReturnCodes.java b/applet/src/main/java/opencrypto/jcmathlib/ReturnCodes.java new file mode 100644 index 00000000..94f67bc8 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/ReturnCodes.java @@ -0,0 +1,26 @@ +package opencrypto.jcmathlib; + +/** + * +* @author Vasilios Mavroudis and Petr Svenda + */ +public class ReturnCodes { + // Custom error response codes + public static final short SW_BIGNAT_RESIZETOLONGER = (short) 0x7000; + public static final short SW_BIGNAT_REALLOCATIONNOTALLOWED = (short) 0x7001; + public static final short SW_BIGNAT_MODULOTOOLARGE = (short) 0x7002; + public static final short SW_BIGNAT_INVALIDCOPYOTHER = (short) 0x7003; + public static final short SW_BIGNAT_INVALIDRESIZE = (short) 0x7004; + public static final short SW_BIGNAT_INVALIDMULT = (short) 0x7005; + public static final short SW_BIGNAT_INVALIDSQ = (short) 0x7006; + public static final short SW_LOCK_ALREADYLOCKED = (short) 0x7010; + public static final short SW_LOCK_NOTLOCKED = (short) 0x7011; + public static final short SW_LOCK_OBJECT_NOT_FOUND = (short) 0x7012; + public static final short SW_LOCK_NOFREESLOT = (short) 0x7013; + public static final short SW_LOCK_OBJECT_MISMATCH = (short) 0x7014; + public static final short SW_ECPOINT_INVALIDLENGTH = (short) 0x7020; + public static final short SW_ECPOINT_UNEXPECTED_KA_LEN = (short) 0x7021; + public static final short SW_ECPOINT_INVALID = (short) 0x7022; + public static final short SW_ALLOCATOR_INVALIDOBJID = (short) 0x7030; + public static final short SW_OPERATION_NOT_SUPPORTED = (short) 0x7040; +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/UnitTests.java b/applet/src/main/java/opencrypto/jcmathlib/UnitTests.java new file mode 100644 index 00000000..211cb58e --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/UnitTests.java @@ -0,0 +1,733 @@ +package opencrypto.jcmathlib; + + +import javacard.framework.APDU; +import javacard.framework.Applet; +import javacard.framework.CardRuntimeException; +import javacard.framework.ISO7816; +import javacard.framework.ISOException; +import javacard.framework.JCSystem; +import javacard.framework.PINException; +import javacard.framework.SystemException; +import javacard.framework.TransactionException; +import javacard.framework.Util; +import javacard.security.CryptoException; + +/** + * @author Vasilios Mavroudis and Petr Svenda and Antonin Dufka + */ +public class UnitTests extends Applet { + public final static short CARD_TYPE = OperationSupport.SIMULATOR; // TODO set your card + //public final static short CARD_TYPE = OperationSupport.JCOP21; + //public final static short CARD_TYPE = OperationSupport.SECORA; + //public final static short CARD_TYPE = OperationSupport.JCOP3_P60; + //public final static short CARD_TYPE = OperationSupport.JCOP4_P71; + //public final static short CARD_TYPE = OperationSupport.GD60; + //public final static short CARD_TYPE = OperationSupport.GD70; + + public final static byte CLA_OC_UT = (byte) 0xB0; + public final static byte INS_CLEANUP = (byte) 0x03; + public final static byte INS_FREE_MEMORY = (byte) 0x06; + public final static byte INS_GET_ALLOCATOR_STATS = (byte) 0x07; + public final static byte INS_GET_PROFILE_LOCKS = (byte) 0x08; + + public final static byte INS_INT_STR = (byte) 0x09; + public final static byte INS_INT_ADD = (byte) 0x10; + public final static byte INS_INT_SUB = (byte) 0x11; + public final static byte INS_INT_MUL = (byte) 0x12; + public final static byte INS_INT_DIV = (byte) 0x13; + public final static byte INS_INT_MOD = (byte) 0x15; + + public final static byte INS_BN_STR = (byte) 0x20; + public final static byte INS_BN_ADD = (byte) 0x21; + public final static byte INS_BN_SUB = (byte) 0x22; + public final static byte INS_BN_MUL = (byte) 0x23; + public final static byte INS_BN_SHIFT_RIGHT = (byte) 0x24; + public final static byte INS_BN_MOD = (byte) 0x25; + public final static byte INS_BN_SQ = (byte) 0x26; + public final static byte INS_BN_MUL_SCHOOL = (byte) 0x27; + public final static byte INS_BN_SET_VALUE = (byte) 0x28; + + public final static byte INS_BN_ADD_MOD = (byte) 0x30; + public final static byte INS_BN_SUB_MOD = (byte) 0x31; + public final static byte INS_BN_MUL_MOD = (byte) 0x32; + public final static byte INS_BN_EXP_MOD = (byte) 0x33; + public final static byte INS_BN_INV_MOD = (byte) 0x34; + public final static byte INS_BN_SQ_MOD = (byte) 0x35; + public final static byte INS_BN_SQRT_MOD = (byte) 0x36; + + public final static byte INS_EC_GEN = (byte) 0x40; + public final static byte INS_EC_DBL = (byte) 0x41; + public final static byte INS_EC_ADD = (byte) 0x42; + public final static byte INS_EC_MUL = (byte) 0x43; + public final static byte INS_EC_NEG = (byte) 0x44; + public final static byte INS_EC_COMPARE = (byte) 0x46; + public final static byte INS_EC_FROM_X = (byte) 0x47; + public final static byte INS_EC_IS_Y_EVEN = (byte) 0x48; + public final static byte INS_EC_MUL_ADD = (byte) 0x49; + public final static byte INS_EC_ENCODE = (byte) 0x4a; + + // Specific codes to propagate exceptions caught + // lower byte of exception is value as defined in JCSDK/api_classic/constant-values.htm + public final static short SW_Exception = (short) 0xff01; + public final static short SW_ArrayIndexOutOfBoundsException = (short) 0xff02; + public final static short SW_ArithmeticException = (short) 0xff03; + public final static short SW_ArrayStoreException = (short) 0xff04; + public final static short SW_NullPointerException = (short) 0xff05; + public final static short SW_NegativeArraySizeException = (short) 0xff06; + public final static short SW_CryptoException_prefix = (short) 0xf100; + public final static short SW_SystemException_prefix = (short) 0xf200; + public final static short SW_PINException_prefix = (short) 0xf300; + public final static short SW_TransactionException_prefix = (short) 0xf400; + public final static short SW_CardRuntimeException_prefix = (short) 0xf500; + + boolean initialized = false; + + short[] memoryInfo; + short memoryInfoOffset = 0; + + ResourceManager rm; + ECCurve curve; + ECPoint point1; + ECPoint point2; + + byte[] customG; + ECCurve customCurve; + ECPoint customPoint; + + BigNat bn1; + BigNat bn2; + BigNat bn3; + + Integer int1; + Integer int2; + + public UnitTests() { + OperationSupport.getInstance().setCard(CARD_TYPE); + if (!OperationSupport.getInstance().DEFERRED_INITIALIZATION) { + initialize(); + } + } + + public void initialize() { + if (initialized) { + return; + } + memoryInfo = new short[(short) (7 * 3)]; // Contains RAM and EEPROM memory required for basic library objects + memoryInfoOffset = snapshotAvailableMemory((short) 1, memoryInfo, memoryInfoOffset); + rm = new ResourceManager((short) 256); + memoryInfoOffset = snapshotAvailableMemory((short) 2, memoryInfo, memoryInfoOffset); + + + // Pre-allocate test objects (no new allocation for every tested operation) + curve = new ECCurve(SecP256r1.p, SecP256r1.a, SecP256r1.b, SecP256r1.G, SecP256r1.r, rm); + memoryInfoOffset = snapshotAvailableMemory((short) 3, memoryInfo, memoryInfoOffset); + customG = new byte[(short) SecP256r1.G.length]; + Util.arrayCopyNonAtomic(SecP256r1.G, (short) 0, customG, (short) 0, (short) SecP256r1.G.length); + customCurve = new ECCurve(SecP256r1.p, SecP256r1.a, SecP256r1.b, customG, SecP256r1.r, rm); + + memoryInfoOffset = snapshotAvailableMemory((short) 5, memoryInfo, memoryInfoOffset); + point1 = new ECPoint(curve); + memoryInfoOffset = snapshotAvailableMemory((short) 6, memoryInfo, memoryInfoOffset); + point2 = new ECPoint(curve); + customPoint = new ECPoint(customCurve); + + // Testing BigNat objects used in tests + memoryInfoOffset = snapshotAvailableMemory((short) 7, memoryInfo, memoryInfoOffset); + byte memoryType = JCSystem.MEMORY_TYPE_TRANSIENT_RESET; + bn1 = new BigNat(rm.MAX_BIGNAT_SIZE, memoryType, rm); + memoryInfoOffset = snapshotAvailableMemory((short) 8, memoryInfo, memoryInfoOffset); + bn2 = new BigNat(rm.MAX_BIGNAT_SIZE, memoryType, rm); + bn3 = new BigNat(rm.MAX_BIGNAT_SIZE, memoryType, rm); + + short intLen = 4; + int1 = new Integer(intLen, rm); + int2 = new Integer(intLen, rm); + initialized = true; + } + + public static void install(byte[] ignoredArray, short ignoredOffset, byte ignoredLength) { + new UnitTests().register(); + } + + public boolean select() { + if (initialized) { + updateAfterReset(); + } + return true; + } + + public void process(APDU apdu) { + if (selectingApplet()) { + return; + } + + byte[] apduBuffer = apdu.getBuffer(); + + if (apduBuffer[ISO7816.OFFSET_CLA] != CLA_OC_UT) { + ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); + } + + // Process Input + short dataLen = apdu.setIncomingAndReceive(); // returns length of data field + + try { + if(!initialized) { + initialize(); + } + + switch (apduBuffer[ISO7816.OFFSET_INS]) { + case INS_CLEANUP: + rm.unlockAll(); + break; + case INS_FREE_MEMORY: + if (CARD_TYPE != OperationSupport.SIMULATOR) { + JCSystem.requestObjectDeletion(); + } + break; + case INS_GET_ALLOCATOR_STATS: + short offset = 0; + Util.setShort(apduBuffer, offset, rm.memAlloc.getAllocatedInRAM()); + offset += 2; + Util.setShort(apduBuffer, offset, rm.memAlloc.getAllocatedInEEPROM()); + offset += 2; + for (short i = 0; i < (short) memoryInfo.length; i++) { + Util.setShort(apduBuffer, offset, memoryInfo[i]); + offset += 2; + } + apdu.setOutgoingAndSend((short) 0, offset); + break; + case INS_GET_PROFILE_LOCKS: + Util.arrayCopyNonAtomic(rm.locker.profileLockedObjects, (short) 0, apduBuffer, (short) 0, (short) rm.locker.profileLockedObjects.length); + apdu.setOutgoingAndSend((short) 0, (short) rm.locker.profileLockedObjects.length); + break; + + case INS_EC_GEN: + testEcGen(apdu); + break; + case INS_EC_DBL: + testEcDbl(apdu); + break; + case INS_EC_ADD: + testEcAdd(apdu); + break; + case INS_EC_MUL: + testEcMul(apdu); + break; + case INS_EC_NEG: + testEcNeg(apdu); + break; + case INS_EC_COMPARE: + testEcCompare(apdu); + break; + case INS_EC_FROM_X: + testEcFromX(apdu); + break; + case INS_EC_IS_Y_EVEN: + testEcIsYEven(apdu); + break; + case INS_EC_MUL_ADD: + testEcMulAdd(apdu); + break; + case INS_EC_ENCODE: + testEcEncode(apdu); + break; + + case INS_BN_STR: + testBnStr(apdu, dataLen); + break; + case INS_BN_ADD: + testBnAdd(apdu, dataLen); + break; + case INS_BN_SUB: + testBnSub(apdu, dataLen); + break; + case INS_BN_MUL: + testBnMul(apdu, dataLen); + break; + case INS_BN_SHIFT_RIGHT: + testBnShiftRight(apdu, dataLen); + break; + case INS_BN_MUL_SCHOOL: + testBnMulSchool(apdu, dataLen); + break; + case INS_BN_SQ: + testBnSq(apdu, dataLen); + break; + case INS_BN_MOD: + testBnMod(apdu, dataLen); + break; + case INS_BN_SET_VALUE: + testBnSetValue(apdu, dataLen); + break; + + case INS_BN_ADD_MOD: + testBnAddMod(apdu, dataLen); + break; + case INS_BN_SUB_MOD: + testBnSubMod(apdu, dataLen); + break; + case INS_BN_MUL_MOD: + testBnMulMod(apdu, dataLen); + break; + case INS_BN_EXP_MOD: + testBnExpMod(apdu, dataLen); + break; + case INS_BN_SQ_MOD: + testBnSqMod(apdu, dataLen); + break; + case INS_BN_INV_MOD: + testBnInvMod(apdu, dataLen); + break; + case INS_BN_SQRT_MOD: + testBnModSqrt(apdu, dataLen); + break; + + case INS_INT_STR: + testIntStr(apdu, dataLen); + break; + case INS_INT_ADD: + testIntAdd(apdu, dataLen); + break; + case INS_INT_SUB: + testIntSub(apdu, dataLen); + break; + case INS_INT_MUL: + testIntMul(apdu, dataLen); + break; + case INS_INT_DIV: + testIntDiv(apdu, dataLen); + break; + case INS_INT_MOD: + testIntMod(apdu, dataLen); + break; + + default: + ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); + } + } catch (ISOException e) { + throw e; // Our exception from code, just re-emit + } catch (ArrayIndexOutOfBoundsException e) { + ISOException.throwIt(SW_ArrayIndexOutOfBoundsException); + } catch (ArithmeticException e) { + ISOException.throwIt(SW_ArithmeticException); + } catch (ArrayStoreException e) { + ISOException.throwIt(SW_ArrayStoreException); + } catch (NullPointerException e) { + ISOException.throwIt(SW_NullPointerException); + } catch (NegativeArraySizeException e) { + ISOException.throwIt(SW_NegativeArraySizeException); + } catch (CryptoException e) { + ISOException.throwIt((short) (SW_CryptoException_prefix | e.getReason())); + } catch (SystemException e) { + ISOException.throwIt((short) (SW_SystemException_prefix | e.getReason())); + } catch (PINException e) { + ISOException.throwIt((short) (SW_PINException_prefix | e.getReason())); + } catch (TransactionException e) { + ISOException.throwIt((short) (SW_TransactionException_prefix | e.getReason())); + } catch (CardRuntimeException e) { + ISOException.throwIt((short) (SW_CardRuntimeException_prefix | e.getReason())); + } catch (Exception e) { + ISOException.throwIt(SW_Exception); + } + } + + + final short snapshotAvailableMemory(short tag, short[] buffer, short bufferOffset) { + buffer[bufferOffset] = tag; + buffer[(short) (bufferOffset + 1)] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_TRANSIENT_RESET); + buffer[(short) (bufferOffset + 2)] = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT); + return (short) (bufferOffset + 3); + } + + + void testEcGen(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + + point1.randomize(); + + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void updateAfterReset() { + if (curve != null) { + curve.updateAfterReset(); + } + if (customCurve != null) { + customCurve.updateAfterReset(); + } + if (rm != null) { + rm.refreshAfterReset(); + rm.unlockAll(); + } + } + + void testEcDbl(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + + customPoint.setW(apduBuffer, ISO7816.OFFSET_CDATA, customCurve.POINT_SIZE); + customPoint.makeDouble(); + + short len = customPoint.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testEcAdd(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + + point1.setW(apduBuffer, ISO7816.OFFSET_CDATA, curve.POINT_SIZE); + point2.setW(apduBuffer, (short) (ISO7816.OFFSET_CDATA + curve.POINT_SIZE), curve.POINT_SIZE); + point1.add(point2); + + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testEcMul(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + point1.setW(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), curve.POINT_SIZE); + point1.multiplication(bn1); + + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testEcMulAdd(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + point1.setW(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), curve.POINT_SIZE); + point2.setW(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1 + curve.POINT_SIZE), curve.POINT_SIZE); + point1.multAndAdd(bn1, point2); + + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testEcNeg(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + point1.setW(apduBuffer, ISO7816.OFFSET_CDATA, p1); + point1.negate(); + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + + void testEcCompare(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + short p2 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + point1.setW(apduBuffer, ISO7816.OFFSET_CDATA, p1); + point2.setW(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p2); + apduBuffer[0] = 0; + apduBuffer[1] = 0; + apduBuffer[2] = 0; + apduBuffer[3] = 0; // Tests expects big integer + apduBuffer[4] = point1.isEqual(point2) ? (byte) 1 : (byte) 0; + apdu.setOutgoingAndSend((short) 0, (short) 5); + } + + + void testEcFromX(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + point1.fromX(apduBuffer, ISO7816.OFFSET_CDATA, p1); + short len = point1.getW(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + + void testEcIsYEven(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + point1.setW(apduBuffer, ISO7816.OFFSET_CDATA, p1); + apduBuffer[0] = point1.isYEven() ? (byte) 1 : (byte) 0; + apdu.setOutgoingAndSend((short) 0, (short) 1); + } + + + void testEcEncode(APDU apdu) { + byte[] apduBuffer = apdu.getBuffer(); + short len = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + boolean compressed = apduBuffer[ISO7816.OFFSET_P2] == 0x01; + + point1.decode(apduBuffer, ISO7816.OFFSET_CDATA, len); + apdu.setOutgoingAndSend((short) 0, point1.encode(apduBuffer, (short) 0, compressed)); + } + + + void testBnStr(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, dataLen); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnAdd(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn3.setSize((short) (p1 + 1)); + bn3.copy(bn1); + bn3.add(bn2); + short len = bn3.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnSub(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn3.setSize((short) (p1 + 1)); + bn3.copy(bn1); + bn3.subtract(bn2); + short len = bn3.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnMul(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn3.clone(bn1); + bn3.mult(bn2); + short len = bn3.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnSq(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, dataLen); + bn1.sq(); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnShiftRight(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, dataLen); + bn1.shiftRight(p1); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnMulSchool(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + boolean previous = OperationSupport.getInstance().RSA_SQ; + OperationSupport.getInstance().RSA_SQ = false; + bn3.clone(bn1); + bn3.mult(bn2); + OperationSupport.getInstance().RSA_SQ = previous; + short len = bn3.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn1.mod(bn2); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnSetValue(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short len = 0; + if (dataLen % 2 > 0) { + short b = apduBuffer[ISO7816.OFFSET_CDATA]; + bn1.setSize((short) 1); + bn1.setValue(b); + len += bn1.copyToByteArray(apduBuffer, len); + } + if (dataLen % 4 > 1) { + short s = Util.makeShort(apduBuffer[(short) (ISO7816.OFFSET_CDATA + 1)], apduBuffer[(short) (ISO7816.OFFSET_CDATA + 2)]); + bn2.setSize((short) 2); + bn2.setValue(s); + len += bn2.copyToByteArray(apduBuffer, len); + } + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnAddMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + short p2 = (short) (apduBuffer[ISO7816.OFFSET_P2] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p2); + bn3.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1 + p2), (short) (dataLen - p1 - p2)); + bn1.modAdd(bn2, bn3); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnSubMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + short p2 = (short) (apduBuffer[ISO7816.OFFSET_P2] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p2); + bn3.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1 + p2), (short) (dataLen - p1 - p2)); + bn1.modSub(bn2, bn3); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnMulMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + short p2 = (short) (apduBuffer[ISO7816.OFFSET_P2] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p2); + bn3.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1 + p2), (short) (dataLen - p1 - p2)); + bn1.modMult(bn2, bn3); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnExpMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + short p2 = (short) (apduBuffer[ISO7816.OFFSET_P2] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p2); + bn3.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1 + p2), (short) (dataLen - p1 - p2)); + bn1.modExp(bn2, bn3); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnSqMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn1.modSq(bn2); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnInvMod(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn1.modInv(bn2); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testIntStr(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, dataLen); + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testBnModSqrt(APDU apdu, short dataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + bn1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + bn2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), (short) (dataLen - p1)); + bn1.modSqrt(bn2); + short len = bn1.copyToByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + + void testIntAdd(APDU apdu, short ignoredDataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + int2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p1); + + int1.add(int2); + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testIntSub(APDU apdu, short ignoredDataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + int2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p1); + + int1.subtract(int2); + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testIntMul(APDU apdu, short ignoredDataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + int2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p1); + + int1.multiply(int2); + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testIntDiv(APDU apdu, short ignoredDataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + int2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p1); + + int1.divide(int2); + + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } + + void testIntMod(APDU apdu, short ignoredDataLen) { + byte[] apduBuffer = apdu.getBuffer(); + short p1 = (short) (apduBuffer[ISO7816.OFFSET_P1] & 0x00FF); + + int1.fromByteArray(apduBuffer, ISO7816.OFFSET_CDATA, p1); + int2.fromByteArray(apduBuffer, (short) (ISO7816.OFFSET_CDATA + p1), p1); + + int1.modulo(int2); + short len = int1.toByteArray(apduBuffer, (short) 0); + apdu.setOutgoingAndSend((short) 0, len); + } +} diff --git a/JCMathLib/src/opencrypto/jcmathlib/SecP256k1.java b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP256k1.java similarity index 95% rename from JCMathLib/src/opencrypto/jcmathlib/SecP256k1.java rename to applet/src/main/java/opencrypto/jcmathlib/curves/SecP256k1.java index f21d7724..d9213030 100644 --- a/JCMathLib/src/opencrypto/jcmathlib/SecP256k1.java +++ b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP256k1.java @@ -1,11 +1,6 @@ package opencrypto.jcmathlib; public class SecP256k1 { - - public final static short KEY_LENGTH = 256; // Bits - public final static short POINT_SIZE = 65; // Bytes - public final static short COORD_SIZE = 32; // Bytes - public final static byte[] p = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, diff --git a/applet/src/main/java/opencrypto/jcmathlib/curves/SecP256r1.java b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP256r1.java new file mode 100644 index 00000000..dab86fd2 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP256r1.java @@ -0,0 +1,67 @@ +package opencrypto.jcmathlib; + +public class SecP256r1 { + public final static byte[] p = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff + }; + + public final static byte[] a = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xfc + }; + + public final static byte[] b = { + (byte) 0x5a, (byte) 0xc6, (byte) 0x35, (byte) 0xd8, + (byte) 0xaa, (byte) 0x3a, (byte) 0x93, (byte) 0xe7, + (byte) 0xb3, (byte) 0xeb, (byte) 0xbd, (byte) 0x55, + (byte) 0x76, (byte) 0x98, (byte) 0x86, (byte) 0xbc, + (byte) 0x65, (byte) 0x1d, (byte) 0x06, (byte) 0xb0, + (byte) 0xcc, (byte) 0x53, (byte) 0xb0, (byte) 0xf6, + (byte) 0x3b, (byte) 0xce, (byte) 0x3c, (byte) 0x3e, + (byte) 0x27, (byte) 0xd2, (byte) 0x60, (byte) 0x4b + }; + + public final static byte[] G = { + (byte) 0x04, + (byte) 0x6b, (byte) 0x17, (byte) 0xd1, (byte) 0xf2, + (byte) 0xe1, (byte) 0x2c, (byte) 0x42, (byte) 0x47, + (byte) 0xf8, (byte) 0xbc, (byte) 0xe6, (byte) 0xe5, + (byte) 0x63, (byte) 0xa4, (byte) 0x40, (byte) 0xf2, + (byte) 0x77, (byte) 0x03, (byte) 0x7d, (byte) 0x81, + (byte) 0x2d, (byte) 0xeb, (byte) 0x33, (byte) 0xa0, + (byte) 0xf4, (byte) 0xa1, (byte) 0x39, (byte) 0x45, + (byte) 0xd8, (byte) 0x98, (byte) 0xc2, (byte) 0x96, + (byte) 0x4f, (byte) 0xe3, (byte) 0x42, (byte) 0xe2, + (byte) 0xfe, (byte) 0x1a, (byte) 0x7f, (byte) 0x9b, + (byte) 0x8e, (byte) 0xe7, (byte) 0xeb, (byte) 0x4a, + (byte) 0x7c, (byte) 0x0f, (byte) 0x9e, (byte) 0x16, + (byte) 0x2b, (byte) 0xce, (byte) 0x33, (byte) 0x57, + (byte) 0x6b, (byte) 0x31, (byte) 0x5e, (byte) 0xce, + (byte) 0xcb, (byte) 0xb6, (byte) 0x40, (byte) 0x68, + (byte) 0x37, (byte) 0xbf, (byte) 0x51, (byte) 0xf5 + }; + + public final static byte[] r = { + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xbc, (byte) 0xe6, (byte) 0xfa, (byte) 0xad, + (byte) 0xa7, (byte) 0x17, (byte) 0x9e, (byte) 0x84, + (byte) 0xf3, (byte) 0xb9, (byte) 0xca, (byte) 0xc2, + (byte) 0xfc, (byte) 0x63, (byte) 0x25, (byte) 0x51 + }; +} diff --git a/applet/src/main/java/opencrypto/jcmathlib/curves/SecP512r1.java b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP512r1.java new file mode 100644 index 00000000..09e07ca8 --- /dev/null +++ b/applet/src/main/java/opencrypto/jcmathlib/curves/SecP512r1.java @@ -0,0 +1,115 @@ +package opencrypto.jcmathlib; + +public class SecP512r1 { + public final static byte[] p = { + (byte) 0xaa, (byte) 0xdd, (byte) 0x9d, (byte) 0xb8, + (byte) 0xdb, (byte) 0xe9, (byte) 0xc4, (byte) 0x8b, + (byte) 0x3f, (byte) 0xd4, (byte) 0xe6, (byte) 0xae, + (byte) 0x33, (byte) 0xc9, (byte) 0xfc, (byte) 0x07, + (byte) 0xcb, (byte) 0x30, (byte) 0x8d, (byte) 0xb3, + (byte) 0xb3, (byte) 0xc9, (byte) 0xd2, (byte) 0x0e, + (byte) 0xd6, (byte) 0x63, (byte) 0x9c, (byte) 0xca, + (byte) 0x70, (byte) 0x33, (byte) 0x08, (byte) 0x71, + (byte) 0x7d, (byte) 0x4d, (byte) 0x9b, (byte) 0x00, + (byte) 0x9b, (byte) 0xc6, (byte) 0x68, (byte) 0x42, + (byte) 0xae, (byte) 0xcd, (byte) 0xa1, (byte) 0x2a, + (byte) 0xe6, (byte) 0xa3, (byte) 0x80, (byte) 0xe6, + (byte) 0x28, (byte) 0x81, (byte) 0xff, (byte) 0x2f, + (byte) 0x2d, (byte) 0x82, (byte) 0xc6, (byte) 0x85, + (byte) 0x28, (byte) 0xaa, (byte) 0x60, (byte) 0x56, + (byte) 0x58, (byte) 0x3a, (byte) 0x48, (byte) 0xf3 + }; + + public final static byte[] a = { + (byte) 0x78, (byte) 0x30, (byte) 0xa3, (byte) 0x31, + (byte) 0x8b, (byte) 0x60, (byte) 0x3b, (byte) 0x89, + (byte) 0xe2, (byte) 0x32, (byte) 0x71, (byte) 0x45, + (byte) 0xac, (byte) 0x23, (byte) 0x4c, (byte) 0xc5, + (byte) 0x94, (byte) 0xcb, (byte) 0xdd, (byte) 0x8d, + (byte) 0x3d, (byte) 0xf9, (byte) 0x16, (byte) 0x10, + (byte) 0xa8, (byte) 0x34, (byte) 0x41, (byte) 0xca, + (byte) 0xea, (byte) 0x98, (byte) 0x63, (byte) 0xbc, + (byte) 0x2d, (byte) 0xed, (byte) 0x5d, (byte) 0x5a, + (byte) 0xa8, (byte) 0x25, (byte) 0x3a, (byte) 0xa1, + (byte) 0x0a, (byte) 0x2e, (byte) 0xf1, (byte) 0xc9, + (byte) 0x8b, (byte) 0x9a, (byte) 0xc8, (byte) 0xb5, + (byte) 0x7f, (byte) 0x11, (byte) 0x17, (byte) 0xa7, + (byte) 0x2b, (byte) 0xf2, (byte) 0xc7, (byte) 0xb9, + (byte) 0xe7, (byte) 0xc1, (byte) 0xac, (byte) 0x4d, + (byte) 0x77, (byte) 0xfc, (byte) 0x94, (byte) 0xca + }; + + public final static byte[] b = { + (byte) 0x3d, (byte) 0xf9, (byte) 0x16, (byte) 0x10, + (byte) 0xa8, (byte) 0x34, (byte) 0x41, (byte) 0xca, + (byte) 0xea, (byte) 0x98, (byte) 0x63, (byte) 0xbc, + (byte) 0x2d, (byte) 0xed, (byte) 0x5d, (byte) 0x5a, + (byte) 0xa8, (byte) 0x25, (byte) 0x3a, (byte) 0xa1, + (byte) 0x0a, (byte) 0x2e, (byte) 0xf1, (byte) 0xc9, + (byte) 0x8b, (byte) 0x9a, (byte) 0xc8, (byte) 0xb5, + (byte) 0x7f, (byte) 0x11, (byte) 0x17, (byte) 0xa7, + (byte) 0x2b, (byte) 0xf2, (byte) 0xc7, (byte) 0xb9, + (byte) 0xe7, (byte) 0xc1, (byte) 0xac, (byte) 0x4d, + (byte) 0x77, (byte) 0xfc, (byte) 0x94, (byte) 0xca, + (byte) 0xdc, (byte) 0x08, (byte) 0x3e, (byte) 0x67, + (byte) 0x98, (byte) 0x40, (byte) 0x50, (byte) 0xb7, + (byte) 0x5e, (byte) 0xba, (byte) 0xe5, (byte) 0xdd, + (byte) 0x28, (byte) 0x09, (byte) 0xbd, (byte) 0x63, + (byte) 0x80, (byte) 0x16, (byte) 0xf7, (byte) 0x23 + }; + + public final static byte[] G = { + (byte) 0x04, + (byte) 0x81, (byte) 0xae, (byte) 0xe4, (byte) 0xbd, + (byte) 0xd8, (byte) 0x2e, (byte) 0xd9, (byte) 0x64, + (byte) 0x5a, (byte) 0x21, (byte) 0x32, (byte) 0x2e, + (byte) 0x9c, (byte) 0x4c, (byte) 0x6a, (byte) 0x93, + (byte) 0x85, (byte) 0xed, (byte) 0x9f, (byte) 0x70, + (byte) 0xb5, (byte) 0xd9, (byte) 0x16, (byte) 0xc1, + (byte) 0xb4, (byte) 0x3b, (byte) 0x62, (byte) 0xee, + (byte) 0xf4, (byte) 0xd0, (byte) 0x09, (byte) 0x8e, + (byte) 0xff, (byte) 0x3b, (byte) 0x1f, (byte) 0x78, + (byte) 0xe2, (byte) 0xd0, (byte) 0xd4, (byte) 0x8d, + (byte) 0x50, (byte) 0xd1, (byte) 0x68, (byte) 0x7b, + (byte) 0x93, (byte) 0xb9, (byte) 0x7d, (byte) 0x5f, + (byte) 0x7c, (byte) 0x6d, (byte) 0x50, (byte) 0x47, + (byte) 0x40, (byte) 0x6a, (byte) 0x5e, (byte) 0x68, + (byte) 0x8b, (byte) 0x35, (byte) 0x22, (byte) 0x09, + (byte) 0xbc, (byte) 0xb9, (byte) 0xf8, (byte) 0x22, + (byte) 0x7d, (byte) 0xde, (byte) 0x38, (byte) 0x5d, + (byte) 0x56, (byte) 0x63, (byte) 0x32, (byte) 0xec, + (byte) 0xc0, (byte) 0xea, (byte) 0xbf, (byte) 0xa9, + (byte) 0xcf, (byte) 0x78, (byte) 0x22, (byte) 0xfd, + (byte) 0xf2, (byte) 0x09, (byte) 0xf7, (byte) 0x00, + (byte) 0x24, (byte) 0xa5, (byte) 0x7b, (byte) 0x1a, + (byte) 0xa0, (byte) 0x00, (byte) 0xc5, (byte) 0x5b, + (byte) 0x88, (byte) 0x1f, (byte) 0x81, (byte) 0x11, + (byte) 0xb2, (byte) 0xdc, (byte) 0xde, (byte) 0x49, + (byte) 0x4a, (byte) 0x5f, (byte) 0x48, (byte) 0x5e, + (byte) 0x5b, (byte) 0xca, (byte) 0x4b, (byte) 0xd8, + (byte) 0x8a, (byte) 0x27, (byte) 0x63, (byte) 0xae, + (byte) 0xd1, (byte) 0xca, (byte) 0x2b, (byte) 0x2f, + (byte) 0xa8, (byte) 0xf0, (byte) 0x54, (byte) 0x06, + (byte) 0x78, (byte) 0xcd, (byte) 0x1e, (byte) 0x0f, + (byte) 0x3a, (byte) 0xd8, (byte) 0x08, (byte) 0x92 + }; + + public final static byte[] r = { + (byte) 0xaa, (byte) 0xdd, (byte) 0x9d, (byte) 0xb8, + (byte) 0xdb, (byte) 0xe9, (byte) 0xc4, (byte) 0x8b, + (byte) 0x3f, (byte) 0xd4, (byte) 0xe6, (byte) 0xae, + (byte) 0x33, (byte) 0xc9, (byte) 0xfc, (byte) 0x07, + (byte) 0xcb, (byte) 0x30, (byte) 0x8d, (byte) 0xb3, + (byte) 0xb3, (byte) 0xc9, (byte) 0xd2, (byte) 0x0e, + (byte) 0xd6, (byte) 0x63, (byte) 0x9c, (byte) 0xca, + (byte) 0x70, (byte) 0x33, (byte) 0x08, (byte) 0x70, + (byte) 0x55, (byte) 0x3e, (byte) 0x5c, (byte) 0x41, + (byte) 0x4c, (byte) 0xa9, (byte) 0x26, (byte) 0x19, + (byte) 0x41, (byte) 0x86, (byte) 0x61, (byte) 0x19, + (byte) 0x7f, (byte) 0xac, (byte) 0x10, (byte) 0x47, + (byte) 0x1d, (byte) 0xb1, (byte) 0xd3, (byte) 0x81, + (byte) 0x08, (byte) 0x5d, (byte) 0xda, (byte) 0xdd, + (byte) 0xb5, (byte) 0x87, (byte) 0x96, (byte) 0x82, + (byte) 0x9c, (byte) 0xa9, (byte) 0x00, (byte) 0x69 + }; +} diff --git a/applet/src/test/java/tests/BaseTest.java b/applet/src/test/java/tests/BaseTest.java new file mode 100644 index 00000000..5a0ef525 --- /dev/null +++ b/applet/src/test/java/tests/BaseTest.java @@ -0,0 +1,181 @@ +package tests; + +import cz.muni.fi.crocs.rcard.client.CardManager; +import cz.muni.fi.crocs.rcard.client.CardType; +import cz.muni.fi.crocs.rcard.client.RunConfig; +import cz.muni.fi.crocs.rcard.client.Util; +import opencrypto.jcmathlib.UnitTests; +import org.bouncycastle.util.encoders.Hex; + +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; +import java.util.ArrayList; + +/** + * Base Test class. + * Note: If simulator cannot be started try adding "-noverify" JVM parameter + * + * @author Petr Svenda, Dusan Klinec (ph4r05) + */ +public class BaseTest { + private static String APPLET_AID = Hex.toHexString("JCMathLibUT".getBytes()); + private static byte APPLET_AID_BYTE[] = Util.hexStringToByteArray(APPLET_AID); + + protected CardType cardType = CardType.JCARDSIMLOCAL; + + protected boolean simulateStateful = false; + protected CardManager statefulCard = null; + + public BaseTest() { + + } + + /** + * Creates card manager and connects to the card. + * + * @return + * @throws Exception + */ + public CardManager connect() throws Exception { + return connect(null); + } + + public CardManager connect(byte[] installData) throws Exception { + if (simulateStateful && statefulCard != null){ + return statefulCard; + } else if (simulateStateful){ + statefulCard = connectRaw(installData); + return statefulCard; + } + + return connectRaw(installData); + } + + public CardManager connectRaw(byte[] installData) throws Exception { + final CardManager cardMngr = new CardManager(true, APPLET_AID_BYTE); + final RunConfig runCfg = RunConfig.getDefaultConfig(); + System.setProperty("com.licel.jcardsim.object_deletion_supported", "1"); + System.setProperty("com.licel.jcardsim.sign.dsasigner.computedhash", "1"); + + // Otherwise requires modulus to be composite + System.setProperty("com.licel.jcardsim.bouncycastle.rsa.allow_unsafe_mod", "true"); + + // Set to statically seed RandomData in the applet by "02", hexcoded + // System.setProperty("com.licel.jcardsim.randomdata.seed", "02"); + + // Set to seed RandomData from the SecureRandom + // System.setProperty("com.licel.jcardsim.randomdata.secure", "1"); + + runCfg.setTestCardType(cardType); + runCfg.setTargetReaderIndex(0); + if (cardType == CardType.REMOTE){ + runCfg.setRemoteAddress("http://127.0.0.1:9901"); + + runCfg.setRemoteCardType(CardType.PHYSICAL); + // runCfg.setRemoteCardType(CardType.JCARDSIMLOCAL); + + runCfg.setAid(APPLET_AID_BYTE); // performs select after connect + + } else if (cardType != CardType.PHYSICAL && cardType != CardType.PHYSICAL_JAVAX) { + // Running in the simulator + runCfg.setAppletToSimulate(UnitTests.class) + .setTestCardType(CardType.JCARDSIMLOCAL) + .setbReuploadApplet(true) + .setInstallData(installData); + } + + if (!cardMngr.connect(runCfg)) { + throw new RuntimeException("Connection failed"); + } + + return cardMngr; + } + + /** + * Convenience method for connecting and sending + * @param cmd + * @return + */ + public ResponseAPDU connectAndSend(CommandAPDU cmd) throws Exception { + return connect().transmit(cmd); + } + + /** + * Convenience method for building APDU command + * @param data + * @return + */ + public static CommandAPDU buildApdu(String data){ + return new CommandAPDU(Util.hexStringToByteArray(data)); + } + + /** + * Convenience method for building APDU command + * @param data + * @return + */ + public static CommandAPDU buildApdu(byte[] data){ + return new CommandAPDU(data); + } + + /** + * Convenience method for building APDU command + * @param data + * @return + */ + public static CommandAPDU buildApdu(CommandAPDU data){ + return data; + } + + /** + * Sending command to the card. + * Enables to send init commands before the main one. + * + * @param cardMngr + * @param command + * @param initCommands + * @return + * @throws CardException + */ + public ResponseAPDU sendCommandWithInitSequence(CardManager cardMngr, String command, ArrayList initCommands) throws CardException { + if (initCommands != null) { + for (String cmd : initCommands) { + cardMngr.getChannel().transmit(buildApdu(cmd)); + } + } + + final ResponseAPDU resp = cardMngr.getChannel().transmit(buildApdu(command)); + return resp; + } + + public CardType getCardType() { + return cardType; + } + + public BaseTest setCardType(CardType cardType) { + this.cardType = cardType; + return this; + } + + public boolean isSimulateStateful() { + return simulateStateful; + } + + public BaseTest setSimulateStateful(boolean simulateStateful) { + this.simulateStateful = simulateStateful; + return this; + } + + public boolean isPhysical() { + return cardType == CardType.PHYSICAL || cardType == CardType.PHYSICAL_JAVAX; + } + + public boolean isStateful(){ + return isPhysical() || simulateStateful; + } + + public boolean canReinstall(){ + return !isPhysical() && !simulateStateful; + } +} diff --git a/applet/src/test/java/tests/JCMathLibTest.java b/applet/src/test/java/tests/JCMathLibTest.java new file mode 100644 index 00000000..4fd992d6 --- /dev/null +++ b/applet/src/test/java/tests/JCMathLibTest.java @@ -0,0 +1,728 @@ +package tests; + +import cz.muni.fi.crocs.rcard.client.CardManager; +import cz.muni.fi.crocs.rcard.client.CardType; +import cz.muni.fi.crocs.rcard.client.Util; +import javacard.framework.ISO7816; + +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import opencrypto.jcmathlib.OperationSupport; +import opencrypto.jcmathlib.UnitTests; +import opencrypto.jcmathlib.SecP256r1; +import org.bouncycastle.jce.ECNamedCurveTable; +import org.bouncycastle.jce.interfaces.ECPublicKey; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.jce.spec.ECParameterSpec; +import org.bouncycastle.math.ec.ECPoint; +import org.junit.jupiter.api.*; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.Security; +import java.util.*; +import java.util.concurrent.ThreadLocalRandom; + +/** + * JCMathLib Unit Tests + * + * @author Petr Svenda and Antonin Dufka + */ +public class JCMathLibTest extends BaseTest { + public static byte[] APDU_CLEANUP = {UnitTests.CLA_OC_UT, UnitTests.INS_CLEANUP, (byte) 0x00, (byte) 0x00, (byte) 0x00}; + public static int BIGNAT_BIT_LENGTH = 256; + public static Map perfMap = new HashMap<>(); + public static String atr; + + public JCMathLibTest() throws Exception { + this.setCardType(UnitTests.CARD_TYPE == OperationSupport.SIMULATOR ? CardType.JCARDSIMLOCAL : CardType.PHYSICAL); + this.setSimulateStateful(true); + statefulCard = connect(); + } + + @Test + public void allocationInfo() throws Exception { + // Obtain allocated bytes in RAM and EEPROM + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_GET_ALLOCATOR_STATS, 0, 0, new byte[1]); + ResponseAPDU response = statefulCard.transmit(cmd); + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, response.getSW()); + byte[] data = response.getData(); + System.out.printf("Data allocator: RAM = %d, EEPROM = %d%n", Util.getShort(data, (short) 0), Util.getShort(data, (short) 2)); + // Print memory snapshots from allocation + for (int offset = 4; offset < data.length; offset += 6) { + System.out.printf("Tag '%d': RAM = %d, EEPROM = %d%n", Util.getShort(data, offset), Util.getShort(data, (short) (offset + 2)), Util.getShort(data, (short) (offset + 4))); + } + } + + @Nested + class ECCTest { + @Test + public void eccGen() throws Exception { + perfMap.put("eccGen/INS_EC_GEN", new Long(-1)); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_GEN, 0, 0, new byte[1]); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccGen/INS_EC_GEN", statefulCard.getLastTransmitTime()); + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccAdd() throws Exception { + perfMap.put("eccAdd/INS_EC_ADD", new Long(-1)); + ECPoint point1 = randECPoint(); + ECPoint point2 = randECPoint(); + ECPoint sum = point1.add(point2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_ADD, 0, 0, Util.concat(point1.getEncoded(false), point2.getEncoded(false))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccAdd/INS_EC_ADD", statefulCard.getLastTransmitTime()); + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(sum.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccNegation() throws Exception { + perfMap.put("eccNegation/INS_EC_NEG", new Long(-1)); + CardManager cardMngr = connect(); + ECPoint point = randECPoint(); + ECPoint negated = point.negate(); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_NEG, point.getEncoded(false).length, 0, point.getEncoded(false)); + ResponseAPDU resp = cardMngr.transmit(cmd); + perfMap.put("eccNegation/INS_EC_NEG", statefulCard.getLastTransmitTime()); + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(negated.getEncoded(false), resp.getData()); + cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccMultiplyGenerator() throws Exception { + perfMap.put("eccMultiplyGenerator/INS_EC_MUL", new Long(-1)); + ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1"); + ECPoint point = ecSpec.getG(); + BigInteger scalar = randomBigNat(256); + ECPoint result = point.multiply(scalar); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_MUL, scalar.toByteArray().length, 0, Util.concat(scalar.toByteArray(), point.getEncoded(false))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccMultiplyGenerator/INS_EC_MUL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(result.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccMultiplyRandom() throws Exception { + perfMap.put("eccMultiplyRandom/INS_EC_MUL", new Long(-1)); + ECPoint point = randECPoint(); + BigInteger scalar = randomBigNat(256); + ECPoint result = point.multiply(scalar); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_MUL, scalar.toByteArray().length, 0, Util.concat(scalar.toByteArray(), point.getEncoded(false))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccMultiplyRandom/INS_EC_MUL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(result.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccIsEqual() throws Exception { + perfMap.put("eccIsEqual/INS_EC_COMPARE", new Long(-1)); + ECPoint point1 = randECPoint(); + ECPoint point2 = randECPoint(); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_COMPARE, point1.getEncoded(false).length, point2.getEncoded(false).length, Util.concat(point1.getEncoded(false), point2.getEncoded(false))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccIsEqual/INS_EC_COMPARE", statefulCard.getLastTransmitTime()); + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccDoubleGenerator() throws Exception { + perfMap.put("eccDoubleGenerator/INS_EC_DBL", new Long(-1)); + ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1"); + ECPoint point = ecSpec.getG(); + ECPoint doubled = point.add(point); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_DBL, 0, 0, point.getEncoded(false)); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccDoubleGenerator/INS_EC_DBL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(doubled.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccDoubleRandom() throws Exception { + perfMap.put("eccDoubleRandom/INS_EC_DBL", new Long(-1)); + ECPoint point = randECPoint(); + ECPoint doubled = point.add(point); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_DBL, 0, 0, point.getEncoded(false)); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccDoubleRandom/INS_EC_DBL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(doubled.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccFromX() throws Exception { + perfMap.put("eccFromX/INS_EC_FROM_X", new Long(-1)); + CardManager cardMngr = connect(); + ECPoint point = randECPoint(); + ECPoint negated = point.negate(); + byte[] xCoord = point.getXCoord().getEncoded(); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_FROM_X, xCoord.length, 0, xCoord); + ResponseAPDU resp = cardMngr.transmit(cmd); + perfMap.put("eccFromX/INS_EC_FROM_X", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertTrue(Arrays.equals(point.getEncoded(false), resp.getData()) || Arrays.equals(negated.getEncoded(false), resp.getData())); + cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccIsYEven() throws Exception { + perfMap.put("eccIsYEven/INS_EC_IS_Y_EVEN", new Long(-1)); + CardManager cardMngr = connect(); + ECPoint point = randECPoint(); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_IS_Y_EVEN, point.getEncoded(false).length, 0, point.getEncoded(false)); + ResponseAPDU resp = cardMngr.transmit(cmd); + perfMap.put("eccIsYEven/INS_EC_IS_Y_EVEN", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(point.getYCoord().toBigInteger().mod(BigInteger.valueOf(2)).intValue() == 0 ? 1 : 0, resp.getData()[0]); + cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void eccMultRandomAndAdd() throws Exception { + perfMap.put("eccMultRandomAndAdd/INS_EC_MUL_ADD", new Long(-1)); + ECPoint point1 = randECPoint(); + ECPoint point2 = randECPoint(); + BigInteger scalar = randomBigNat(256); + ECPoint result = point1.multiply(scalar).add(point2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_MUL_ADD, scalar.toByteArray().length, 0, Util.concat(Util.concat(scalar.toByteArray(), point1.getEncoded(false)), point2.getEncoded(false))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("eccMultRandomAndAdd/INS_EC_MUL_ADD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(result.getEncoded(false), resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + + @Test + public void eccEncode() throws Exception { + perfMap.put("eccEncode(uncompressed_in_out)/INS_EC_ENCODE", new Long(-1)); + perfMap.put("eccEncode(compressed_out)/INS_EC_ENCODE", new Long(-1)); + perfMap.put("eccEncode(compressed_in)/INS_EC_ENCODE", new Long(-1)); + perfMap.put("eccEncode(compressed_in_out)/INS_EC_ENCODE", new Long(-1)); + CardManager cardMngr = connect(); + ECPoint point = randECPoint(); + + for (int i = 0; i < 2; ++i) { + // Test both uncompressed + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_ENCODE, point.getEncoded(false).length, 0, point.getEncoded(false)); + ResponseAPDU resp = cardMngr.transmit(cmd); + perfMap.put("eccEncode(uncompressed_in_out)/INS_EC_ENCODE", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(point.getEncoded(false), resp.getData()); + + // Test compressed output + cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_ENCODE, point.getEncoded(false).length, 1, point.getEncoded(false)); + resp = cardMngr.transmit(cmd); + perfMap.put("eccEncode(compressed_out)/INS_EC_ENCODE", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(point.getEncoded(true), resp.getData()); + + // Test compressed input + cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_ENCODE, point.getEncoded(true).length, 0, point.getEncoded(true)); + resp = cardMngr.transmit(cmd); + perfMap.put("eccEncode(compressed_in)/INS_EC_ENCODE", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(point.getEncoded(false), resp.getData()); + + // Test both compressed + cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_EC_ENCODE, point.getEncoded(true).length, 1, point.getEncoded(true)); + resp = cardMngr.transmit(cmd); + perfMap.put("eccEncode(compressed_in_out)/INS_EC_ENCODE", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(point.getEncoded(true), resp.getData()); + + // Test with negated point + point = point.negate(); + } + + cardMngr.transmit(new CommandAPDU(APDU_CLEANUP)); + } + } + + @Nested + class BigNatTest { + @Test + public void bigNatStorage() throws Exception { + perfMap.put("bigNatStorage/INS_BN_STR", new Long(-1)); + BigInteger num = randomBigNat(BIGNAT_BIT_LENGTH); + byte[] data = Util.concat(new byte[]{}, num.toByteArray()); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_STR, 0, 0, data); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatStorage/INS_BN_STR", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertArrayEquals(data, resp.getData()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatAddition() throws Exception { + perfMap.put("bigNatAddition/INS_BN_ADD", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH - 1); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH - 1); + BigInteger result = num1.add(num2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_ADD, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatAddition/INS_BN_ADD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatSubtraction() throws Exception { + perfMap.put("bigNatSubtraction/INS_BN_SUB", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH - 1); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH - 1); + BigInteger result = num1.subtract(num2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SUB, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatSubtraction/INS_BN_SUB", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatMultiplication() throws Exception { + perfMap.put("bigNatMultiplication/INS_BN_MUL", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger result = num1.multiply(num2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_MUL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatMultiplication/INS_BN_MUL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatSq() throws Exception { + perfMap.put("bigNatSq/INS_BN_SQ", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger result = num1.multiply(num1); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SQ, 0, 0, num1.toByteArray()); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatSq/INS_BN_SQ", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatShiftRight() throws Exception { + perfMap.put("bigNatShiftRight(8b)/INS_BN_SHIFT_RIGHT", new Long(-1)); + for (int bits = 0; bits < 8; ++bits) { + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger result = num1.shiftRight(bits); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SHIFT_RIGHT, bits, 0, num1.toByteArray()); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatShiftRight(8b)/INS_BN_SHIFT_RIGHT", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + } + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatMultiplicationSlow() throws Exception { + perfMap.put("bigNatMultiplicationSlow/INS_BN_MUL_SCHOOL", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger result = num1.multiply(num2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_MUL_SCHOOL, num1.toByteArray().length, 0, Util.concat(num1.toByteArray(), num2.toByteArray())); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatMultiplicationSlow/INS_BN_MUL_SCHOOL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatMod() throws Exception { + perfMap.put("bigNatMod/INS_BN_MOD", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH - 1); + BigInteger result = num1.mod(num2); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_MOD, (num1.toByteArray()).length, 0, Util.concat((num1.toByteArray()), (num2.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatMod/INS_BN_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatSetValue() throws Exception { + perfMap.put("bigNatSetValue/INS_BN_SET_VALUE", new Long(-1)); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SET_VALUE, 0, 0, new byte[]{0x12, 0x34, 0x56}); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatSetValue/INS_BN_SET_VALUE", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(0x12, resp.getData()[0]); + Assertions.assertEquals(0x3456, Util.getShort(resp.getData(), 1)); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModSqrt() throws Exception { + perfMap.put("bigNatModSqrt/INS_BN_SQRT_MOD", new Long(-1)); + BigInteger num = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger mod = new BigInteger(1, SecP256r1.p); + // Sample num until we get a quadratic residue + while (!num.modPow(mod.subtract(BigInteger.valueOf(1)).divide(BigInteger.valueOf(2)), mod).equals(BigInteger.valueOf(1))) { + num = randomBigNat(BIGNAT_BIT_LENGTH); + } + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SQRT_MOD, Util.trimLeadingZeroes(num.toByteArray()).length, 0, Util.concat(Util.trimLeadingZeroes(num.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModSqrt/INS_BN_SQRT_MOD", statefulCard.getLastTransmitTime()); + + BigInteger receivedResult = new BigInteger(1, resp.getData()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(receivedResult.modPow(BigInteger.valueOf(2), mod), num); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModAdd() throws Exception { + perfMap.put("bigNatModAdd/INS_BN_ADD_MOD", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num3 = new BigInteger(1, SecP256r1.r); + + BigInteger result = (num1.add(num2)).mod(num3); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_ADD_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(num2.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()), Util.trimLeadingZeroes(num3.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModAdd/INS_BN_ADD_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModSub() throws Exception { + perfMap.put("bigNatModSub/INS_BN_SUB_MOD", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num3 = new BigInteger(1, SecP256r1.r); + BigInteger result = (num1.subtract(num2)).mod(num3); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SUB_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(num2.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()), Util.trimLeadingZeroes(num3.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModSub/INS_BN_SUB_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModMult() throws Exception { + perfMap.put("bigNatModMult/INS_BN_MUL_MOD", new Long(-1)); + BigInteger num1 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num2 = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger num3 = new BigInteger(1, SecP256r1.r); + BigInteger result = (num1.multiply(num2)).mod(num3); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_MUL_MOD, Util.trimLeadingZeroes(num1.toByteArray()).length, Util.trimLeadingZeroes(num2.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(num1.toByteArray()), Util.trimLeadingZeroes(num2.toByteArray()), Util.trimLeadingZeroes(num3.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModMult/INS_BN_MUL_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModExp() throws Exception { + perfMap.put("bigNatModExp/INS_BN_EXP_MOD", new Long(-1)); + // Test multiple configurations (to check for OperationSupport.RSA_KEY_REFRESH) + for (int i = 0; i < 3; ++i) { + BigInteger base = randomBigNat(256); + BigInteger exp = randomBigNat(256); + BigInteger mod = new BigInteger(1, SecP256r1.r); + BigInteger result = (base.modPow(exp, mod)); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_EXP_MOD, Util.trimLeadingZeroes(base.toByteArray()).length, Util.trimLeadingZeroes(exp.toByteArray()).length, Util.concat(Util.trimLeadingZeroes(base.toByteArray()), Util.trimLeadingZeroes(exp.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModExp/INS_BN_EXP_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + } + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModSq() throws Exception { + perfMap.put("bigNatModSq/INS_BN_SQ_MOD", new Long(-1)); + BigInteger base = randomBigNat(256); + BigInteger exp = BigInteger.valueOf(2); + BigInteger mod = new BigInteger(1, SecP256r1.r); + BigInteger result = (base.modPow(exp, mod)); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_SQ_MOD, Util.trimLeadingZeroes(base.toByteArray()).length, (short) 0, Util.concat(Util.trimLeadingZeroes(base.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModSq/INS_BN_SQ_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void bigNatModInv() throws Exception { + perfMap.put("bigNatModInv/INS_BN_INV_MOD", new Long(-1)); + BigInteger base = randomBigNat(BIGNAT_BIT_LENGTH); + BigInteger mod = new BigInteger(1, SecP256r1.r); + BigInteger result = base.modInverse(mod); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_BN_INV_MOD, Util.trimLeadingZeroes(base.toByteArray()).length, 0, Util.concat(Util.trimLeadingZeroes(base.toByteArray()), Util.trimLeadingZeroes(mod.toByteArray()))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("bigNatModInv/INS_BN_INV_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, new BigInteger(1, resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + } + + @Nested + class IntegerTest { + @Test + public void integerStorage() throws Exception { + perfMap.put("integerStorage/INS_INT_STR", new Long(-1)); + int num = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_STR, 0, 0, intToBytes(num)); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerStorage/INS_INT_STR", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void integerAddition() throws Exception { + perfMap.put("integerAddition/INS_INT_ADD", new Long(-1)); + int num1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int num2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int result = num1 + num2; + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_ADD, intToBytes(num1).length, 0, Util.concat(intToBytes(num1), intToBytes(num2))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerAddition/INS_INT_ADD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, bytesToInt(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void integerSubtraction() throws Exception { + perfMap.put("integerSubtraction/INS_INT_SUB", new Long(-1)); + int num1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int num2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int result = num1 - num2; + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_SUB, intToBytes(num1).length, 0, Util.concat(intToBytes(num1), intToBytes(num2))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerSubtraction/INS_INT_SUB", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, bytesToInt(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void integerMultiplication() throws Exception { + perfMap.put("integerMultiplication/INS_INT_MUL", new Long(-1)); + int num1 = ThreadLocalRandom.current().nextInt(0, (int) (Math.sqrt(Integer.MAX_VALUE))); + int num2 = ThreadLocalRandom.current().nextInt(0, (int) (Math.sqrt(Integer.MAX_VALUE))); + int result = num1 * num2; + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_MUL, intToBytes(num1).length, 0, Util.concat(intToBytes(num1), intToBytes(num2))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerMultiplication/INS_INT_MUL", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, bytesToInt(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void integerDivision() throws Exception { + perfMap.put("integerDivision/INS_INT_DIV", new Long(-1)); + int num1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int num2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int result = num1 / num2; + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_DIV, intToBytes(num1).length, 0, Util.concat(intToBytes(num1), intToBytes(num2))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerDivision/INS_INT_DIV", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, bytesToInt(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + + @Test + public void integerModulo() throws Exception { + perfMap.put("integerModulo/INS_INT_MOD", new Long(-1)); + int num1 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int num2 = ThreadLocalRandom.current().nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); + int result = num1 % num2; + CommandAPDU cmd = new CommandAPDU(UnitTests.CLA_OC_UT, UnitTests.INS_INT_MOD, intToBytes(num1).length, 0, Util.concat(intToBytes(num1), intToBytes(num2))); + ResponseAPDU resp = statefulCard.transmit(cmd); + perfMap.put("integerModulo/INS_INT_MOD", statefulCard.getLastTransmitTime()); + + Assertions.assertEquals(ISO7816.SW_NO_ERROR & 0xffff, resp.getSW()); + Assertions.assertEquals(result, bytesToInt(resp.getData())); + statefulCard.transmit(new CommandAPDU(APDU_CLEANUP)); + } + } + + public static BigInteger randomBigNat(int maxNumBitLength) { + Random rnd = new Random(); + BigInteger aRandomBigInt; + while (true) { + do { + aRandomBigInt = new BigInteger(maxNumBitLength, rnd); + + } while (aRandomBigInt.compareTo(new BigInteger("1")) < 1); + + if ((Util.trimLeadingZeroes(aRandomBigInt.toByteArray()).length != maxNumBitLength / 8) || (aRandomBigInt.toByteArray()).length != maxNumBitLength / 8) { + // After serialization, number is longer or shorter - generate new one + } else { + // We have proper number + return aRandomBigInt; + } + } + } + + public static byte[] intToBytes(int val) { + byte[] data = new byte[5]; + if (val < 0) { + data[0] = 0x01; + } else { + data[0] = 0x00; + } + + int unsigned = Math.abs(val); + data[1] = (byte) (unsigned >>> 24); + data[2] = (byte) (unsigned >>> 16); + data[3] = (byte) (unsigned >>> 8); + data[4] = (byte) unsigned; + + return data; + } + + public static int bytesToInt(byte[] data) { + int val = (data[1] << 24) + | ((data[2] & 0xFF) << 16) + | ((data[3] & 0xFF) << 8) + | (data[4] & 0xFF); + + if (data[0] == 0x01) { + val = val * -1; + } + + return val; + } + + /** + * Utility function which will generate random valid ECPoint + * + * @return ECPoint + */ + public static ECPoint randECPoint() throws Exception { + Security.addProvider(new BouncyCastleProvider()); + + ECParameterSpec ecSpec_named = ECNamedCurveTable.getParameterSpec("secp256r1"); + KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECDSA", "BC"); + kpg.initialize(ecSpec_named); + KeyPair apair = kpg.generateKeyPair(); + ECPublicKey apub = (ECPublicKey) apair.getPublic(); + return apub.getQ(); + } + + @BeforeAll + public static void setUpClass() { + } + + @AfterAll + public static void tearDownClass() { + // Iterating over the HashMap + TreeMap sortedMap = new TreeMap<>(perfMap); + StringBuilder contentBuilder = new StringBuilder(); + //contentBuilder.append(String.format("\n\nPERFORMANCE SUMMARY (ATR=%s)\n", atr)); + //System.out.printf("| Operation (time in ms) | %s |\n", atr); + contentBuilder.append(String.format("| Operation (time in ms) | %s |\n", atr)); + + //System.out.println("| --- | --- |"); + contentBuilder.append("| --- | --- |\n"); + //System.out.println("-----------------------------------------------------------------"); + for (Map.Entry entry : sortedMap.entrySet()) { + String key = entry.getKey(); + Long value = entry.getValue(); + //System.out.printf("| %-50s | %s |%n", key, value); + contentBuilder.append(String.format("| %-50s | %s |\n", key, value)); + } + System.out.printf("\n\nPERFORMANCE SUMMARY (ATR=%s)\n", atr); + System.out.println(contentBuilder.toString()); + System.out.println("-----------------------------------------------------------------"); + + // Save the formatted content to a file + String filePath = atr + ".csv"; + try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) { + writer.write(contentBuilder.toString().replace("|", ",|,")); + } catch (IOException e) { + System.out.println("An error occurred while saving the file: " + e.getMessage()); + } + } + + @BeforeEach + public void setUpMethod() { + } + + @AfterEach + public void tearDownMethod() throws Exception { + if (statefulCard != null) { + statefulCard.disconnect(true); + } + this.setCardType(UnitTests.CARD_TYPE == OperationSupport.SIMULATOR ? CardType.JCARDSIMLOCAL : CardType.PHYSICAL); + this.setSimulateStateful(true); + statefulCard = connect(); + atr = Util.toHex(statefulCard.atr().getBytes()); + } +} diff --git a/applet/src/test/resources/log4j.properties b/applet/src/test/resources/log4j.properties new file mode 100644 index 00000000..6e6db405 --- /dev/null +++ b/applet/src/test/resources/log4j.properties @@ -0,0 +1,8 @@ +# Root Logger Option +log4j.rootLogger=DEBUG, console + +# Redirect Log Messages To Console +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.Target=System.out +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-5p | %d{yyyy-MM-dd HH:mm:ss} | [%t] %C{2}:%L | %m%n diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..a5133682 --- /dev/null +++ b/build.gradle @@ -0,0 +1,3 @@ +group 'com.klinec' +version '1.0-SNAPSHOT' + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..02716d78 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..2dc10d91 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Dec 10 20:07:32 CET 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libs-sdks b/libs-sdks new file mode 160000 index 00000000..e305a1a0 --- /dev/null +++ b/libs-sdks @@ -0,0 +1 @@ +Subproject commit e305a1a0b9bf6b9a8b0c91a9aad8d73537e7ff1b diff --git a/libs/README.md b/libs/README.md new file mode 100644 index 00000000..8781bf34 --- /dev/null +++ b/libs/README.md @@ -0,0 +1,70 @@ +# JavaCard Libraries + +Local `*.jar` dependencies repository. + +You can add here local dependencies if there are not available on the +Maven central repository or you are not willing to use those. + +If there is a `test.jar` file you can add it as a dependency +by adding the following line to the `dependencies {}` block. + +```gradle +compile name: 'test' +``` + +This works only for JAR files placed right in the `/libs` directory (flat hierarchy). +The artifact group is ignored, artifact is searched just by the name. + +For subdirectories you have to use the `files()` or `fileTree` as demonstrated below. + +Java 8+ is required. + +## Custom JCardSim + +If you want to use custom JCardSim version place your jar in the `libs` directory, e.g., as +`libs/jcardsim-3.0.6.jar` + +Then modify project gradle file `build.gradle`, in particular section `dependencies` as follows: + +```gradle +dependencies { + testCompile 'org.testng:testng:6.1.1' + testCompile group: 'com.klinec', name: 'javacard-tools', version: '0.0.1', transitive: false + + // Previously, the jcardsim record: + // jcardsim 'com.licel:jcardsim:3.0.5' + + // Now using custom version. + jcardsim ':jcardsim:3.0.6' + + // Or you can include jcardsim directly: + // jcardsim files(libs + '/jcardsim-3.0.5.jar') +} + +``` + + +## `globalplatform-2_1_1` + +Globalplatform libraries + +```gradle +compile fileTree(dir: rootDir.absolutePath + '/libs/globalplatform-2_1_1', include: '*.jar') +``` + +Or if you use predefined gradle file with `libs` variable: + +```gradle +compile fileTree(dir: libs + '/globalplatform-2_1_1', include: '*.jar') +``` + +License: no idea + +## `visa_openplatform` + +```gradle +compile fileTree(dir: rootDir.absolutePath + '/libs/visa_openplatform-2_0', include: '*.jar') +``` + +License: no idea + diff --git a/libs/globalplatform-2_1_1/gp211.jar b/libs/globalplatform-2_1_1/gp211.jar new file mode 100755 index 00000000..baf03d9d Binary files /dev/null and b/libs/globalplatform-2_1_1/gp211.jar differ diff --git a/JCMathLib/ext/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp b/libs/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp old mode 100644 new mode 100755 similarity index 100% rename from JCMathLib/ext/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp rename to libs/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp diff --git a/JCMathLib/ext/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp b/libs/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp old mode 100644 new mode 100755 similarity index 100% rename from JCMathLib/ext/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp rename to libs/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp diff --git a/libs/visa_openplatform-2_0/visaop20.jar b/libs/visa_openplatform-2_0/visaop20.jar new file mode 100755 index 00000000..c1fe3b88 Binary files /dev/null and b/libs/visa_openplatform-2_0/visaop20.jar differ diff --git a/package.py b/package.py new file mode 100644 index 00000000..af4389db --- /dev/null +++ b/package.py @@ -0,0 +1,111 @@ +import os +import re + +from argparse import ArgumentParser + +DIR = "." + +CURVES = {"SecP256r1", "SecP256k1", "SecP512r1"} +FILTERED_FILES = {"UnitTests.java", "Example.java", "Integer.java"} + + +def load_imports(files): + imports = set() + for file in files: + with open(file, "r") as f: + for line in f: + if re.search(r"import .*;", line): + imports.add(line.strip()) + + # Remove all imports that are already imported by a wildcard + imports_copy = imports.copy() + for imp in filter(lambda x: "*;" in x, imports_copy): + for other in imports_copy: + if other != imp and other.startswith(imp[:-2]): + imports.remove(other) + return imports + + +def package_file(file, keep_locks=False): + lines = [] + skip = False + with open(file, "r") as f: + for line in f: + if "[DependencyEnd:ObjectLocker]" in line: + skip = False + continue + if not keep_locks and "[DependencyBegin:ObjectLocker]" in line: + skip = True + if skip: + continue + if re.search(r"import .*;", line) or re.search(r"package .*;", line): + continue + if not keep_locks and re.search(r"(un)?lock\(.*\)", line) or re.search(r"registerLock\(", line): + continue + lines.append( + (" " + line.replace("public class ", "public static class ")).rstrip()) + + # Remove empty starting and last lines + while lines[0].strip() == "": + lines.pop(0) + while lines[-1].strip() == "": + lines.pop(-1) + return os.linesep.join(lines) + + +def get_version(file): + with open(file, "r") as f: + for line in f: + if (matches := re.search(r"version \'(.*)\'", line)): + return matches.group(1) + return "0.0" + +def main(): + parser = ArgumentParser( + prog="package.py", + description="Package the JCMathLib library into a single file." + ) + parser.add_argument( + "-d", "--dir", help="Directory to package", default=DIR) + parser.add_argument("-k", "--keep-locks", help="Keep locks", + action="store_true", default=False) + parser.add_argument("-c", "--curves", help="Curves to include", + default=["SecP256k1"], nargs="+", choices=sorted(CURVES)) + parser.add_argument("-p", "--package", + help="Package name", default="your_package") + parser.add_argument("-o", "--output", help="Output file", + default="jcmathlib.java") + args = parser.parse_args() + + version = get_version(f"{args.dir}/applet/build.gradle") + + sources = f"{args.dir}/applet/src/main/java/opencrypto/jcmathlib/" + + filtered_files = FILTERED_FILES.copy() + if not args.keep_locks: + filtered_files = filtered_files.union({"ObjectLocker.java"}) + included_files = sorted(map( + lambda x: sources + x, filter(lambda x: x.endswith(".java") and x not in filtered_files, os.listdir(sources)))) + included_files += list(map(lambda x: f"{sources}curves/{x}.java", args.curves)) + + imports = load_imports(included_files) + + with open(args.output, "w") as f: + print("package " + args.package + ";", file=f) + print(file=f) + for imp in sorted(imports): + print(imp, file=f) + print(file=f) + print("/**", file=f) + print(f" * Packaged JCMathLib v{version} (https://github.com/OpenCryptoProject/JCMathLib).", file=f) + print(" */", file=f) + print("public class jcmathlib {", file=f) + + print((os.linesep * 2).join(map(lambda x: package_file(x, + args.keep_locks), included_files)), file=f) + + print("}", file=f) + + +if __name__ == "__main__": + main() diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..1abb17f5 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'jcmathlib' +include 'applet' +