Example problem simple e-wallet with smart card real

Hi people,

I develop a javacard applet. Before loading and installation of this applet on our javacard, I tested this procedure with the example of electronic purse widely available on the internet. I think most guys should test this example you were the javacard beginner.

I think that my problem here corresponds to the bones of chip instead of the applet code, but as not experienced in the world of javacard, I need your help.

Here is the code of e-wallet (which is correctly compiled, converted, loaded and instantiated/installed on card)
package companyname.sampleapplet;


import javacard.framework.*;

public class Epurse extends Applet {
  private short balance;
  public static final byte CLA = (byte)0x80;
  public static final byte insCredit = (byte)0xA1;
  public static final byte insDebit = (byte)0xA2;
  public static final byte insGetBalance = (byte)0xA3;
  public static final byte insSetPin = (byte)0xB1;
  public static final byte insGetAuth = (byte)0xB2;
  public static final byte insDelog = (byte)0xB3;
  
  OwnerPIN pin;
  
  public boolean select () {
    return (true);
  }
  
  public void deselect(){     
    pin.reset();
  } 

  public Epurse() {
    super();
    this.balance = 0;
    pin = new OwnerPIN((byte)3, (byte)8);
    pin.update( new byte[] {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}, (byte)0, (byte)4); //default PIN is 00 00 00 00
  }

  public static void install (byte [] bArray, short bOffset, byte bLength  ) throws ISOException {
    Epurse = new Epurse();
    s.register();
  }

  public void process(APDU apdu) throws ISOException{
    byte[] buffer = apdu.getBuffer();
    if (selectingApplet()) return;
    if(buffer[0]!=CLA) ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); 
    ISOException.throwIt(ISO7816.SW_FILE_INVALID);
  
    switch (buffer[ISO7816.OFFSET_INS]){
    case insCredit :
         if(pin.isValidated()) credit(apdu, buffer); 
         else 
          ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);
         break;
    case insDebit : 
         if(pin.isValidated()) 
           debit(apdu, buffer);
         else 
           ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);//6986
         break;
    case insGetBalance : 
         if(pin.isValidated()) 
           getbal(apdu, buffer); 
         else 
           ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);//6986
         break;
    case insGetAuth : 
         checkPIN(apdu, buffer);
         break;
    case insSetPin : 
         if(pin.isValidated()) 
           setPIN(apdu, buffer);
         else 
           ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);//6986
         break;
    case insDelog :
         pin.reset(); 
         break;     
    default:
         ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);//6986
    }    
  }

  private void credit(APDU apdu, byte[] buffer ) {
    
  }
  private void debit(APDU apdu, byte[] buffer ) {
 
  }
  private void getbal(APDU apdu, byte[] buffer) {
  
  }

  private void checkPIN(APDU apdu, byte[] buffer){
    short Le = apdu.setIncomingAndReceive();
    byte[] data = new byte[Le];
    try{
      for (short i=0; i<Le; i++)
      {
        data[i] = buffer[(short)(i+ISO7816.OFFSET_CDATA)];
      }
      if (pin.check(data, (short)0, (byte)Le)) return;
      else 
     ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND);//6A83 //6985->SW_CONDITIONS_NOT_SATISFIED
    } catch(NullPointerException e) {
        ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); //6982
    } catch(ArrayIndexOutOfBoundsException a) {
        ISOException.throwIt(ISO7816.SW_FILE_FULL); //6A84
    }
  }

  private void setPIN(APDU apdu, byte[] buffer){

  }
}
My problem is:
-applet SELECT command is executed successfully
- BUT the command check pin (80 00 00 04 01 02 03 04 B2) fails (which it should ask the cmdlet to execute the checkPIN method) fails with the error code 6983 (authentication) blocked

Edited: it seems to me that even I remove control PIN for this application of electronic wallet for every shipment of order pay-per-view, I always get this status word: * 6983 *.

In your experience, what reason causes the card to return this status word?

Can't wait to hear from you
Best regards
JDL

Jean-Damien LEVIEL wrote:
if(buffer[0]!=CLA) ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED);
ISOException.throwIt (ISO7816.SW_FILE_INVALID);

This always throws an exception.

Adriaan

Tags: Java

Similar Questions

  • See 5.1.2 problem with smart cards - reader to not see Office.

    Hi all

    We try to roll an office linked Clone pool that is used by our service accounts and as such, they need to be able to use for banking smart cards. We have installed all the necessary software on the machine of model (GemSafe Gemalto) and also one of our Thin Clients (Wyse V10L or C10LE) connected to the model directly via RDP with the card reader chip attached to ensure that different drivers installed correctly and all is well, the virtual machine is able to see the smart card reader.

    The problem comes when spread us these machines up to the pool, the smart card reader is not detected at all. We tried to connect from the Client light view or via RDP directly to one of the linked Clone desktops and both meet the same problem, that is, the drive is not seen at all. If we plug/unplug the drive of the Wyse terminal we see it be detected in the log of the events on the Client itself.

    Can what tools or newspapers we use side view or VMware to solve this problem?

    To confirm, in the settings to connect to the server by smart card authentication is set to optional. In Global political USB access is set to allowed.

    If need more information please ask and I will be happy to provide it.

    Thanks in advance.

    Right, we got to the bottom of it... and I am kicking myself!

    There is a GPO side configuration of the active computer. Administrative Templates/Windows components/Remote Desktop Services / Remote Desktop Session Host / Device and resource Redirection - do not allow redirection of card device chip.

    GRRRR!

  • Possible bug in Anyconnect with smart card on linux

    Hello

    I got the authentication of smart card Anyconnect connecting Linux using NetId customers.

    My problem is that this only works at first starting a client anyconnect.

    I can do connect/reconnect whenever I want to, but if I left the anyconnect client and restart smart card authentication not working anymore.

    I've nailed sort of problem until beeing associated with the user profile for anyconnect beeing created (including the seams to read at the start of the customer).

    ~/. AnyConnect

    Still further the specific problem with the item seams

    If I delete this specific element of the profile or completely delete the profile, and then restart the client, smart card authentication will work.

    Newspapers anyconnect not sewing to shed light on the problem.

    Print written in the profile is always the same.

    Hope that is understandable and someone could give an explanation to this.

    Do not hesitate to ask if something is not clear or you would like more information.

    Best regards

    / Mattias

    Mattias,

    Please understand that these issues are all new to us.  We had not seen before two cases I know has opened in the same week as yours.  If you wish to pursue a fix, beyond the solution of effective workaround for this add-in, open that a TAC is necessary so that we can collect the details and file another bug.  Please be sure to include in your case, notes of the opening so that the TAC engineer who gets it may be noted that workaround.

    -Craig

  • problem to get internet with SIM card on the probook 6550 b win7 pro 64-bit

    Hello.

    I'm trying to connect to the internet with a SIM card on my Probook 6550 b with win 7 Pro - 64 bit

    I tried an external USB (called Globesurfer icon) device that works on computers running XP, but I can't make it work on mine.

    I tried to put the SIM card directly into the location corresponding to the battery. Nothing happens when I start the computer, and there is only two options in the wizard wireless (WLAN and Bluetooth)

    I tried to download and install a file (called sp53068) on the HP support site which was supposed to install the drivers for internet cell phone. It is a DOS window, and he said a sentence. Then it just closes.
    I also tried to install all the application files that extracts of the sp53068 in c:\swsetup\SP53068, but they have the habit of work.

    Please help me with this problem. Right now this is my only option to connect to the internet from my laptop.

    In advance, thank you for any help.

    Hello. I just wanted to say that the "mystery" is solved. Simply the USB device doesn't work because it only supports cooperative systems up to Win7 32 bit and no further details. I have 64-bit, so it's a 'no-go '. Thanks for you time.

  • T500 Hybrid Graphics problem - how to blindly with Intel card

    I bought a Lenovo T500 with a faulty ATI card that worked perfectly with disabled switchable graphics. Unfortunately for some stupid reason, I decided to test the ATI card and enabled feature switchable graphics in the BIOS. Now, the laptop starts with a black screen (internal / external) and I can't go to the option to disable the feature of the hybrid. Is there a way to re - put the BiOS settings so that I can use the graphics card intel?

    I tried to remove the bios battery, hoping it would issue zero CMOS but this resulted in a series of additional beeps and not much.

    Any help will be greatly appreciated.


  • Users cannot use a smart card to log on a Server Terminal Services session on a computer that is running Windows Server 2008 R2 with SP1

    We have a Windows Server 2008 R2 with Sp1. There was the same exact problem in Windows Server 2008 (KB958596).

    When you use RDP or ICA (Citrix XenApp 6), smart card login prompt at random does not appear. When we close the RDP or ICA and make a new session of the guest of the smart card is here.

    Where can we get a fix, or a reg fix?

    Hotfix for Windows Server 2008 below...

    http://support.Microsoft.com/kb/958596

    In this scenario, users are unable to connect with their card chip and instead, he is invited for their usernames and passwords. If users don't provide these details, the Terminal Services session times out and disconnects.

    When this problem occurs, the option of smart card logon does not appear in the Terminal Services session. Users cannot connect by using their secret codes, and they must provide a user name and password. The option of smart card logon working again after that that they reconnect to the Terminal Services session one or more times

    Hello y2000max,

    Your windows server is beyond the scope of what is generally answered in these forums of consumers. I would recommend reposting among our public IT to Technet-Windows Server securityprofessionals. Thank you!

  • KB931125 Rompt Web server authentication by smart card...

    Windows 2008 Enterprise SP2 IIS7

    The Web site is authenticated against AD with smart card.  Works great... until KB931125 is installed.  As soon as this update of root certificate is installed, all customers get 403.7 error.  I'm going back the VM to the snapshot before KB931125 was installed and everything works well again.  It don't seem to be a way to delete/cancel the damage inflicted by this update of root certificate.

    I found this post: http://msmvps.com/blogs/bradley/archive/2007/03/01/warning-problems-with-root-certificates-update-kb931125.aspx and cleaned on the certificates, but it is not always correct it.

    Please notify.

    It turns out that I'm not a not delete simply not enough of the root certificates.  It works now after the removal of about 1/2 of them.

  • Problems of blackBerry Smartphones initialization of a 330 of SafeNet via the BlackBerry Smart Card Reader

    Hello

    I managed to use my PC BlackBerry smart card reader. Now, I am trying to initialize a smart card SafeNet 330 with SafeNet BSEC from the PC tool. But everything I do the initialization fails.

    Has anyone been initialized properly a card in this way by the BlackBerry smart card reader?

    I suspect a problem with the drive, why I'll try to find my Gemplus400 player and see if it works.

    Thank you

    Chris

    Using the player of Gemplus400 did the trick. Looks like the BlackBerry SCR reader stumbles on the configuration of the password during initialization of the as it does not define the label successfully.

  • HP pavilion f002sm 17: hp pavilion 17 f002sm problem with graphics card

    OK Hi again, you help me with my problem with graphics card yesterday I install the driver for my laptop and I can play games, but I I look for tools of diagnosis and is in writing which is r5 graphics card which is built on my laptop and I have A7 graphical please help amd a8 6410 win 7 32-bit

    Hi @zumzo ,

    I understand that you have installed the driver and it works fine.  When you checked the diagnostics you became confused because it says graphic R5 but you R7.

    According to the specifications of your laptop you have AMD Quad - Core A8 - 6410 APU with graphics Radeon R5 (2 GHz, 2 MB cache).

    Here is a link to the 17-f002sm HP Pavilion Notebook product specifications to confirm this information. I hope that this eliminates any confusion.

  • problem with memory card reader

    bought an Acer C720 Chromebook in July, nine.  Now problems with memory card reader.  Sometimes he reads, sometimes it won't.  This can be corrected?

    Hi PatPeoples84,

    Yes it is possible, unfortunately it will probably come during the service.

    I recommend you contact the provider of the guarantee. In the United States, refurbished products are managed by another institution as new products. If you have any questions, thinking to send me a private message with your serial number and I'll help you get the correct coordinates.

    Thank you
    Cory

  • Problem with VGA card after Windows Update

    Hi all.

    Today I start to address a problem with me second VGA card (Matrox G200 G2 + / QUADP-PL/7) after a yesterday updated windows.
    I am able to see the other 4 monitors, but with a yellow triangle.
    You thing has remove updates yesterday going to solve my problem?

    PS:If you have an another idea is welcome

    Thank you and best regards.

    Hello

    Please contact Microsoft Community.

    This problem may occur if the VGA card drivers are updated after the installation of Windows updates. I suggest to follow the steps below and check to see if problem persists.

    1. Click Start and stop in the search box, type Device Manager.
    2. On top, on the start menu, click on "Device Manager".
    3. In "Device Manager", double click "Graphics card" expand. "."
    4. Click on "display Matrox G200 G2 + / QUADP-PL/7 ' and click 'properties '.
    5. In properties, click on the "Drivers" tab and check if the option 'Return to the version' is 'active '. If so click on "Roll back" to restore the previous version driver.

    Note: If "Roll back" is greyed out, then see the article restoration of the system;

    Warning: When you use system restore to restore the computer to a previous state, the programs and updates that you have installed are removed.

    Important: try to restore your system to an earlier date when everything worked correctly.

    http://Windows.Microsoft.com/en-in/Windows7/products/features/system-restore

    Meet us, then we can help you further.

  • I have a problem with a card being inadmissible for the zoom on a phone.

    I have a problem with a card being inadmissible for the zoom on a phone. The Web site has been formatted for the phone using Muse. The plan should be saved in a way in Photoshop or y at - it a setting in the Muse who can fix this?

    Please provide more details, as if the card is integrated an image or a real map generated by widget.

    The generated plan must zoom in/out.

    Thank you

    Sanjit

  • Can I sign a document with my digital signature using professionals DC smart card?

    Can I sign a document with my digital signature using professionals DC smart card?

    You mean certificate on your smart card, right of signature? If the certificate on your smart card is designed to sign then the answer is "Yes, you can. CA that issued a certificate place some fields that can restrict its use, say, as well as encryption, only signature or authentication of the server only, etc. The certificate on your smart card doesn't have to be no restrictions to use incompatible with signature for you to be able to sign with her. You can simply try to connect your smart card and watch if Acrobat accepts the certificate for the signature.

  • VMWare View fails with windows 7 ultimate 64 bit and smart card

    I have two PC's are both 64-bit Windows 7 Ultimate machines.  My laptop connects to my work PC, but my office will not.  He is aware of my smart card, but when I try and connect it fails saying "failed to connect to server to connect to view. Smart card or certificate authentication is required. "Anyone else had a problem like this?

    See http://blogs.vmware.com/view/2010/10/troubleshooting-smart-card-authentication-using-the-windows-view-client.html for more information on this problem.  Let me know if you have any questions.

  • X 230-problem with Driver card reader

    Hello!

    I found a bug with the card reader Driver. I use Windows 8 x 64 and with installed Driver card reader, I often have a high CPU usage after waking from stand-by. It is caused by the SYSTEM process. In investigating this, I discovered that it was caused by the module of the driver for the card reader. I uninstalled and you have no problems since.

    Am I the only one to go through this and I have no disadvantage to uninstall this driver?

    Hi TPuserX100e,

    I'm glad you found the cause of this! I experienced it myselfand so far have not noticed any bad Effect to use the generic driver.

    I hope this helps!

Maybe you are looking for