SCP03卡密码计算

时间:2019-12-19 15:19:50

标签: cryptography smartcard javacard emv globalplatform

根据 GlobalPlatform安全通道协议'03'卡规范v2.3-修订版DVersion 1.1.2 ,我正在尝试验证从eUICC收到的密码,以便为SCP03建立SCP03目标ISD-P。我可以手动生成并验证卡挑战,但无法生成卡密码。我想念什么?

Host challenge: AF6B2B0E174BA140
Card challenge: E7359F8EEC577E51
Card cryptogram: 86B91FBEA0E67D33
Sequence Number: 000007

keyMAC = keyENC = AA75D7A83CF20FE79C606FF1B7E2CEB4

L = 0040
derviationConstant = 00
Label = 11 x '00' + derviationConstant
context = host challenge + card challenge

input data for CMAC = Label + '00' + L + '01' + context

S-MAC = CMAC('00000000000000000000000600008001AF6B2B0E174BA140E7359F8EEC577E51', keyENC)
(which is S-MAC: D8CA1E32C16EC4528E4BAC561F029DE3)

cardCryptogram = CMAC('00000000000000000000000000004001AF6B2B0E174BA140E7359F8EEC577E51', S-MAC)
(which gives EE97D403A7508CF2D6D0E6002C0FE126 that its 8 most left bytes are not as same as what I got from the eUICC)

1 个答案:

答案 0 :(得分:0)

我验证了密码。根据eUICC的刻录模板,我认为keyENC和keyMAC是相同的。另一方面,在基于X9.63方法的静态密钥提取中,我将长度设置为32(用于验证收据的字节为16个字节,其余为keyENC和keyMAC)。我将长度设置为48,得到了keyMAC,从keyMAC生成了S-MAC,然后生成了CMAC(fixedInputData,S-MAC)== cardCryptogram。