Hi,

Is the cryptoflex 32k card supported in Opencard? Demo's are worrking
perfectly. But my own program gives this error when trying to access
FileAccessCardService.

java.lang.ClassNotFoundException: CardService implementing interface
opencard.op
t.iso.fs.FileAccessCardService
        at
opencard.core.service.CardServiceRegistry.getCardServiceInstance(Card
ServiceRegistry.java:269)
        at
opencard.core.service.SmartCard.getCardService(SmartCard.java:330)
        at WriteFile.main(WriteFile.java:29)
Press any key to continue...




import opencard.core.service.SmartCard;
import opencard.core.service.CardRequest;
import opencard.opt.iso.fs.FileAccessCardService;
import opencard.opt.iso.fs.CardFile;
import opencard.core.OpenCardException;
import opencard.core.util.OpenCardPropertyLoadingException;
import java.io.FileNotFoundException;
import opencard.core.event.CardTerminalEvent;

public class WriteFile {

  public static void main(String[] args)
  {
    System.out.println("initializing file...");

    try {
      SmartCard.start();


      // wait for a smartcard with file access support
      CardRequest cr = new CardRequest(CardRequest.NEWCARD, null, null);

      System.out.println("1");

      SmartCard sc = SmartCard.waitForCard(cr);

   System.out.println("20");

      FileAccessCardService facs =
(FileAccessCardService)sc.getCardService(FileAccessCardService.class, true);
      System.out.println("15");
      CardFile root = new CardFile(facs);
      System.out.println("16");
      CardFile file = new CardFile(root, ":c009");

      String entry = args[0].replace(':', '\n');
      byte[] bytes = entry.getBytes();
      int   length = bytes.length;

      byte[] data  = new byte [file.getLength()];
      if (data.length < length)
        length = data.length;
      System.arraycopy(bytes, 0, data, 0, length);

      // write the data to the file
      facs.write(file.getPath(), 0, data);

      System.out.println(entry);

    } catch (OpenCardException e) {
      e.printStackTrace(System.err);

    } catch (ClassNotFoundException e) {
      e.printStackTrace(System.err);

    } catch (FileNotFoundException e) {
      e.printStackTrace(System.err);

    }

    finally { // even in case of an error...
      try {
        SmartCard.shutdown();
      } catch (OpenCardException e) {
        e.printStackTrace(System.err);
      }
    }

    System.exit(0);
  }
}


---
> 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