I am trying to implement TR-31 decryption into my test application. Because I don't have TR31 standard from ANSI i relay on free materials :)
I am able to get the clear key using Cryptographics Calculator.
KBPK: 33333333333333334444444444444444
TR-31 Key block: B0080P0TD00S00003A74E0769701C712CC87ECB93E9455CC2BF16C71B30F507E524F535F42B56027
----------------------------------------
TR-31 Header: B0080P0TD00S0000
----------------------------------------
Version Id: B
Block Length: 0080
Key Usage: P0
Algorithm: T
Mode of Use: D
Key Version No.: 00
Exportability: S
Num. of Opt. blocks: 00
Reserved: 00
Optional Blocks:
TR-31 Encrypted key: 3A74E0769701C712CC87ECB93E9455CC2BF16C71B30F507E
TR-31 MAC: 524F535F42B56027
----------------------------------------
Plain Key: 94892FF715E992BC4AC4E56116582AE6
But if I try to do intermediate steps myself I don get the same result.
From the available online sources I have found out that for B version KBEK is made of two components 3DES CMAC of hex "0100000000000080" and "0200000000000080". After result of CMAC is joined we should have KBEK.
Finally we get clear key by using 3DES decryption in CBC mode. KB MAC is used as IV.
Unfortunately following these steps didn't get me to clear key. Any help would be appreciated.