二次发卡.txt
11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
clear string
edit Hstring $SW$
edit Hstring $RandomSESLK$;计算会话密钥的Random
edit Hstring $INPUTData$
edit Hstring $Random$
edit Hstring $Key$
edit Hstring $DESKey$
edit Hstring $DESResult$
edit Hstring $mw$
edit Hstring $mkey$
edit Hstring $tkey$
edit Hstring $MACInit$
edit Hstring $MAC$
edit Hstring $INPUT$
edit Hstring $Temp$
edit Hstring $DCCK$
edit Hstring $DIRK1$
edit Hstring $DIRK2$
edit Hstring $DIRK3$
edit Hstring $DCMK1$
edit Hstring $DCMK2$
edit Hstring $DACK$
edit Hstring $DEAK$
edit Hstring $DAMK1$
edit Hstring $DAMK2$
edit Hstring $DACK2$
edit Hstring $0001$
edit Hstring $0005$
edit Hstring $0006$
edit Hstring $0015$
edit Hstring $0016$
edit Hstring $0019$
RESET
SEND 00A4000002 3F00
ASSERT 6F148410D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3A5009000
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0082000008 $DESResult$
assert 9000
;###################################################################################################
;### MF密钥替换
;###################################################################################################
edit $DCCK$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
edit $DACK$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6
edit $DIRK1$ = 11111111111111111111111111111111
edit $DIRK2$ = 22222222222222222222222222222222
edit $DIRK3$ = 33333333333333333333333333333333
edit $DCMK1$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4
edit $DCMK2$ = 22222222222222222222222222222222
edit $DEAK$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7
edit $DAMK1$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8
edit $0005$ = 888870000001100001FFFFFFFFFF8888FFFFFFFFFFFFFFFF721FFFFF88880003195344494C49888800031953
;edit $0005$ = 888800000003100002FFFFFFFFFF8888FFFFFFFFFFFFFFFF721FFFFF88880003195344494C49888800031953FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
;主控子密钥 $DCCK$
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $Key$ = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
edit $mkey$= 13 000000 $DCCK$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $Key$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $DESKey$= $Key$
edit $INPUT$ = 84D401001C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DESKey$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;主控子密钥 $DCCK$
SEND 84D401001C $Temp$
ASSERT 9000
;维护子密钥 $DCMK1$
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 010100 $DCMK1$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DCCK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DCCK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;维护子密钥 $DAMK$
SEND 84D401101C $Temp$
ASSERT 9000
;维护子密钥 $DCMK2$
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 010200 $DCMK2$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DCCK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DCCK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;维护子密钥 $DAMK$
SEND 84D401101C $Temp$
ASSERT 9000
;DIRK1~3
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 1C0101 $DIRK1$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DCCK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DCCK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;DIRK1~3
SEND 84D401101C $Temp$
ASSERT 9000
;DIRK1~3
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 1C0201 $DIRK2$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DCCK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DCCK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;DIRK1~3
SEND 84D401101C $Temp$
ASSERT 9000
;DIRK1~3
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 1C0301 $DIRK3$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DCCK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DCCK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;DIRK1~3
SEND 84D401101C $Temp$
ASSERT 9000
;更新0001 dir文件
;***************************写0001文件*********************************
SEND 0084000008
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 04E2000812 700C610A4F08B5D8C0FBD4DACFDF
edit $MAC$= g_TMAC($MACInit$ , $DCMK1$ , $INPUT$)
watch $MAC$
SEND $INPUT$ $MAC$
ASSERT 9000
SEND 0084000008
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 04E2000812 700C610A5008B5D8C0FBC7AEB0FC
edit $MAC$= g_TMAC($MACInit$ , $DCMK1$ , $INPUT$)
watch $MAC$
SEND $INPUT$ $MAC$
ASSERT 9000
;第二次更新时
;SEND 0084000008
;edit $SW$ = g_GETSW()
;edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
;watch $RandomSESLK$
;edit $MACInit$ = $RandomSESLK$
;edit $INPUT$ = 04DC010C12 700C610A4F08B5D8C0FBD4DACFDF
;edit $MAC$= g_TMAC($MACInit$ , $DCMK1$ , $INPUT$)
;watch $MAC$
;SEND $INPUT$ $MAC$
;ASSERT 9000
;更新0005基本信息文件
;***************************写0005文件*********************************
SEND 0084000008
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 04D6850030 $0005$
edit $MAC$= g_TMAC($MACInit$ , $DCMK1$ , $INPUT$)
watch $MAC$
SEND $INPUT$ $MAC$
ASSERT 9000
;更新0006预留信息文件
;***************************写0006文件*********************************
SEND 0084000008
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 04D6860030 $0006$
edit $MAC$= g_TMAC($MACInit$ , $DCMK2$ , $INPUT$)
watch $MAC$
SEND $INPUT$ $MAC$
ASSERT 9000
;内部认证1
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = $DIRK1$
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0088000108 $DESResult$
;ASSERT F643AEEE267B96BE 9000
;内部认证2
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = $DIRK2$
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0088000208 $DESResult$
;ASSERT 2D32365B79BAB9299000
;内部认证3
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = $DIRK3$
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0088000308 $DESResult$
;ASSERT 60833056F73E2A249000
;DF01:地利在线平台应用
SEND 00A40400 08 B5D8C0FBD4DACFDF
ASSERT 6F7F8410B5D8C0FBD4DACFDF0000007479617070A56B9F0801029F0C64FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9000
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = $DACK$
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0082000008 $DESResult$
assert 9000
;外部认证密钥 $DEAK$
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 000100 $DEAK$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DACK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DACK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;维护子密钥 $DAMK$
SEND 84D401101C $Temp$
ASSERT 9000
;应用维护子密钥 $DCMK2$
send 00 84 00 00 08
edit $SW$ = g_GETSW()
edit $RandomSESLK$ = g_GETSTR($SW$,0,8)
watch $RandomSESLK$
edit $mkey$= 13 010100 $DAMK1$ 80000000
watch $mkey$
edit $mw$ = g_TDES(1 , $DACK$ , $mkey$)
watch $mw$
edit $MACInit$ = $RandomSESLK$
edit $INPUT$ = 84D401101C$mw$
edit $MAC$= g_TMAC($MACInit$ , $DACK$ , $INPUT$)
watch $mw$ $MAC$
edit $Temp$ = $mw$ $MAC$
watch $Temp$
;维护子密钥 $DAMK$
SEND 84D401101C $Temp$
ASSERT 9000
;外部认证
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = $DEAK$
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0082000108 $DESResult$
ASSERT 9000