Hello!

My English is very bad, but I hope, that you can understand my problem.
I'm using the Siemens Snuggle B1 reader and the IBM MFC smartcards.

My opencard.properties is:

----------------------------------------------
OpenCard.services = com.ibm.opencard.factory.MFCCardServiceFactory \
                          opencard.opt.util.PassThruCardServiceFactory
OpenCard.terminals =
com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
OpenCard.trace = opencard:1 com.ibm:1
----------------------------------------------

I compiled an try to run a little test program:

----------------------------------------------
 import opencard.core.terminal.*;
 import opencard.core.util.*;
 import opencard.core.service.*;
 import opencard.opt.util.*;

 public class SimTest {
     public static void main (String [] args) {
     System.out.println ("----------------------------------------------");
     System.out.println ("Test of OCF with a SIM card");
     System.out.println ("");
     try {
         SmartCard.start ();
         CardRequest cr = new CardRequest ();
         cr.setWaitBehavior (CardRequest.ANYCARD);
         SmartCard sm = SmartCard.waitForCard (cr);
         if (sm != null) {
         CardID cardID = sm.getCardID ();
         printCardID (cardID);
         } else {
         System.out.println ("did not get a SmartCard object!");
         }
         PassThruCardService cs = (PassThruCardService)
         sm.getCardService(PassThruCardService.class, true);
         CommandAPDU cmd = new CommandAPDU(22);
         cmd.setLength(0);
         cmd.append((byte) 0xa0);
         cmd.append((byte) 0xf2);
         cmd.append((byte) 0x00);
         cmd.append((byte) 0x00);
         cmd.append((byte) 0x16);
         System.out.println("Command 'STATUS':");
         System.out.println(cmd.toString());
         System.out.println("Sending a 'STATUS' command to the card...");
         ResponseAPDU resp = cs.sendCommandAPDU(cmd);
         System.out.println("Response to 'STATUS' command:");
         System.out.println(resp.toString());
         SmartCard.shutdown ();
     }
     catch (OpenCardPropertyLoadingException plfe) {
         System.out.println ("OpenCardPropertyLoadingException: ");
         System.out.println (plfe.getMessage () );
     }
     catch (ClassNotFoundException cnfe) {
         System.out.println ("ClassNotFoundException: ");
         System.out.println (cnfe.getMessage () );
     }
     catch (CardServiceException cse) {
         System.out.println ("CardServiceException: ");
         System.out.println (cse.getMessage () );
     }
     catch (CardTerminalException cte) {
         System.out.println ("CardTerminalException: ");
         System.out.println (cte.getMessage () );
     }
     System.out.println ("");
     System.out.println ("----------------------------------------------");
     }
     public static void printCardID (CardID cardID) {
     StringBuffer sb = new StringBuffer("Obtained the following
CardID:\n\n");
     byte [] atr = cardID.getATR ();
     sb.append (HexString.hexify (atr) ).append ('\n');
     appendHistoricals (sb, cardID);
     System.out.println(sb);
     }
     private static void appendHistoricals(StringBuffer sb, CardID cardID) {
     byte[] hist = cardID.getHistoricals();
     sb.append("Historicals: ");
     if (hist == null) {
         sb.append("none\n");
     } else {
         sb.append(HexString.hexify(hist)).append('\n');
         sb.append("as a string: ");
         for(int i=0; i<hist.length; i++)
         sb.append((hist[i]<32)? // signed byte extension!
               ' ' : (char)hist[i]);
         sb.append('\n');
     }
     }
     private static void appendTS(StringBuffer sb, byte ts) {
     sb.append("TS = ").append(HexString.hexify(ts)).append("    ");
     sb.append((ts==(byte)0x3b) ? "direct" : "inverse").append("
convention\n");
     }
     private static void appendT0(StringBuffer sb, byte t0) {
     sb.append("TS = ").append(HexString.hexify(t0)).append("    ");
     binify(sb, t0);
     sb.append('\n');
     }
     private static void appendClockrate(StringBuffer sb, byte cr) {
     double[] mhz  = { -1.0, 5.0, 6.0, 8.0, 12.0, 16.0, 20.0, -1.0,
               5.0, 7.5, 10.0, 15.0, 20.0, -1.0, -1.0, -1.0 };
     int[] factors = { -2, 372, 558, 744, 1116, 1488, 1860, -1,
               512, 768, 1024, 1536, 2048, -1, -1, -1 };
     
     int fi = (cr >> 4) & 0xf;
     double speed =   mhz  [fi];
     int   factor = factors[fi];
     sb.append("Clock speed ");
     if (speed < 0)
         sb.append("???");
     else
         sb.append(speed);
     sb.append(" MHz, divided by ");
     if (factor < 0)
         sb.append("???");
     else
         sb.append(factor);
     sb.append('\n');
     }
     private static void appendBitAdjust(StringBuffer sb, byte b) {
     double[] bra = { -1.0, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, -1.0,
              12.0, 20.0, 1.0/2, 1.0/4, 1.0/8, 1.0/16, 1.0/32, 1.0/64 };
     int di = b & 0xf;
     sb.append("bit rate adjustment ");
     if (bra[di] < 0)
         sb.append("???");
     else
         sb.append(bra[di]);
     sb.append('\n');
     }
     private static void appendProgCurr(StringBuffer sb, byte b) {
     int[] mpg = { 25, 50, 100, -1 };
     int ii = (b >> 5) & 3;
     sb.append("max prog current ");
     if (b < 0)
         sb.append("???");
     else
         sb.append(mpg[ii]).append(" mA");
     sb.append('\n');
     } 
     private static void binify(StringBuffer sb, byte b) {
     for(int i=0; i<8; i++) {
         sb.append((b<0) ? '1' : '0');
         b <<= 1;
     }
     }
 }
----------------------------------------------

But I get always the following Exception:

----------------------------------------------
Test of OCF with a SIM card

Uses ISOTPDU

Obtained the following CardID:

3B EF 00 FF 81 31 52 45 4D 46 43 20 49 42 4D 20
34 30 48 39 36 30 31 FB
Historicals: 4D 46 43 20 49 42 4D 20 34 30 48 39 36 30 31
as a string: MFC IBM 40H9601

Command 'STATUS':
opencard.core.terminal.CommandAPDU@3c5982
0000:  A0 F2 00 00 16 00 00 00 00 00 00 00 00 00 00 00  ................

Sending a 'STATUS' command to the card...
CardTerminalException: 
Pcsc10CardTerminal: PCSC Exception in method SCardTransmit: PC/SC Wrapper
Error: no active or unknown protocol on connection
return code = 00000000
----------------------------------------------

Can somebody imagine what the problem  is?
I hope somebody can help me a little ...

Thanks a lot.

Eduard Hildebrandt



---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to