文件系统.txt
8.17 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
;修改ATS历史字节
RESET
SEND 00A4040010 486E656F730000000000000000000000
ASSERT 9000
SEND 80F2000010 4845442D484353502D41444D494E3030
ASSERT 9000
SEND FFCA0000 04
edit Hstring $UID$
edit $UID$ = g_GETSW()
edit $UID$ = g_GETSTR ($UID$,0,4)
SEND 8012 0700 0D 0C 4D54 0081 3212 8698 $UID$
SEND FFCC000001 93;读ATS
RESET
SEND 00A4040008A000000003000000
;ASSERT 6F108408A000000003000000A5049F6501FF9000
edit Hstring $HostRand$ ;Host challenge
edit $HostRand$ = 1BAD288F2F19780D
send 8050 00 00 08 $HostRand$
edit Hstring $SWResult$ ;卡片响应值
edit Hstring $KeyDivData$ ;Key diversification data 8bytes
edit Hstring $KeyInfo$ ;Key information 2bytes
edit Hstring $SeqCNTR$ ;Sequence Counter 2bytes
edit Hstring $CardRand$ ;Card challenge 6bytes
edit Hstring $CardCrypt$ ;Card cryptogram 8bytes
edit Hstring $DerivationData$
edit Hstring $SessionKey$
edit Hstring $SCSKey$ ;安全信道静态密钥
edit Hstring $SMACKey$
edit Hstring $SENCKey$
edit Hstring $DESPadding$
edit Hstring $InputData$ ;要加密数据
edit Hstring $ICV$
edit $SWResult$ = g_GETSW()
watch $SWResult$
edit $SeqCNTR$ = g_GETSTR($SWResult$,12,2)
watch $SeqCNTR$
edit $CardRand$ = g_GETSTR($SWResult$,14,6)
watch $CardRand$
edit $DerivationData$ = 0182 $SeqCNTR$ 000000000000000000000000
watch $DerivationData$
edit $SCSKey$ = 404142434445464748494A4B4C4D4E4F
edit $ICV$ = 0000000000000000
edit $SessionKey$ =g_TDESCBC(1 , $ICV$, $SCSKey$ , $DerivationData$)
watch $SessionKey$
edit $InputData$ = $HostRand$ $SeqCNTR$ $CardRand$
watch $InputData$
edit $ICV$ = 0000000000000000
edit $CardCrypt$ = g_ISO9797(1 , 2 ,$ICV$, $SessionKey$ , $InputData$)
watch $CardCrypt$
watch $SWResult$
;host Crypt
edit $InputData$ = $SeqCNTR$ $CardRand$ $HostRand$
watch $InputData$
;计算验证密文时ICV不需要加密
edit Hstring $HostCrypt$
edit $HostCrypt$ = g_ISO9797(1 , 2 ,$ICV$, $SessionKey$ , $InputData$)
watch $HostCrypt$
edit Hstring $CMACResult$
edit Hstring $SMACKey$
edit $SMACKey$ = 404142434445464748494A4B4C4D4E4F
watch $SMACKey$
edit $DerivationData$ = 0101 $SeqCNTR$ 000000000000000000000000
watch $DerivationData$
edit $SessionKey$ = g_TDESCBC(1 ,$ICV$, $SMACKey$ , $DerivationData$)
watch $SessionKey$
edit $InputData$ = 8482000010$HostCrypt$
watch $InputData$
;Singal DES plus Final 3DES MAC
edit $ICV$ = 0000000000000000
edit $CMACResult$ = g_ISO9797(3 , 2 ,$ICV$, $SessionKey$ , $InputData$)
watch $CMACResult$
send 8482 00 00 10 $HostCrypt$$CMACResult$
assert 9000
;###################################################################################################
;### 删除应用和安装应用
;###################################################################################################
;删除地利集团园区应用
SEND 80E4000012 4F10 D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3
;ASSERT 6A88|009000
;安装地利集团园区应用
;SEND 80E60C004C 0FF168656400636974796170706C6574 10F168656400636974796170706C657401 10D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3 0104 16C914 F2 3F00 4000 40 000000 15 31 00 00 0F03 F300 F70300 00
;ASSERT 009000
SEND 80E60C004E 0FF168656400636974796170706C6574 10F168656400636974796170706C657401 10D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3 0104 18C916 F2 3F00 4000 40 000000 15 31 00 00 0F03 F300 F70300 F90400
ASSERT 009000
;###################################################################################################
;### 个人化地利集团园区应用
;###################################################################################################
; 选择地利集团园区应用
SEND 00A4040010 D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3
ASSERT 6F148410D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3A5009000
;外部认证
edit Hstring $Random$
edit Hstring $DESKey$
edit Hstring $SourceData$
edit Hstring $DESResult$
edit Hstring $MACInit$
SEND 0084000008
edit $Random$=g_GETSW()
watch $Random$
;3-DES
edit $DESKey$ = 00000000000000000000000000000000
edit $Random$ = g_GETSTR($Random$,0,8)
watch $Random$
edit $DESResult$ = g_TDES(1 , $DESKey$ , $Random$)
watch $DESResult$
send 0082000008 $DESResult$
assert 9000
;开启快速个人化
SEND 80E5000000
ASSERT 9000
; 创建0010安全文件
SEND 80E0000B08 0010 0090 00 33 0000
ASSERT 9000
; 创建0001 Dir文件(变长记录) 明文+MAC(DCMK1)
SEND 80E000050E 0001 0050 0000 00 20 0000 0000 00 01
ASSERT 9000
; 创建0005基本信息文件(二进制文件)明文+MAC(DCMK1)
SEND 80E000030D 0005 00FA 00 00 20 0000 0000 00 01
ASSERT 9000
;创建0006保留文件(二进制文件)明文+MAC(DCMK2)
SEND 80E000030D 0006 00FA 00 00 20 0000 0000 00 02
ASSERT 9000
;****************装载密钥****************
;主控DCCK
SEND 80D40100 13 000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
ASSERT 9000
;DCMK1和DCMK2
SEND 80D40010 18 0101000000000300 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4
ASSERT 9000
SEND 80D40010 18 0102000000000300 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4
ASSERT 9000
;DIRK1~3
SEND 80D40010 18 1C01010000000300 00000000000000000000000000000000
ASSERT 9000
SEND 80D40010 18 1C02010000000300 00000000000000000000000000000000
ASSERT 9000
SEND 80D40010 18 1C03010000000300 00000000000000000000000000000000
ASSERT 9000
;--------------------------------DF01地利在线平台应用-----------------------------
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
;开启快速个人化
SEND 80E5000000
ASSERT 9000
;创建DF01:地利在线平台应用
SEND 80E00002 1D DF01 07FF 00 000000 15 B9 00 01 03 B5D8C0FBD4DACFDF
ASSERT 9000
; 创建0010安全文件
SEND 80E0000B08 0010 0200 00 33 0000
;****************装载密钥****************
;主控
SEND 80D40100 13 000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6
ASSERT 9000
;维护 DAMK1 DAMK2
SEND 80D40010 18 0101000000000300 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8
ASSERT 9000
SEND 80D40010 18 0102000000000300 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8
ASSERT 9000
;外部认证DEAK
SEND 80D40010 18 00010000 0000 03AA FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7
ASSERT 9000
; 创建0015卡务信息文件 读(外部认证)写(明文+MAC,DAMK1)
SEND 80E000030D 0015 00FA 00 00 20 00AA 0000 00 01
ASSERT 9000
SEND 00D69500 FA FFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
ASSERT 9000
; 创建0019(复合)文件(明文+MAC,DAMK2)
SEND 80E000050E 0019 0119 0000 00 20 0000 0000 00 02
ASSERT 9000
;--------------------------------DF02地利扩展预留应用-----------------------------
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
;开启快速个人化
SEND 80E5000000
ASSERT 9000
;创建DF02:地利扩展预留应用
SEND 80E00002 1D DF02 07FF 00 000000 15 B9 00 01 03 B5D8C0FBC7AEB0FC
ASSERT 9000
; 创建0010安全文件
SEND 80E0000B08 0010 0200 00 33 0000
;****************装载密钥****************
;主控
SEND 80D40100 13 000000 88888888888888888888888888888888
ASSERT 9000