Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PUT KEY command with returned SW 6982

Jean-Damien LEBUIJan 17 2012 — edited Jan 17 2012
There would be some other threads dealing with PUT KEY command however, my put key command failed with SW6982.

Firstly, I have done it successfully in Java and now I migrate this solution to C#.Net, I have an PCSC class which helps me communicate with the SCreader. I refered to this thread
[PUT KEY APDU|https://forums.oracle.com/forums/thread.jspa?threadID=1551395]

I implement exactly the same as I have done in Java (based on source code provided in the thread mentioned above) but failed. Here's a log file for the communication
Card Manager Selection --> Success!
INITIALIZE UPDATE Command sent --> Success
Data from Card: 00 00 00 93 02 90 97 95 20 93 01 02 00 0A FB 59 58 D6 62 71 BE 71 F2 E6 1C 37 D8 7D
Diversification data: 00 00 00 93 02 90 97 95 20 93
Static key set Calculation --> Success
S-ENC: 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
S-MAC: 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
S-DEK: 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
Session key set Calculation --> Success
Session ENC: 33 9F 1D 7F 5D 58 41 EB 03 4F 5C E2 34 55 78 94
Session C-MAC: C6 71 3F 31 B8 DC 1F 89 05 DF EC B4 06 5C B8 1E
Session R-MAC: 3C AE E5 A2 73 1A D0 52 69 0B C8 B5 A1 0F 34 01
Session DEK: 33 9F 1D 7F 5D 58 41 EB 03 4F 5C E2 34 55 78 94
Card cryptogram: BE 71 F2 E6 1C 37 D8 7D
Host cryptogram: 4B 48 C8 62 AB E4 E5 8C
EXTERNAL AUTHENTICATE C-MAC: CB 83 EE 48 91 BE 1D 0C
EXTERNAL AUTHENTICATE command: 84 82 00 00 10 4B 48 C8 62 AB E4 E5 8C CB 83 EE 48 91 BE 1D 0C
Data to calculate MAC: 84 D8 01 81 4B 01 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47
PUT KEY apdu C-MAC: C7 16 78 CE F3 48 EE A7
PUT KEY sent: 84 D8 01 81 4B 01 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47 80 10 5C 8F 22 35 FF 24 F6 4E 20 92 4D BC 24 44 34 F7 03 8B AF 47 C7 16 78 CE F3 48 EE A7
What I try to do is that: I try to replace the old key set (40...4F) by itself (no derivation rule is applied)

I have replaced the values of this scripts to the java code and it produces the same values as in C# code. I really don't know why? The External Authenticate command executed successfully and I use its C-MAC to calculate to C-MAC of PUT KEY command (as detailed in EMV CPS v1.1, page 79/103).

One more thing: in the source in the thread mentioned above, I saw that in the PUT KEY apdu command, he added the value "00" after the C-MAC of PUT KEY. I don't know why?

Is there anybody experienced the same problem as mine and has resolved it? It would be very kind of you to spend a little time on my problem and advice me what to do, I'm really stuck now.

Best regards,
JDL
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2012
Added on Jan 17 2012
1 comment
616 views