On Tue, 29 Jun 2010 20:03:36 +0800, Josef Windorfer  
<josef.windor...@stud.fh-deggendorf.de> wrote:

>> In this case, the MAC is generated by the key "trans_code_ftcos_pk_01c",
>> and the iv(card generated random number).
The iv is different each time.

> With source code and log I found out that the mechanism for the mac is  
> cbc-des. Can someone tell me which hash function is used?
I think you can treat the EVP_* functions combination in  
entersafe_mac_apdu() as a hash function.

> What is the meaning of this comment in the 'entersafe_mac_apdu'  
> prototype:
> /* use first 4 bytes of last block as mac value*/
One block consist of 8 byte, each block correspond with previous block,  
thus the first 4 bytes of last block can be used as the MAC(digest).

> I want to check the mac and all my tries failed.
To get the right mac, you need get the same iv as the card have.
The checking is done in card, because the iv is generate in card, and the  
key is stored in card, the card can recalculate the MAC

Regards, Xiaoshuo
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to