working with Java Card Wallet

后端 未结 1 1515
[愿得一人]
[愿得一人] 2020-12-30 16:49

I am a java card beginner, The copied the code below from a sample. somehow, i have been able how part of the code works. But still confused about the following.

.Th

相关标签:
1条回答
  • 2020-12-30 17:36

    To call the credit (or debit) methods you need to change the INS byte of your APDU to match the required value.

    In the code you have posted the INS for Credit is 0x30 and the INS for Debit is 0x40.

    So after sending your select APDU you would need to send the following

    Credit

    0x80 0x30 0x00 0x00 0x01 (1 byte containing the Credit value) 0x00
    

    Debit

    0x80 0x30 0x00 0x00 0x01 (1 byte containing the Debit value) 0x00
    

    In both cases you should recieve 0x63 0x61 in response indicating that you need to perform a Verify PIN command.

    The Verify PIN command should be constructed as:

    0x80 0x20 0x00 0x00 (1 byte indicating the number of PIN bytes) (The PIN bytes) 0x00
    

    for example if the PIN were 4 digits and set to the value '1234' you would expect to see the following:

    0x80 0x20 0x00 0x00 0x02 0x12 0x34 0x00
    

    If the PIN is verified correctly you will get a 0x90 0x00 in response

    If the PIN is incorrect you will get a 0x63 0x00 response

    The value of the PIN for this app is set in the install parameters for the applet which as the name suggests is when the applet is installed onto a card (or emulator)

    Hope this helps

    0 讨论(0)
提交回复
热议问题