Raza Javed
Raza Javed

Reputation: 65

How to create secret session keys (S-ENC, S-MAC and S-DEK) using card-challenge and card-cryptogram?

I have a microcontroller(msp430) and a smartcard(se050), and I am sending APDUs from micro controller to the smartcard using Code Composer Studio on my windows computer.

I am trying to create a secure channel (SCP03) using AES symmetry key. I have created a session using this AES key on the smart card and now to perform mutual authentication I have sent 'INITIALIZE UPDATE' command APDU to smart card

Initialize Update APDU:

80 50 00 00 08 00 00 00 00 00 00 00 00 00

And the response from the card is:

00 00 00 00 00 00 00 00 00 00 00 03 60 7E 25 31 3D BE 63 59 BE 34 AA 4B C0 F2 B9 27 B4 

where

00 00 00 00 00 00 00 00 00 00 = Key Diversification Data

00 03 60 = Key information

7E 25 31 3D BE 63 59 BE = card challenge

34 AA 4B C0 F2 B9 27 B4 = card cryptogram

Now, I want to check if card cryptogram is correct or NOT? For that I need to create secret session keys (S-ENC, S-MAC, S-DEK) and the card cryptogram in order to authenticate the card.

Also I need to create 'Host Cryptogram' that I need to resend to the smart card in 'EXTERNAL AUTHENTICATE' command.

How can I generate these things in code composer? Are there any C-libraries that I can import in my codes to generate these keys and cryptograms?

Upvotes: 0

Views: 1003

Answers (1)

k_o_
k_o_

Reputation: 6298

I have developed a while a ago and recently updated the GlobhalPlatform C Library. Here is an Overview Page and here is the API documentation. For your problem mutual authentication is a good starting point. Remember that you can generate also more convenient project files for Visual Studio or Eclipse with cmake -G "..." to have a good way of browsing the project.

Upvotes: 2

Related Questions