Hi,

I can't create a c009 file in the root, because my root acces (AUT1) is
blocked :-( but i don't want to throw my card away.
I did made a c009 file in a dir called 5016( this one was still present in
my root dir and i could access it with CHV1)
Where should i change the code, which makes it possible for me to have file
access support?
I'm using a Cryptoflex 32k Card.
The program jams on reading smartcardfile....




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 java.io.FileNotFoundException;

public class ReadFile {

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

    try {
      SmartCard.start();

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

      SmartCard sc = SmartCard.waitForCard(cr);

      FileAccessCardService facs = (FileAccessCardService)
       sc.getCardService(FileAccessCardService.class, true);
      CardFile root = new CardFile(facs);
      CardFile file = new CardFile(root, ":c009");

      byte[] data = facs.read(file.getPath(), 0,
                             file.getLength() );
      sc.close();

      String entry = new String(data);
      entry = entry.trim();
      System.out.println(entry);

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

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

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

    }


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

    System.exit(0);
  }
}


Thanx newby


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