Hi,

I'm a beginner with ocf and have a problem:
In our system you enter the smart-card-PIN in a window on your PC
instead of the card reader. And
now our code should be changed in that way, that you have to enter the
PIN into the card reader
directly. What do I have to do?

our accessCard() includes the following:

...
 try {

  // Get the card service for reading data
  cfs = (FileAccessCardService)
m_sc.getCardService(FileAccessCardService.class, true);
  m_root = new CardFile(cfs);
  if (m_bTrace)
   System.out.println("DiCardAccess mounted root " + m_root + "
successfully");
 } catch (Exception e) {
  m_sc = null;
  m_root = null;
  throw new DiCardException(DiCardException.DIA_ERR_CARD_ACCESS, "Card
cannot be
accessed");
 }

 try {
   // Register DiCHVDialog
   DiCHVDialog dialog = new DiCHVDialog();
   cfs.setCHVDialog(dialog);
 } catch (Exception e) {
   throw new DiCardException(DiCardException.DIA_ERR_INTERNAL,
"Registering
DiCHVDialog");
 }
...


and the DiCHVDialog looks like this:

import java.awt.Frame;
import java.awt.Dimension;

import com.ibm.opencard.handler.IDDialog;
import opencard.core.service.CHVDialog;

public class DiCHVDialog implements opencard.core.service.CHVDialog {

public DiCHVDialog() {
 super();
}
/**
 * getCHV method comment.
 */
public String getCHV(int arg1) {
 Frame frame = new Frame("");
 frame.setVisible(false);

 IDDialog dialog = new IDDialog(frame, "PIN Verification", "Please enter

your personal PIN ", arg1);
 Dimension dim = frame.getToolkit().getScreenSize();
 dialog.setSize(dim.width / 3, dim.height / 3);
 dialog.setLocation(dim.width / 2 - dim.width / 6, dim.height / 2 -
dim.height / 6);
 dialog.show(); // popup dialog for PIN entry, wait for CHV
 frame.dispose(); // kill the frame

 String pin = dialog.pin();
 if ((pin != null) && (pin.length() == 0))

  // empty password
  pin = null; // not allowed

 // 4 digit PIN must be extended to 8 digits
 if (pin != null)
  while (pin.length() < 8) {//for (int i = pin.length(); (i < 8); i++) {

   pin = pin + "0";
  }
 return pin;
}
}

Thanks for helping me,

D.Ahlisch


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