@urovotest/urovosdk-docs-mcp 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +176 -0
  2. package/docs/00-overview.md +37 -0
  3. package/docs/01-integration/android-permissions.md +22 -0
  4. package/docs/01-integration/quickstart-zh.md +54 -0
  5. package/docs/02-reference/emv/emv-api.md +3308 -0
  6. package/docs/02-reference/emv/emv-appendix.md +112 -0
  7. package/docs/02-reference/emv/emv-callback.md +1155 -0
  8. package/docs/02-reference/emv/emv-enum.md +324 -0
  9. package/docs/02-reference/error-codes.md +59 -0
  10. package/docs/02-reference/general/beeper.md +160 -0
  11. package/docs/02-reference/general/devicemanager.md +460 -0
  12. package/docs/02-reference/general/insertcardreader.md +307 -0
  13. package/docs/02-reference/general/install-manager.md +202 -0
  14. package/docs/02-reference/general/led-light.md +144 -0
  15. package/docs/02-reference/general/magcardreader.md +191 -0
  16. package/docs/02-reference/general/pinpad.md +3309 -0
  17. package/docs/02-reference/general/printer.md +1410 -0
  18. package/docs/02-reference/general/psam2.md +55 -0
  19. package/docs/02-reference/general/rfcardreader.md +1090 -0
  20. package/docs/02-reference/general/scanner-custom.md +196 -0
  21. package/docs/02-reference/general/scanner.md +214 -0
  22. package/docs/02-reference/general/sdk-log-output-management.md +124 -0
  23. package/docs/02-reference/general/serial-port-deprecated-suggest-using-module-14-serialtool.md +406 -0
  24. package/docs/02-reference/general/serial-port.md +326 -0
  25. package/docs/02-reference/general/sle4428-4436-4442.md +1890 -0
  26. package/docs/02-reference/general/system-manager.md +212 -0
  27. package/docs/02-reference/module-index.md +30 -0
  28. package/docs/02-reference/source-emv_sdk.md +3927 -0
  29. package/docs/02-reference/source-general_sdk.md +8978 -0
  30. package/docs/02-reference/undocumented/kiosk-lock-task.md +92 -0
  31. package/docs/03-demo/activity-map.md +27 -0
  32. package/docs/api-registry.json +4733 -0
  33. package/docs/search-index.json +2688 -0
  34. package/docs/source/emv_sdk.md +3927 -0
  35. package/docs/source/general_sdk.md +8978 -0
  36. package/docs/source/kiosk_lock_task.md +86 -0
  37. package/package.json +36 -0
  38. package/src/launch.js +22 -0
  39. package/src/lib/check-update.js +92 -0
  40. package/src/lib/create-mcp-server.js +90 -0
  41. package/src/lib/docs-tools.js +206 -0
  42. package/src/server.js +10 -0
@@ -0,0 +1,3309 @@
1
+ ---
2
+ title: Pinpad API
3
+ module: Pinpad
4
+ domain: general
5
+ tags: ["general", "pinpad", "pinpad"]
6
+ ---
7
+ # Pinpad
8
+
9
+ 共 **37** 个 API/条目,来源 `general_sdk.md`。
10
+
11
+ ## API 索引
12
+
13
+ | 方法 | 类路径 | Demo Activity |
14
+ |------|--------|---------------|
15
+ | [isKeyExist](#iskeyexist) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
16
+ | [loadTEK](#loadtek) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
17
+ | [loadEncryptMainKey](#loadencryptmainkey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
18
+ | [loadMainKey](#loadmainkey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
19
+ | [loadWorkKey](#loadworkkey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
20
+ | [calcMAC](#calcmac) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
21
+ | [calculateDes](#calculatedes) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
22
+ | [downloadKeyDukpt](#downloadkeydukpt) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
23
+ | [calculateMACOfDUKPTExtend](#calculatemacofdukptextend) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
24
+ | [encryptWithPEK(Deprecated)](#encryptwithpek-deprecated) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
25
+ | [getDukptPinBlock](#getdukptpinblock) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
26
+ | [getPinBlockEx](#getpinblockex) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
27
+ | [getRSAPublicKeyModel](#getrsapublickeymodel) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
28
+ | [loadDukptBlob](#loaddukptblob) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
29
+ | [DukptGetKsn](#dukptgetksn) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
30
+ | [DiversifiedKey](#diversifiedkey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
31
+ | [genKeyHashValue](#genkeyhashvalue) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
32
+ | [EndPinInputEvent](#endpininputevent) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
33
+ | [DukptEncrytDataIV](#dukptencrytdataiv) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
34
+ | [deleteKey(MK/SK)](#deletekey-mk-sk) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
35
+ | [setKeyAlgorithm](#setkeyalgorithm) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
36
+ | [DukptAesInitial](#dukptaesinitial) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
37
+ | [DukptAesGetKsn](#dukptaesgetksn) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
38
+ | [DukptAesUpdateKsn](#dukptaesupdateksn) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
39
+ | [DukptAesEncryptDataIV](#dukptaesencryptdataiv) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
40
+ | [GetDukptAesPinBlock](#getdukptaespinblock) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
41
+ | [getOfflinePinBlcok](#getofflinepinblcok) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
42
+ | [downloadKeyTR31](#downloadkeytr31) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
43
+ | [DukptInitialTr31](#dukptinitialtr31) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
44
+ | [DukptAesInitialTr31](#dukptaesinitialtr31) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
45
+ | [generateRSAKey](#generatersakey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
46
+ | [readRSAPublicKey](#readrsapublickey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
47
+ | [calculateWithRSAPrivateKey](#calculatewithrsaprivatekey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
48
+ | [calculateWithRSAPublicKey](#calculatewithrsapublickey) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
49
+ | [isDukptKeyExist](#isdukptkeyexist) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
50
+ | [getLastErrorCode](#getlasterrorcode) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
51
+ | [getLastErrorMsg](#getlasterrormsg) | `com.urovo.sdk.pinpad.PinPadProviderImpl` | PinpadActivity, PinpadUtil |
52
+
53
+ ## isKeyExist
54
+
55
+ Determine is key exist
56
+
57
+ ```java
58
+ boolean isKeyExist(int keyType, int keyId)
59
+ ```
60
+
61
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
62
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
63
+ - **源文档章节:** 3.1
64
+
65
+ - Source section: `3.1`
66
+
67
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
68
+
69
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
70
+
71
+
72
+
73
+ Purpose:
74
+ Determine is key exist
75
+
76
+
77
+ Signature/prototype:
78
+ ```java
79
+ boolean isKeyExist(int keyType, int keyId)
80
+ ```
81
+
82
+
83
+ Parameters:
84
+ Input
85
+ keyType - key type
86
+ - 0-Main key
87
+ - 1-MAC key
88
+ - 2-PIN key
89
+ - 3-TD key
90
+
91
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
92
+
93
+ Load the index of the key store
94
+ Output
95
+ None
96
+
97
+
98
+ Return value:
99
+ Existence returns true, otherwise it returns false.
100
+
101
+
102
+ Simplified example:
103
+ ```java
104
+ boolean exists = PinPadProviderImpl.getInstance().isKeyExist(Constant.KeyType.PIN_KEY, 1);
105
+ ```
106
+
107
+
108
+ Source details:
109
+ ```text
110
+ Prototype
111
+ boolean isKeyExist(int keyType, int keyId)
112
+ Description
113
+ Determine is key exist
114
+ Parameters
115
+ Input
116
+ keyType - key type
117
+ - 0-Main key
118
+ - 1-MAC key
119
+ - 2-PIN key
120
+ - 3-TD key
121
+
122
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
123
+
124
+ Load the index of the key store
125
+ Output
126
+ None
127
+ Return
128
+ Existence returns true, otherwise it returns false.
129
+ Remark
130
+ ```
131
+
132
+ ## loadTEK
133
+
134
+ Load TEK, and TEK is the key for encrypting main key.
135
+
136
+ ```java
137
+ boolean loadTEK(int keyId, byte[] key, byte[] checkValue)
138
+ ```
139
+
140
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
141
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
142
+ - **源文档章节:** 3.2
143
+
144
+ - Source section: `3.2`
145
+
146
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
147
+
148
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
149
+
150
+
151
+
152
+ Purpose:
153
+ Load TEK, and TEK is the key for encrypting main key.
154
+
155
+
156
+ Signature/prototype:
157
+ ```java
158
+ boolean loadTEK(int keyId, byte[] key, byte[] checkValue)
159
+ ```
160
+
161
+
162
+ Parameters:
163
+ Input
164
+ keyId - TEKKey storage index
165
+
166
+ key - Load key
167
+
168
+ checkValue - Check value KCV is allowed to be null (3DES encryption 4 bytes all 00, take the first 4 bytes)
169
+ Output
170
+ None
171
+
172
+
173
+ Return value:
174
+ Load successfully returns true, otherwise returns false.
175
+
176
+
177
+ Source details:
178
+ ```text
179
+ Prototype
180
+ boolean loadTEK(int keyId, byte[] key, byte[] checkValue)
181
+ Description
182
+ Load TEK, and TEK is the key for encrypting main key.
183
+ Parameters
184
+ Input
185
+ keyId - TEKKey storage index
186
+
187
+ key - Load key
188
+
189
+ checkValue - Check value KCV is allowed to be null (3DES encryption 4 bytes all 00, take the first 4 bytes)
190
+ Output
191
+ None
192
+ Return
193
+ Load successfully returns true, otherwise returns false.
194
+ Remark
195
+ ```
196
+
197
+ ## loadEncryptMainKey
198
+
199
+ Load Encrypt main key, encrypted by TEK.
200
+
201
+ tekkId - the index of TEK.
202
+
203
+ ```java
204
+ boolean loadEncryptMainKey(int tekId, int keyId, byte[] key, byte[] check Value)
205
+ ```
206
+
207
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
208
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
209
+ - **源文档章节:** 3.3
210
+
211
+ - Source section: `3.3`
212
+
213
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
214
+
215
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
216
+
217
+
218
+
219
+ Purpose:
220
+ Load Encrypt main key, encrypted by TEK.
221
+
222
+ tekkId - the index of TEK.
223
+
224
+
225
+ Signature/prototype:
226
+ ```java
227
+ boolean loadEncryptMainKey(int tekId, int keyId, byte[] key, byte[] check Value)
228
+ ```
229
+
230
+
231
+ Parameters:
232
+ Input
233
+ keyId - load the index of the key store.
234
+
235
+ key - load key
236
+
237
+ checkValue - Check value KCV
238
+ Output
239
+ None
240
+
241
+
242
+ Return value:
243
+ Load successfully returns true, otherwise returns false.
244
+
245
+
246
+ Usage notes:
247
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
248
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV
249
+
250
+
251
+ Source details:
252
+ ```text
253
+ Prototype
254
+ boolean loadEncryptMainKey(int tekId, int keyId, byte[] key, byte[] check Value)
255
+ Description
256
+ Load Encrypt main key, encrypted by TEK.
257
+
258
+ tekkId - the index of TEK.
259
+ Parameters
260
+ Input
261
+ keyId - load the index of the key store.
262
+
263
+ key - load key
264
+
265
+ checkValue - Check value KCV
266
+ Output
267
+ None
268
+ Return
269
+ Load successfully returns true, otherwise returns false.
270
+ Remark
271
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
272
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV
273
+ ```
274
+
275
+ ## loadMainKey
276
+
277
+ Load main key
278
+
279
+ ```java
280
+ boolean loadMainKey(int keyId, byte[] key, byte[] checkValue)
281
+ ```
282
+
283
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
284
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
285
+ - **源文档章节:** 3.4
286
+
287
+ - Source section: `3.4`
288
+
289
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
290
+
291
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
292
+
293
+
294
+
295
+ Purpose:
296
+ Load main key
297
+
298
+
299
+ Signature/prototype:
300
+ ```java
301
+ boolean loadMainKey(int keyId, byte[] key, byte[] checkValue)
302
+ ```
303
+
304
+
305
+ Parameters:
306
+ Input
307
+ keyId - load the index of the key store
308
+ key - load key
309
+ checkValue - Check value KCV
310
+ Output
311
+ None
312
+
313
+
314
+ Return value:
315
+ Load successfully returns true, otherwise returns false.
316
+
317
+
318
+ Usage notes:
319
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
320
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV
321
+
322
+
323
+ Simplified example:
324
+ ```java
325
+ byte[] key = BytesUtil.hexString2Bytes("11111111111111111111111111111111");
326
+ boolean ok = PinPadProviderImpl.getInstance().loadMainKey(0, key, null);
327
+ ```
328
+
329
+
330
+ Source details:
331
+ ```text
332
+ Prototype
333
+ boolean loadMainKey(int keyId, byte[] key, byte[] checkValue)
334
+ Description
335
+ Load main key
336
+ Parameters
337
+ Input
338
+ keyId - load the index of the key store
339
+ key - load key
340
+ checkValue - Check value KCV
341
+ Output
342
+ None
343
+ Return
344
+ Load successfully returns true, otherwise returns false.
345
+ Remark
346
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
347
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV
348
+ ```
349
+
350
+ ## loadWorkKey
351
+
352
+ Load work key, including PIN key, MAC key, and track encryption key
353
+
354
+ ```java
355
+ boolean loadWorkKey(int keyType, int mkId, int wkId,
356
+ byte[] key, byte[] checkValue)
357
+ ```
358
+
359
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
360
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
361
+ - **源文档章节:** 3.5
362
+
363
+ - Source section: `3.5`
364
+
365
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
366
+
367
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
368
+
369
+
370
+
371
+ Purpose:
372
+ Load work key, including PIN key, MAC key, and track encryption key
373
+
374
+
375
+ Signature/prototype:
376
+ ```java
377
+ boolean loadWorkKey(int keyType, int mkId, int wkId,
378
+ byte[] key, byte[] checkValue)
379
+ ```
380
+
381
+
382
+ Parameters:
383
+ Input
384
+ keyType - key type
385
+ - 0-Main key
386
+ - 1-MAC key
387
+ - 2-PIN key
388
+ - 3-TD key
389
+
390
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
391
+ mkId - the index of main key
392
+ wkId - the index of load work key store
393
+ Key - key data
394
+ checkValue - Check value KCV
395
+ Output
396
+ None
397
+
398
+
399
+ Return value:
400
+ Load successfully returns true, otherwise returns false.
401
+
402
+
403
+ Usage notes:
404
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
405
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV.
406
+
407
+
408
+ Simplified example:
409
+ ```java
410
+ boolean ok = pinpad.loadWorkKey(Constant.KeyType.PIN_KEY, 0, 1, encryptedPinKey, null);
411
+ ```
412
+
413
+
414
+ Source details:
415
+ ```text
416
+ Prototype
417
+ boolean loadWorkKey(int keyType, int mkId, int wkId,
418
+ byte[] key, byte[] checkValue)
419
+ Description
420
+ Load work key, including PIN key, MAC key, and track encryption key
421
+ Parameters
422
+ Input
423
+ keyType - key type
424
+ - 0-Main key
425
+ - 1-MAC key
426
+ - 2-PIN key
427
+ - 3-TD key
428
+
429
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
430
+ mkId - the index of main key
431
+ wkId - the index of load work key store
432
+ Key - key data
433
+ checkValue - Check value KCV
434
+ Output
435
+ None
436
+ Return
437
+ Load successfully returns true, otherwise returns false.
438
+ Remark
439
+ If the key Encrypt data is the IC key [KEY(16Byte)] structure, check Value is null.
440
+ If the Key data is an integer multiple of 4, check Value is 4 bytes KCV.
441
+ ```
442
+
443
+ ## calcMAC
444
+
445
+ Calculating MAC
446
+
447
+ ```java
448
+ byte[] calcMAC(int keyId, byte[] data, int mode)
449
+ ```
450
+
451
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
452
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
453
+ - **源文档章节:** 3.6
454
+
455
+ - Source section: `3.6`
456
+
457
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
458
+
459
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
460
+
461
+
462
+
463
+ Purpose:
464
+ Calculating MAC
465
+
466
+
467
+ Signature/prototype:
468
+ ```java
469
+ byte[] calcMAC(int keyId, byte[] data, int mode)
470
+ ```
471
+
472
+
473
+ Parameters:
474
+ Input
475
+ keyId - MAC Key index
476
+ data - the data to be calculated
477
+ mode - MAC algorithm:
478
+ 0x00: XOR.
479
+ 0x01: ANSI 9.9.
480
+ 0x02: ECB.
481
+ 0x11: ANSI 9.19.
482
+ 0x10: POS_ECB.
483
+ 0x07: CMAC.
484
+ Output
485
+ None
486
+
487
+
488
+ Return value:
489
+ macResult:0x01&0x11:BCD format,0x10:ASCII format.
490
+
491
+
492
+ Simplified example:
493
+ ```java
494
+ byte[] mac = PinPadProviderImpl.getInstance().calcMAC(1, data, 0x11);
495
+ ```
496
+
497
+
498
+ Source details:
499
+ ```text
500
+ Prototype
501
+ byte[] calcMAC(int keyId, byte[] data, int mode)
502
+ Description
503
+ Calculating MAC
504
+ Parameters
505
+ Input
506
+ keyId - MAC Key index
507
+ data - the data to be calculated
508
+ mode - MAC algorithm:
509
+ 0x00: XOR.
510
+ 0x01: ANSI 9.9.
511
+ 0x02: ECB.
512
+ 0x11: ANSI 9.19.
513
+ 0x10: POS_ECB.
514
+ 0x07: CMAC.
515
+ Output
516
+ None
517
+ Return
518
+ macResult:0x01&0x11:BCD format,0x10:ASCII format.
519
+ Remark
520
+ ```
521
+
522
+ ## calculateDes
523
+
524
+ Encrypt Track Data
525
+
526
+ ```java
527
+ int calculateDes(int desMode, int algorithm, int keyType,int keyId, byte[] data, byte[] dataOut)
528
+ ```
529
+
530
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
531
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
532
+ - **源文档章节:** 3.7
533
+
534
+ - Source section: `3.7`
535
+
536
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
537
+
538
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
539
+
540
+
541
+
542
+ Purpose:
543
+ Encrypt Track Data
544
+
545
+
546
+ Signature/prototype:
547
+ ```java
548
+ int calculateDes(int desMode, int algorithm, int keyType,int keyId, byte[] data, byte[] dataOut)
549
+ ```
550
+
551
+
552
+ Parameters:
553
+ Input
554
+ desMode - encryption mode, 0: ENC , 1: DEC.
555
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DesMode.
556
+ algorithm - 1:DES ECB; 2:DES CBC; 3:SM4; 7:AES ECB; 8:AES CBC.
557
+ Refer to com.urovo.sdk.pinpad.utils Constant.Algorithm.
558
+ keyType - the key type.
559
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType
560
+ keyId - the key index
561
+ data - source data
562
+ Output
563
+ dataOut - des result out
564
+
565
+
566
+ Return value:
567
+ 0:success, others:failed.
568
+
569
+
570
+ Source details:
571
+ ```text
572
+ Prototype
573
+ int calculateDes(int desMode, int algorithm, int keyType,int keyId, byte[] data, byte[] dataOut)
574
+ Description
575
+ Encrypt Track Data
576
+ Parameters
577
+ Input
578
+ desMode - encryption mode, 0: ENC , 1: DEC.
579
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DesMode.
580
+ algorithm - 1:DES ECB; 2:DES CBC; 3:SM4; 7:AES ECB; 8:AES CBC.
581
+ Refer to com.urovo.sdk.pinpad.utils Constant.Algorithm.
582
+ keyType - the key type.
583
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType
584
+ keyId - the key index
585
+ data - source data
586
+ Output
587
+ dataOut - des result out
588
+ Return
589
+ 0:success, others:failed.
590
+ Remark
591
+ ```
592
+
593
+ ## downloadKeyDukpt
594
+
595
+ downloadKeyDukpt
596
+
597
+ ```java
598
+ int downloadKeyDukpt(int keyIndex, in byte[] Bdk, int BdkLen, in byte[] Ksn, int KsnLen, in byte[] bsIpek, int bsIpeklength)
599
+ ```
600
+
601
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
602
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
603
+ - **源文档章节:** 3.8
604
+
605
+ - Source section: `3.8`
606
+
607
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
608
+
609
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
610
+
611
+
612
+
613
+ Purpose:
614
+ downloadKeyDukpt
615
+
616
+
617
+ Signature/prototype:
618
+ ```java
619
+ int downloadKeyDukpt(int keyIndex, in byte[] Bdk, int BdkLen, in byte[] Ksn, int KsnLen, in byte[] bsIpek, int bsIpeklength)
620
+ ```
621
+
622
+
623
+ Parameters:
624
+ Input
625
+ keyIndex - index of which key sets(1-4).
626
+ Bdk - BDK data
627
+ BdkLen - The length of Bdk
628
+ ksn - KSN data
629
+ KsnLen - The length of KSN data
630
+ bsIpek - IPEK data
631
+ bsIpeklength - The length of IPEK data
632
+ Output
633
+ None
634
+
635
+
636
+ Return value:
637
+ ErrorCode
638
+
639
+
640
+ Source details:
641
+ ```text
642
+ Prototype
643
+ int downloadKeyDukpt(int keyIndex, in byte[] Bdk, int BdkLen, in byte[] Ksn, int KsnLen, in byte[] bsIpek, int bsIpeklength)
644
+ Description
645
+ downloadKeyDukpt
646
+ Parameters
647
+ Input
648
+ keyIndex - index of which key sets(1-4).
649
+ Bdk - BDK data
650
+ BdkLen - The length of Bdk
651
+ ksn - KSN data
652
+ KsnLen - The length of KSN data
653
+ bsIpek - IPEK data
654
+ bsIpeklength - The length of IPEK data
655
+ Output
656
+ None
657
+ Return
658
+ ErrorCode
659
+ Remark
660
+ ```
661
+
662
+ ## calculateMACOfDUKPTExtend
663
+
664
+ Calculate the MAC under DUKPT(X9.19 Retail MAC)
665
+
666
+ ```java
667
+ int calculateMACOfDUKPTExtend(int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
668
+ ```
669
+
670
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
671
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
672
+ - **源文档章节:** 3.9
673
+
674
+ - Source section: `3.9`
675
+
676
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
677
+
678
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
679
+
680
+
681
+
682
+ Purpose:
683
+ Calculate the MAC under DUKPT(X9.19 Retail MAC)
684
+
685
+
686
+ Signature/prototype:
687
+ ```java
688
+ int calculateMACOfDUKPTExtend(int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
689
+ ```
690
+
691
+
692
+ Parameters:
693
+ Input
694
+ keySetNum - key index.
695
+ rawData - input data
696
+ rawDataLen - The length of rawData
697
+ outData - The MAC result of rawData
698
+ outDataLen - The length of outData
699
+ outKsn - OutKsn Data
700
+ KsnLen - The length of outKsn.
701
+ Output
702
+ None
703
+
704
+
705
+ Return value:
706
+ ErrorCode
707
+
708
+
709
+ Source details:
710
+ ```text
711
+ Prototype
712
+ int calculateMACOfDUKPTExtend(int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
713
+ Description
714
+ Calculate the MAC under DUKPT(X9.19 Retail MAC)
715
+ Parameters
716
+ Input
717
+ keySetNum - key index.
718
+ rawData - input data
719
+ rawDataLen - The length of rawData
720
+ outData - The MAC result of rawData
721
+ outDataLen - The length of outData
722
+ outKsn - OutKsn Data
723
+ KsnLen - The length of outKsn.
724
+ Output
725
+ None
726
+ Return
727
+ ErrorCode
728
+ Remark
729
+ ```
730
+
731
+ ## encryptWithPEK(Deprecated)
732
+
733
+ Basic DUKPT Key encryption function
734
+
735
+ ```java
736
+ int encryptWithPEK(int keyUsage, int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
737
+ ```
738
+
739
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
740
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
741
+ - **源文档章节:** 3.10
742
+
743
+ - Source section: `3.10`
744
+
745
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
746
+
747
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
748
+
749
+
750
+
751
+ Purpose:
752
+ Basic DUKPT Key encryption function
753
+
754
+
755
+ Signature/prototype:
756
+ ```java
757
+ int encryptWithPEK(int keyUsage, int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
758
+ ```
759
+
760
+
761
+ Parameters:
762
+ Input
763
+
764
+ keyUsage:
765
+ * 0x01 - Pin
766
+ * 0x02 - Mac
767
+ * 0x03 - TrackData
768
+ keySetNum - index of which key sets.
769
+ rawData - input data.
770
+ rawDataLen - The length of rawData.
771
+ outData - The encrypt result of rawData
772
+ ( the length of outdata must be (inputlen/8+ 1)*8)
773
+ outDataLen - The length of outData
774
+ outKsn - outKsn data
775
+ KsnLen - The length of outKsn.
776
+ Output
777
+ None
778
+
779
+
780
+ Return value:
781
+ result
782
+
783
+
784
+ Usage notes:
785
+ Suggest using method 3.19 DukptEncrytDataIV.
786
+
787
+
788
+ Source details:
789
+ ```text
790
+ Prototype
791
+ int encryptWithPEK(int keyUsage, int keySetNum, in byte[] rawData, in int rawDataLen, in byte[] outData, in int[] outDataLen, in byte[] outKsn, in int[] KsnLen)
792
+ Description
793
+ Basic DUKPT Key encryption function
794
+ Parameters
795
+ Input
796
+
797
+ keyUsage:
798
+ * 0x01 - Pin
799
+ * 0x02 - Mac
800
+ * 0x03 - TrackData
801
+ keySetNum - index of which key sets.
802
+ rawData - input data.
803
+ rawDataLen - The length of rawData.
804
+ outData - The encrypt result of rawData
805
+ ( the length of outdata must be (inputlen/8+ 1)*8)
806
+ outDataLen - The length of outData
807
+ outKsn - outKsn data
808
+ KsnLen - The length of outKsn.
809
+ Output
810
+ None
811
+ Return
812
+ result
813
+ Remark
814
+ Suggest using method 3.19 DukptEncrytDataIV.
815
+ ```
816
+
817
+ ## getDukptPinBlock
818
+
819
+ Calculate PinBlock under DUKPT
820
+
821
+ ```java
822
+ void GetDukptPinBlock(Bundle bundle, PinInputListener listener)
823
+ ```
824
+
825
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
826
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
827
+ - **源文档章节:** 3.11
828
+
829
+ - Source section: `3.11`
830
+
831
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
832
+
833
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
834
+
835
+
836
+
837
+ Purpose:
838
+ Calculate PinBlock under DUKPT
839
+
840
+
841
+ Signature/prototype:
842
+ ```java
843
+ void GetDukptPinBlock(Bundle bundle, PinInputListener listener)
844
+ ```
845
+
846
+
847
+ Parameters:
848
+ Input
849
+
850
+ OnlinePin(boolean) - isOnline pin
851
+ PINKeyNo(int) - pin key index
852
+ cardNo(String) - card holder number.
853
+
854
+ title(String) - The Title to be displayed on the pinpad
855
+ message(String) - The messge to be displayed on the pinpad
856
+ supportPinLen(String) - default(0, 4,5,6,7,8,9,10,11,12)
857
+ bypass(boolean) - is support bypass
858
+ timeoutMs(long) - enter pin Timeout(ms).
859
+ sound(boolean) - whether play keyboard sound
860
+ FullScreen(boolean) - whether the pinpad is displayed in full screen
861
+ randomKeyboard(boolean) - whether display random number.
862
+ Shortarray meaning of each index(0-6):
863
+ * 0: SECURITY_KEYBOARD_TITLE.
864
+ * 1: SECURITY_KEYBOARD_INFO.
865
+ * 2: SECURITY_KEYBOARD_PASSWORD.
866
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
867
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
868
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
869
+ * 6: SECURITY_KEYBOARD_KEY_OK.
870
+ textSize(shortArray): {10, 10, 10, 10, 10, 10, 10}.
871
+ leftMargin: {10, 10, 10, 10, 10, 10, 10}.
872
+ topMargin: {10, 10, 10, 10, 10, 10, 10}.
873
+ rightMargin: {10, 10, 10, 10, 10, 10, 10}.
874
+ bottomMargin: {10, 10, 10, 10, 10, 10, 10}.
875
+
876
+ IntArray meaning of each index(0-6):
877
+ * 0: SECURITY_KEYBOARD_TITLE.
878
+ * 1: SECURITY_KEYBOARD_INFO.
879
+ * 2: SECURITY_KEYBOARD_PASSWORD.
880
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
881
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
882
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
883
+ * 6: SECURITY_KEYBOARD_KEY_OK.
884
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
885
+
886
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
887
+ * - numberText(StringArray): {0, 1,2,3,4,5,6,7,8,9}.
888
+ * - cancelText: "CANCEL".
889
+ * - deleteText:"DELETE".
890
+ * - okText:"OK".
891
+ listener : The PedInputListener that will be called when a input key event is fired.
892
+ listener : callback listener for pin enter
893
+ PIN input process listener
894
+ Interface PinInputListener {
895
+ /**
896
+ * Button press event
897
+ * @param len - password length entered
898
+ * @param key - the current Key value
899
+ */
900
+ void onInput(int len, int key);
901
+
902
+ /**
903
+ * Called when the user confirms the PIN input
904
+ * @param data - pin code, null when input is empty
905
+ * @param isNonePin - true if the input is empty
906
+ */
907
+ void onConfirm(in byte[] data, boolean isNonePin);
908
+
909
+ /**
910
+ * Called when canceling PIN input
911
+ */
912
+ void onCancel();
913
+ /**
914
+ * Called when PIN input timeOut
915
+ */
916
+ void onTimeOut();
917
+
918
+ /**
919
+ * Callback when wrong
920
+ * @param errorCode - error code
921
+ */
922
+ void onError(int errorCode);
923
+
924
+ /**
925
+ * Called when the user confirms the PIN input
926
+ * @param PinBlock - pinBlock data, null when input is empty
927
+ * @param ksn - ksn data, null when input is empty
928
+ */
929
+ void onConfim_dukpt(byte[] PinBlock, byte[] ksn);
930
+ }
931
+ Output
932
+ None
933
+
934
+
935
+ Source details:
936
+ ```text
937
+ Prototype
938
+ void GetDukptPinBlock(Bundle bundle, PinInputListener listener)
939
+ Description
940
+ Calculate PinBlock under DUKPT
941
+ Parameters
942
+ Input
943
+
944
+ OnlinePin(boolean) - isOnline pin
945
+ PINKeyNo(int) - pin key index
946
+ cardNo(String) - card holder number.
947
+
948
+ title(String) - The Title to be displayed on the pinpad
949
+ message(String) - The messge to be displayed on the pinpad
950
+ supportPinLen(String) - default(0, 4,5,6,7,8,9,10,11,12)
951
+ bypass(boolean) - is support bypass
952
+ timeoutMs(long) - enter pin Timeout(ms).
953
+ sound(boolean) - whether play keyboard sound
954
+ FullScreen(boolean) - whether the pinpad is displayed in full screen
955
+ randomKeyboard(boolean) - whether display random number.
956
+ Shortarray meaning of each index(0-6):
957
+ * 0: SECURITY_KEYBOARD_TITLE.
958
+ * 1: SECURITY_KEYBOARD_INFO.
959
+ * 2: SECURITY_KEYBOARD_PASSWORD.
960
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
961
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
962
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
963
+ * 6: SECURITY_KEYBOARD_KEY_OK.
964
+ textSize(shortArray): {10, 10, 10, 10, 10, 10, 10}.
965
+ leftMargin: {10, 10, 10, 10, 10, 10, 10}.
966
+ topMargin: {10, 10, 10, 10, 10, 10, 10}.
967
+ rightMargin: {10, 10, 10, 10, 10, 10, 10}.
968
+ bottomMargin: {10, 10, 10, 10, 10, 10, 10}.
969
+
970
+ IntArray meaning of each index(0-6):
971
+ * 0: SECURITY_KEYBOARD_TITLE.
972
+ * 1: SECURITY_KEYBOARD_INFO.
973
+ * 2: SECURITY_KEYBOARD_PASSWORD.
974
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
975
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
976
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
977
+ * 6: SECURITY_KEYBOARD_KEY_OK.
978
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
979
+
980
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
981
+ * - numberText(StringArray): {0, 1,2,3,4,5,6,7,8,9}.
982
+ * - cancelText: "CANCEL".
983
+ * - deleteText:"DELETE".
984
+ * - okText:"OK".
985
+ listener : The PedInputListener that will be called when a input key event is fired.
986
+ listener : callback listener for pin enter
987
+ PIN input process listener
988
+ Interface PinInputListener {
989
+ /**
990
+ * Button press event
991
+ * @param len - password length entered
992
+ * @param key - the current Key value
993
+ */
994
+ void onInput(int len, int key);
995
+
996
+ /**
997
+ * Called when the user confirms the PIN input
998
+ * @param data - pin code, null when input is empty
999
+ * @param isNonePin - true if the input is empty
1000
+ */
1001
+ void onConfirm(in byte[] data, boolean isNonePin);
1002
+
1003
+ /**
1004
+ * Called when canceling PIN input
1005
+ */
1006
+ void onCancel();
1007
+ /**
1008
+ * Called when PIN input timeOut
1009
+ */
1010
+ void onTimeOut();
1011
+
1012
+ /**
1013
+ * Callback when wrong
1014
+ * @param errorCode - error code
1015
+ */
1016
+ void onError(int errorCode);
1017
+ Source note: section truncated for chunk size; consult the source document for remaining detailed tables (93 source lines total).
1018
+ ```
1019
+
1020
+ ## getPinBlockEx
1021
+
1022
+ Calculate PinBlock under MK/SK
1023
+
1024
+ ```java
1025
+ void getPinBlockEx(Bundle bundle, PinInputListener listener)
1026
+ ```
1027
+
1028
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1029
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1030
+ - **源文档章节:** 3.12
1031
+
1032
+ - Source section: `3.12`
1033
+
1034
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1035
+
1036
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1037
+
1038
+
1039
+
1040
+ Purpose:
1041
+ Calculate PinBlock under MK/SK
1042
+
1043
+
1044
+ Signature/prototype:
1045
+ ```java
1046
+ void getPinBlockEx(Bundle bundle, PinInputListener listener)
1047
+ ```
1048
+
1049
+
1050
+ Parameters:
1051
+ Input
1052
+
1053
+ onlinePin(boolean) - true-online, false-offline.
1054
+ PINKeyNo(int) - pin key index
1055
+ pinAlgMode(int) - 0-format 0, 1-format 3. (Optional: default is format 0)
1056
+ cardNo(String) - card holder number.
1057
+
1058
+ title(String) - The Title to be displayed on the pinpad.
1059
+ message(String) - The messge to be displayed on the pinpad .
1060
+ supportPinLen (String) - default(0, 4,5,6,7,8,9,10,11,12).
1061
+ bypass(boolean) - is support bypass.
1062
+ timeoutMs(long) - enter pin Timeout(ms).
1063
+ sound(boolean) - whether play keyboard sound.
1064
+ FullScreen(boolean) - whether the pinpad is displayed in full screen.
1065
+ randomKeyboard(boolean) - whether display random number.
1066
+ soundVolume(int) - the volumes of keyboard(1-15).
1067
+ infoLocation(String) - The location of the message:LEFT,CENTER,RIGHT.
1068
+ money(String) - money text
1069
+ randomKeyBoradLocation(boolean) - If true,the vertical position of the key area will automatically change.
1070
+ randomKeyboardStaticLocation(intArray) - The coordinates((X,Y)) of the keyboard area. If the Y=0, setting is invalid.
1071
+ customization - If true, can customize pinpad UI.
1072
+ Refer to the appendix A.
1073
+ strJson(String) - If customization is true, customize the pinpad UI with this paramater.
1074
+ cancelBitmap(Bitmap) - cancel button
1075
+ delBitmap(Bitmap) - delete button
1076
+ okBitemap(Bitmap) - ok button
1077
+ backspaceBitmap(Bitmap) - back button
1078
+ bodyBitmap(Bitmap) - Full screen background image
1079
+ keyBitmap(Bitmap) - Keyboard background image
1080
+ viewBitmap(Bitmap):
1081
+ ShortArray meaning of each index(0-6):
1082
+ * 0: SECURITY_KEYBOARD_TITLE.
1083
+ * 1: SECURITY_KEYBOARD_INFO.
1084
+ * 2: SECURITY_KEYBOARD_PASSWORD.
1085
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
1086
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
1087
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
1088
+ * 6: SECURITY_KEYBOARD_KEY_OK.
1089
+
1090
+ textSize(shortArray): {10, 10, 10, 10, 10, 10, 10}.
1091
+ leftMargin: {10, 10, 10, 10, 10, 10, 10}.
1092
+ topMargin: {10, 10, 10, 10, 10, 10, 10}.
1093
+ rightMargin: {10, 10, 10, 10, 10, 10, 10}.
1094
+ bottomMargin: {10, 10, 10, 10, 10, 10, 10}.
1095
+
1096
+ IntArray meaning of each index(0-6):
1097
+ * 0: SECURITY_KEYBOARD_TITLE.
1098
+ * 1: SECURITY_KEYBOARD_INFO.
1099
+ * 2: SECURITY_KEYBOARD_PASSWORD.
1100
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
1101
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
1102
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
1103
+ * 6: SECURITY_KEYBOARD_KEY_OK.
1104
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
1105
+
1106
+ * - numberText(StringArray): {0, 1,2,3,4,5,6,7,8,9}.
1107
+ * - cancelText: "CANCEL".
1108
+ * - deleteText:"DELETE".
1109
+ * - okText:"OK".
1110
+
1111
+ listener : The PedInputListener that will be called when a input key event is fired.
1112
+ listener : callback listener for pin enter
1113
+ PIN input process listener
1114
+ Interface PinInputListener {
1115
+ /**
1116
+ * Button press event
1117
+ * @param len - password length entered
1118
+ * @param key - the current Key value
1119
+ */
1120
+ void onInput(int len, int key);
1121
+
1122
+ /**
1123
+ * Called when the user confirms the PIN input
1124
+ * @param data - ciphertext pin block(ASCII)
1125
+ * @param isNonePin - true if the input is empty
1126
+ */
1127
+ void onConfirm(in byte[] data, boolean isNonePin);
1128
+
1129
+ /**
1130
+ * Called when canceling PIN input
1131
+ */
1132
+ void onCancel();
1133
+ /**
1134
+ * Called when PIN input timeOut
1135
+ */
1136
+ void onTimeOut();
1137
+
1138
+ /**
1139
+ * Callback when wrong
1140
+ * @param errorCode - error code
1141
+ */
1142
+ void onError(int errorCode);
1143
+
1144
+ /**
1145
+ * Called when the user confirms the PIN input
1146
+ * @param PinBlock - ciphertext pin block(ASCII)
1147
+ * @param ksn - ksn data, null when input is empty
1148
+ */
1149
+ void onConfim_dukpt(byte[] PinBlock, byte[] ksn);
1150
+ }
1151
+ Output
1152
+ None
1153
+
1154
+
1155
+ Simplified example:
1156
+ ```java
1157
+ Bundle args = new Bundle();
1158
+ args.putBoolean("onlinePin", true);
1159
+ args.putInt("PINKeyNo", 1);
1160
+ args.putString("cardNo", pan);
1161
+ args.putString("supportPinLen", "0,4,5,6");
1162
+ args.putLong("timeoutMs", 30000L);
1163
+ PinPadProviderImpl.getInstance().getPinBlockEx(args, listener);
1164
+ ```
1165
+
1166
+
1167
+ Source details:
1168
+ ```text
1169
+ Prototype
1170
+ void getPinBlockEx(Bundle bundle, PinInputListener listener)
1171
+ Description
1172
+ Calculate PinBlock under MK/SK
1173
+ Parameters
1174
+ Input
1175
+
1176
+ onlinePin(boolean) - true-online, false-offline.
1177
+ PINKeyNo(int) - pin key index
1178
+ pinAlgMode(int) - 0-format 0, 1-format 3. (Optional: default is format 0)
1179
+ cardNo(String) - card holder number.
1180
+
1181
+ title(String) - The Title to be displayed on the pinpad.
1182
+ message(String) - The messge to be displayed on the pinpad .
1183
+ supportPinLen (String) - default(0, 4,5,6,7,8,9,10,11,12).
1184
+ bypass(boolean) - is support bypass.
1185
+ timeoutMs(long) - enter pin Timeout(ms).
1186
+ sound(boolean) - whether play keyboard sound.
1187
+ FullScreen(boolean) - whether the pinpad is displayed in full screen.
1188
+ randomKeyboard(boolean) - whether display random number.
1189
+ soundVolume(int) - the volumes of keyboard(1-15).
1190
+ infoLocation(String) - The location of the message:LEFT,CENTER,RIGHT.
1191
+ money(String) - money text
1192
+ randomKeyBoradLocation(boolean) - If true,the vertical position of the key area will automatically change.
1193
+ randomKeyboardStaticLocation(intArray) - The coordinates((X,Y)) of the keyboard area. If the Y=0, setting is invalid.
1194
+ customization - If true, can customize pinpad UI.
1195
+ Refer to the appendix A.
1196
+ strJson(String) - If customization is true, customize the pinpad UI with this paramater.
1197
+ cancelBitmap(Bitmap) - cancel button
1198
+ delBitmap(Bitmap) - delete button
1199
+ okBitemap(Bitmap) - ok button
1200
+ backspaceBitmap(Bitmap) - back button
1201
+ bodyBitmap(Bitmap) - Full screen background image
1202
+ keyBitmap(Bitmap) - Keyboard background image
1203
+ viewBitmap(Bitmap):
1204
+ ShortArray meaning of each index(0-6):
1205
+ * 0: SECURITY_KEYBOARD_TITLE.
1206
+ * 1: SECURITY_KEYBOARD_INFO.
1207
+ * 2: SECURITY_KEYBOARD_PASSWORD.
1208
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
1209
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
1210
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
1211
+ * 6: SECURITY_KEYBOARD_KEY_OK.
1212
+
1213
+ textSize(shortArray): {10, 10, 10, 10, 10, 10, 10}.
1214
+ leftMargin: {10, 10, 10, 10, 10, 10, 10}.
1215
+ topMargin: {10, 10, 10, 10, 10, 10, 10}.
1216
+ rightMargin: {10, 10, 10, 10, 10, 10, 10}.
1217
+ bottomMargin: {10, 10, 10, 10, 10, 10, 10}.
1218
+
1219
+ IntArray meaning of each index(0-6):
1220
+ * 0: SECURITY_KEYBOARD_TITLE.
1221
+ * 1: SECURITY_KEYBOARD_INFO.
1222
+ * 2: SECURITY_KEYBOARD_PASSWORD.
1223
+ * 3: SECURITY_KEYBOARD_KEY_NUMBER.
1224
+ * 4: SECURITY_KEYBOARD_KEY_CANCEL.
1225
+ * 5: SECURITY_KEYBOARD_KEY_DELETE.
1226
+ * 6: SECURITY_KEYBOARD_KEY_OK.
1227
+ backgroundColor(IntArray):{ xff0C9213, 0xff0C9213, 0, 0, 0xFFFF0000, 0xffFFFE00, 0xff0C9213}.
1228
+
1229
+ * - numberText(StringArray): {0, 1,2,3,4,5,6,7,8,9}.
1230
+ * - cancelText: "CANCEL".
1231
+ * - deleteText:"DELETE".
1232
+ * - okText:"OK".
1233
+
1234
+ listener : The PedInputListener that will be called when a input key event is fired.
1235
+ listener : callback listener for pin enter
1236
+ PIN input process listener
1237
+ Interface PinInputListener {
1238
+ /**
1239
+ * Button press event
1240
+ * @param len - password length entered
1241
+ * @param key - the current Key value
1242
+ */
1243
+ void onInput(int len, int key);
1244
+
1245
+ /**
1246
+ * Called when the user confirms the PIN input
1247
+ * @param data - ciphertext pin block(ASCII)
1248
+ * @param isNonePin - true if the input is empty
1249
+ Source note: section truncated for chunk size; consult the source document for remaining detailed tables (110 source lines total).
1250
+ ```
1251
+
1252
+ ## getRSAPublicKeyModel
1253
+
1254
+ Obtain RSA Public key Exponent and Modulus
1255
+
1256
+ ```java
1257
+ boolean getRSAPublicKeyModel(byte[] publickey, int[] publickeyLen,
1258
+ int[] exponent)
1259
+ ```
1260
+
1261
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1262
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1263
+ - **源文档章节:** 3.13
1264
+
1265
+ - Source section: `3.13`
1266
+
1267
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1268
+
1269
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1270
+
1271
+
1272
+
1273
+ Purpose:
1274
+ Obtain RSA Public key Exponent and Modulus
1275
+
1276
+
1277
+ Signature/prototype:
1278
+ ```java
1279
+ boolean getRSAPublicKeyModel(byte[] publickey, int[] publickeyLen,
1280
+ int[] exponent)
1281
+ ```
1282
+
1283
+
1284
+ Parameters:
1285
+ Input
1286
+
1287
+ Publickey - Public Key Modulus Byte Array
1288
+ publickeyLen - Length of Public Key Modulus Byte Array
1289
+ Exponent - RSA Exponent
1290
+ Output
1291
+ None
1292
+
1293
+
1294
+ Return value:
1295
+ true:success, false:failed.
1296
+
1297
+
1298
+ Source details:
1299
+ ```text
1300
+ Prototype
1301
+ boolean getRSAPublicKeyModel(byte[] publickey, int[] publickeyLen,
1302
+ int[] exponent)
1303
+ Description
1304
+ Obtain RSA Public key Exponent and Modulus
1305
+ Parameters
1306
+ Input
1307
+
1308
+ Publickey - Public Key Modulus Byte Array
1309
+ publickeyLen - Length of Public Key Modulus Byte Array
1310
+ Exponent - RSA Exponent
1311
+ Output
1312
+ None
1313
+ Return
1314
+ true:success, false:failed.
1315
+ Remark
1316
+ ```
1317
+
1318
+ ## loadDukptBlob
1319
+
1320
+ Decrypt Dukpt and Load The Key Into The Terminal.
1321
+ Source key data format:
1322
+ type(1 bytes)+keyId(3 bytes)+ipek(16 bytes)+ksn(10 bytes).
1323
+
1324
+ ```java
1325
+ int loadDukptBlob(int keySlot, byte[] blob, int blobLen)
1326
+ ```
1327
+
1328
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1329
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1330
+ - **源文档章节:** 3.14
1331
+
1332
+ - Source section: `3.14`
1333
+
1334
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1335
+
1336
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1337
+
1338
+
1339
+
1340
+ Purpose:
1341
+ Decrypt Dukpt and Load The Key Into The Terminal.
1342
+ Source key data format:
1343
+ type(1 bytes)+keyId(3 bytes)+ipek(16 bytes)+ksn(10 bytes).
1344
+
1345
+
1346
+ Signature/prototype:
1347
+ ```java
1348
+ int loadDukptBlob(int keySlot, byte[] blob, int blobLen)
1349
+ ```
1350
+
1351
+
1352
+ Parameters:
1353
+ Input
1354
+
1355
+ keySlot - Dukpt keytype
1356
+ Blob - The Encrypted Data
1357
+ blobLen - Length of The Encrypted Data
1358
+ Output
1359
+ None
1360
+
1361
+
1362
+ Return value:
1363
+ 0:success, others:failed
1364
+
1365
+
1366
+ Source details:
1367
+ ```text
1368
+ Prototype
1369
+ int loadDukptBlob(int keySlot, byte[] blob, int blobLen)
1370
+ Description
1371
+ Decrypt Dukpt and Load The Key Into The Terminal.
1372
+ Source key data format:
1373
+ type(1 bytes)+keyId(3 bytes)+ipek(16 bytes)+ksn(10 bytes).
1374
+ Parameters
1375
+ Input
1376
+
1377
+ keySlot - Dukpt keytype
1378
+ Blob - The Encrypted Data
1379
+ blobLen - Length of The Encrypted Data
1380
+ Output
1381
+ None
1382
+ Return
1383
+ 0:success, others:failed
1384
+ Remark
1385
+ ```
1386
+
1387
+ ## DukptGetKsn
1388
+
1389
+ getKsn
1390
+
1391
+ ```java
1392
+ int DukptGetKsn(int keySetNum, byte[] outKsn);
1393
+ ```
1394
+
1395
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1396
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1397
+ - **源文档章节:** 3.15
1398
+
1399
+ - Source section: `3.15`
1400
+
1401
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1402
+
1403
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1404
+
1405
+
1406
+
1407
+ Purpose:
1408
+ getKsn
1409
+
1410
+
1411
+ Signature/prototype:
1412
+ ```java
1413
+ int DukptGetKsn(int keySetNum, byte[] outKsn);
1414
+ ```
1415
+
1416
+
1417
+ Parameters:
1418
+ Input
1419
+ keySetNum - keyIndex, 1-4
1420
+ Output
1421
+ outKsn - the ksn value
1422
+
1423
+
1424
+ Return value:
1425
+ 0:success , others:failed
1426
+
1427
+
1428
+ Source details:
1429
+ ```text
1430
+ Prototype
1431
+ int DukptGetKsn(int keySetNum, byte[] outKsn);
1432
+ Description
1433
+ getKsn
1434
+ Parameters
1435
+ Input
1436
+ keySetNum - keyIndex, 1-4
1437
+ Output
1438
+ outKsn - the ksn value
1439
+ Return
1440
+ 0:success , others:failed
1441
+ Remark
1442
+ ```
1443
+
1444
+ ## DiversifiedKey
1445
+
1446
+ Generate new pin key before starting pin input.(3DES ECB)
1447
+
1448
+ ```java
1449
+ int diversifiedKey(int masterkeyIndex, int sourceKeyIndex, int destKeyIndex, String diversifyingData);
1450
+ ```
1451
+
1452
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1453
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1454
+ - **源文档章节:** 3.16
1455
+
1456
+ - Source section: `3.16`
1457
+
1458
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1459
+
1460
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1461
+
1462
+
1463
+
1464
+ Purpose:
1465
+ Generate new pin key before starting pin input.(3DES ECB)
1466
+
1467
+
1468
+ Signature/prototype:
1469
+ ```java
1470
+ int diversifiedKey(int masterkeyIndex, int sourceKeyIndex, int destKeyIndex, String diversifyingData);
1471
+ ```
1472
+
1473
+
1474
+ Parameters:
1475
+ Input
1476
+ masterkeyIndex - master key index
1477
+ sourceKeyIndex - soruce pin key index
1478
+ destKeyIndex - new pin key index
1479
+ diversifyingData - the data used to generate the new key.(32 hex string)
1480
+ Output
1481
+ outKsn - the ksn value
1482
+
1483
+
1484
+ Return value:
1485
+ 0:success, others:failed
1486
+
1487
+
1488
+ Source details:
1489
+ ```text
1490
+ Prototype
1491
+ int diversifiedKey(int masterkeyIndex, int sourceKeyIndex, int destKeyIndex, String diversifyingData);
1492
+ Description
1493
+ Generate new pin key before starting pin input.(3DES ECB)
1494
+ Parameters
1495
+ Input
1496
+ masterkeyIndex - master key index
1497
+ sourceKeyIndex - soruce pin key index
1498
+ destKeyIndex - new pin key index
1499
+ diversifyingData - the data used to generate the new key.(32 hex string)
1500
+ Output
1501
+ outKsn - the ksn value
1502
+ Return
1503
+ 0:success, others:failed
1504
+ Remark
1505
+ ```
1506
+
1507
+ ## genKeyHashValue
1508
+
1509
+ Do SHA-256 hashing with key.
1510
+
1511
+ ```java
1512
+ int genKeyHashValue(int KeyUsage, int KeyNo, byte[] DataIn, int DataInLen,
1513
+ byte[] ResponseData, byte[] ResLen)
1514
+ ```
1515
+
1516
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1517
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1518
+ - **源文档章节:** 3.17
1519
+
1520
+ - Source section: `3.17`
1521
+
1522
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1523
+
1524
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1525
+
1526
+
1527
+
1528
+ Purpose:
1529
+ Do SHA-256 hashing with key.
1530
+
1531
+
1532
+ Signature/prototype:
1533
+ ```java
1534
+ int genKeyHashValue(int KeyUsage, int KeyNo, byte[] DataIn, int DataInLen,
1535
+ byte[] ResponseData, byte[] ResLen)
1536
+ ```
1537
+
1538
+
1539
+ Parameters:
1540
+ Input
1541
+ keyUsage - keyType
1542
+ keyType - key type
1543
+ - 0-Main key
1544
+ - 1-MAC key
1545
+ - 2-PIN key
1546
+ - 3-TD key
1547
+
1548
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType
1549
+ KeyNo - key index
1550
+ DataIn - source data.
1551
+ DataInLen - the length of source data
1552
+ Output
1553
+ ResponseData - response data.
1554
+
1555
+ ResLen: the length of response data. Length = ResLen[0].
1556
+
1557
+
1558
+ Return value:
1559
+ 0:success, others:failed
1560
+
1561
+
1562
+ Source details:
1563
+ ```text
1564
+ Prototype
1565
+ int genKeyHashValue(int KeyUsage, int KeyNo, byte[] DataIn, int DataInLen,
1566
+ byte[] ResponseData, byte[] ResLen)
1567
+ Description
1568
+ Do SHA-256 hashing with key.
1569
+ Parameters
1570
+ Input
1571
+ keyUsage - keyType
1572
+ keyType - key type
1573
+ - 0-Main key
1574
+ - 1-MAC key
1575
+ - 2-PIN key
1576
+ - 3-TD key
1577
+
1578
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType
1579
+ KeyNo - key index
1580
+ DataIn - source data.
1581
+ DataInLen - the length of source data
1582
+ Output
1583
+ ResponseData - response data.
1584
+
1585
+ ResLen: the length of response data. Length = ResLen[0].
1586
+ Return
1587
+ 0:success, others:failed
1588
+ Remark
1589
+ ```
1590
+
1591
+ ## EndPinInputEvent
1592
+
1593
+ Close the PIN pad
1594
+
1595
+ ```java
1596
+ void EndPinInputEvent(int Event)
1597
+ ```
1598
+
1599
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1600
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1601
+ - **源文档章节:** 3.18
1602
+
1603
+ - Source section: `3.18`
1604
+
1605
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1606
+
1607
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1608
+
1609
+
1610
+
1611
+ Purpose:
1612
+ Close the PIN pad
1613
+
1614
+
1615
+ Signature/prototype:
1616
+ ```java
1617
+ void EndPinInputEvent(int Event)
1618
+ ```
1619
+
1620
+
1621
+ Parameters:
1622
+ Input
1623
+ Event - the oparation code.(16 -cancel)
1624
+ Output
1625
+ None
1626
+
1627
+
1628
+ Return value:
1629
+ None
1630
+
1631
+
1632
+ Source details:
1633
+ ```text
1634
+ Prototype
1635
+ void EndPinInputEvent(int Event)
1636
+ Description
1637
+ Close the PIN pad
1638
+ Parameters
1639
+ Input
1640
+ Event - the oparation code.(16 -cancel)
1641
+ Output
1642
+ None
1643
+ Return
1644
+ None
1645
+ Remark
1646
+ ```
1647
+
1648
+ ## DukptEncrytDataIV
1649
+
1650
+ DUKPT encryption and decryption.
1651
+
1652
+ ```java
1653
+ int DukptEncryptDataIV(int keyUsage, int keyIndex, int encMode, in byte[] iv,
1654
+ int ivLen, byte[] dataIn, int inLen, byte[] dataOut, int[] outLen, byte[] outKsn,
1655
+ int[] KsnLen)
1656
+ ```
1657
+
1658
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1659
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1660
+ - **源文档章节:** 3.19
1661
+
1662
+ - Source section: `3.19`
1663
+
1664
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1665
+
1666
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1667
+
1668
+
1669
+
1670
+ Purpose:
1671
+ DUKPT encryption and decryption.
1672
+
1673
+
1674
+ Signature/prototype:
1675
+ ```java
1676
+ int DukptEncryptDataIV(int keyUsage, int keyIndex, int encMode, in byte[] iv,
1677
+ int ivLen, byte[] dataIn, int inLen, byte[] dataOut, int[] outLen, byte[] outKsn,
1678
+ int[] KsnLen)
1679
+ ```
1680
+
1681
+
1682
+ Parameters:
1683
+ Input
1684
+
1685
+ keyUsage:
1686
+ * 0x01 - Pin
1687
+ * 0x02 - Mac
1688
+ * 0x03 - TrackData
1689
+ * 0x04 - Mac
1690
+ keySetNum : index of which key sets.
1691
+ encMode:
1692
+ When keyType = 1/2/3:
1693
+ * 0x00: ecb encryption.
1694
+ * 0x01: cbc encryption.
1695
+ * 0x10: ecb decryption.
1696
+ * 0x11: cbc decryption.
1697
+
1698
+ When keyType = 4:
1699
+ bit 2-5: mac algorithm 0-5.
1700
+ bit 6-7: encryption type, 0-ASE, 1-TDES.
1701
+ iv - the initial vector,default:new byte[8].
1702
+ ivLen - The length of initial vector.
1703
+ dataIn - input data.
1704
+ inLen - The length of rawData.
1705
+ Output
1706
+ outData - The encrypt result of rawData
1707
+ (the length of outdata must be (inputlen/8+ 1)*8)
1708
+
1709
+ outDataLen - The length of outData.
1710
+
1711
+ outKsn - outKsn data(10-bytes).
1712
+
1713
+ KsnLen - The length of outKsn.
1714
+
1715
+
1716
+ Return value:
1717
+ 0-success, others-failed.
1718
+
1719
+
1720
+ Source details:
1721
+ ```text
1722
+ Prototype
1723
+ int DukptEncryptDataIV(int keyUsage, int keyIndex, int encMode, in byte[] iv,
1724
+ int ivLen, byte[] dataIn, int inLen, byte[] dataOut, int[] outLen, byte[] outKsn,
1725
+ int[] KsnLen)
1726
+ Description
1727
+ DUKPT encryption and decryption.
1728
+ Parameters
1729
+ Input
1730
+
1731
+ keyUsage:
1732
+ * 0x01 - Pin
1733
+ * 0x02 - Mac
1734
+ * 0x03 - TrackData
1735
+ * 0x04 - Mac
1736
+ keySetNum : index of which key sets.
1737
+ encMode:
1738
+ When keyType = 1/2/3:
1739
+ * 0x00: ecb encryption.
1740
+ * 0x01: cbc encryption.
1741
+ * 0x10: ecb decryption.
1742
+ * 0x11: cbc decryption.
1743
+
1744
+ When keyType = 4:
1745
+ bit 2-5: mac algorithm 0-5.
1746
+ bit 6-7: encryption type, 0-ASE, 1-TDES.
1747
+ iv - the initial vector,default:new byte[8].
1748
+ ivLen - The length of initial vector.
1749
+ dataIn - input data.
1750
+ inLen - The length of rawData.
1751
+ Output
1752
+ outData - The encrypt result of rawData
1753
+ (the length of outdata must be (inputlen/8+ 1)*8)
1754
+
1755
+ outDataLen - The length of outData.
1756
+
1757
+ outKsn - outKsn data(10-bytes).
1758
+
1759
+ KsnLen - The length of outKsn.
1760
+ Return
1761
+ 0-success, others-failed.
1762
+ Remark
1763
+ ```
1764
+
1765
+ ## deleteKey(MK/SK)
1766
+
1767
+ Delete the key (only for MK/SK).
1768
+
1769
+ ```java
1770
+ Int deleteKey(int keyType, int keyId)
1771
+ ```
1772
+
1773
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1774
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1775
+ - **源文档章节:** 3.20
1776
+
1777
+ - Source section: `3.20`
1778
+
1779
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1780
+
1781
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1782
+
1783
+
1784
+
1785
+ Purpose:
1786
+ Delete the key (only for MK/SK).
1787
+
1788
+
1789
+ Signature/prototype:
1790
+ ```java
1791
+ Int deleteKey(int keyType, int keyId)
1792
+ ```
1793
+
1794
+
1795
+ Parameters:
1796
+ Input
1797
+ keyType - key type
1798
+ - 0-Main key
1799
+ - 1-MAC key
1800
+ - 2-PIN key
1801
+ - 3-TD key
1802
+
1803
+ Refer to Constant.KeyType.
1804
+
1805
+ keyId - the index of the key.
1806
+ Output
1807
+ None
1808
+
1809
+
1810
+ Return value:
1811
+ 0:success, 23:key is not exist, others:failed.
1812
+
1813
+
1814
+ Source details:
1815
+ ```text
1816
+ Prototype
1817
+ Int deleteKey(int keyType, int keyId)
1818
+ Description
1819
+ Delete the key (only for MK/SK).
1820
+ Parameters
1821
+ Input
1822
+ keyType - key type
1823
+ - 0-Main key
1824
+ - 1-MAC key
1825
+ - 2-PIN key
1826
+ - 3-TD key
1827
+
1828
+ Refer to Constant.KeyType.
1829
+
1830
+ keyId - the index of the key.
1831
+ Output
1832
+ None
1833
+ Return
1834
+ 0:success, 23:key is not exist, others:failed.
1835
+ Remark
1836
+ ```
1837
+
1838
+ ## setKeyAlgorithm
1839
+
1840
+ Set Key Algorithm.
1841
+
1842
+ ```java
1843
+ void setKeyAlgorithm(int algorithm)
1844
+ ```
1845
+
1846
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1847
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1848
+ - **源文档章节:** 3.21
1849
+
1850
+ - Source section: `3.21`
1851
+
1852
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1853
+
1854
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1855
+
1856
+
1857
+
1858
+ Purpose:
1859
+ Set Key Algorithm.
1860
+
1861
+
1862
+ Signature/prototype:
1863
+ ```java
1864
+ void setKeyAlgorithm(int algorithm)
1865
+ ```
1866
+
1867
+
1868
+ Parameters:
1869
+ Input
1870
+ algorithm- key algorithm
1871
+ - 0-Des
1872
+ - 1-SM4
1873
+ - 2-AES
1874
+
1875
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyAlgorithm.
1876
+ Output
1877
+ None
1878
+
1879
+
1880
+ Return value:
1881
+ None
1882
+
1883
+
1884
+ Source details:
1885
+ ```text
1886
+ Prototype
1887
+ void setKeyAlgorithm(int algorithm)
1888
+ Description
1889
+ Set Key Algorithm.
1890
+ Parameters
1891
+ Input
1892
+ algorithm- key algorithm
1893
+ - 0-Des
1894
+ - 1-SM4
1895
+ - 2-AES
1896
+
1897
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyAlgorithm.
1898
+ Output
1899
+ None
1900
+ Return
1901
+ None
1902
+ Remark
1903
+ ```
1904
+
1905
+ ## DukptAesInitial
1906
+
1907
+ Inject the AES BDK or Initial KEY (AES-128,AES-192,AES-256)
1908
+
1909
+ ```java
1910
+ int DukptAesInitial(int keyIndex, byte[] Bdk, int BdkLen, byte[] Ipek, int IpekLen,
1911
+ int DeriveKeyType, byte[] Ksn, int ksnLen)
1912
+ ```
1913
+
1914
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1915
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1916
+ - **源文档章节:** 3.22
1917
+
1918
+ - Source section: `3.22`
1919
+
1920
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1921
+
1922
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1923
+
1924
+
1925
+
1926
+ Purpose:
1927
+ Inject the AES BDK or Initial KEY (AES-128,AES-192,AES-256)
1928
+
1929
+
1930
+ Signature/prototype:
1931
+ ```java
1932
+ int DukptAesInitial(int keyIndex, byte[] Bdk, int BdkLen, byte[] Ipek, int IpekLen,
1933
+ int DeriveKeyType, byte[] Ksn, int ksnLen)
1934
+ ```
1935
+
1936
+
1937
+ Parameters:
1938
+ Input
1939
+ keyIndex - key index(1-4)
1940
+ DeriveKeyType -
1941
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
1942
+ Output
1943
+ None
1944
+
1945
+
1946
+ Return value:
1947
+ 0-success, others-failed.
1948
+
1949
+
1950
+ Source details:
1951
+ ```text
1952
+ Prototype
1953
+ int DukptAesInitial(int keyIndex, byte[] Bdk, int BdkLen, byte[] Ipek, int IpekLen,
1954
+ int DeriveKeyType, byte[] Ksn, int ksnLen)
1955
+ Description
1956
+ Inject the AES BDK or Initial KEY (AES-128,AES-192,AES-256)
1957
+ Parameters
1958
+ Input
1959
+ keyIndex - key index(1-4)
1960
+ DeriveKeyType -
1961
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
1962
+ Output
1963
+ None
1964
+ Return
1965
+ 0-success, others-failed.
1966
+ Remark
1967
+ ```
1968
+
1969
+ ## DukptAesGetKsn
1970
+
1971
+ Get the current KSN for AES DUKPT
1972
+
1973
+ ```java
1974
+ int DukptAesGetKsn(int keyIndex, byte[] outKsn)
1975
+ ```
1976
+
1977
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
1978
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
1979
+ - **源文档章节:** 3.23
1980
+
1981
+ - Source section: `3.23`
1982
+
1983
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
1984
+
1985
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
1986
+
1987
+
1988
+
1989
+ Purpose:
1990
+ Get the current KSN for AES DUKPT
1991
+
1992
+
1993
+ Signature/prototype:
1994
+ ```java
1995
+ int DukptAesGetKsn(int keyIndex, byte[] outKsn)
1996
+ ```
1997
+
1998
+
1999
+ Parameters:
2000
+ Input
2001
+ keyIndex - key index(1-4)
2002
+ Output
2003
+ outKsn - 12 bytes.
2004
+
2005
+
2006
+ Return value:
2007
+ 0-success
2008
+
2009
+
2010
+ Source details:
2011
+ ```text
2012
+ Prototype
2013
+ int DukptAesGetKsn(int keyIndex, byte[] outKsn)
2014
+ Description
2015
+ Get the current KSN for AES DUKPT
2016
+ Parameters
2017
+ Input
2018
+ keyIndex - key index(1-4)
2019
+ Output
2020
+ outKsn - 12 bytes.
2021
+ Return
2022
+ 0-success
2023
+ Remark
2024
+ ```
2025
+
2026
+ ## DukptAesUpdateKsn
2027
+
2028
+ Generate the New KSN for AES DUKPT (KSN counter will add 1)
2029
+
2030
+ ```java
2031
+ int DukptAesUpdateKsn(int keyIndex, byte[] outKsn)
2032
+ ```
2033
+
2034
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2035
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2036
+ - **源文档章节:** 3.24
2037
+
2038
+ - Source section: `3.24`
2039
+
2040
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2041
+
2042
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2043
+
2044
+
2045
+
2046
+ Purpose:
2047
+ Generate the New KSN for AES DUKPT (KSN counter will add 1)
2048
+
2049
+
2050
+ Signature/prototype:
2051
+ ```java
2052
+ int DukptAesUpdateKsn(int keyIndex, byte[] outKsn)
2053
+ ```
2054
+
2055
+
2056
+ Parameters:
2057
+ Input
2058
+ keyIndex - key index(1-4)
2059
+ Output
2060
+ outKsn - 12 bytes
2061
+
2062
+
2063
+ Return value:
2064
+ 0-success
2065
+
2066
+
2067
+ Source details:
2068
+ ```text
2069
+ Prototype
2070
+ int DukptAesUpdateKsn(int keyIndex, byte[] outKsn)
2071
+ Description
2072
+ Generate the New KSN for AES DUKPT (KSN counter will add 1)
2073
+ Parameters
2074
+ Input
2075
+ keyIndex - key index(1-4)
2076
+ Output
2077
+ outKsn - 12 bytes
2078
+ Return
2079
+ 0-success
2080
+ Remark
2081
+ ```
2082
+
2083
+ ## DukptAesEncryptDataIV
2084
+
2085
+ Use Dukpt-Aes to encrypt data or calc MAC.
2086
+
2087
+ ```java
2088
+ int DukptAesEncryptDataIV(int keyType, int keyIndex, int encMode,
2089
+ int workkeytype, byte[] iv, int ivLen, byte[] dataIn, int inLen, byte[] dataOut,
2090
+ int[] outLen, byte[] outKsn, int[] KsnLen)
2091
+ ```
2092
+
2093
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2094
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2095
+ - **源文档章节:** 3.25
2096
+
2097
+ - Source section: `3.25`
2098
+
2099
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2100
+
2101
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2102
+
2103
+
2104
+
2105
+ Purpose:
2106
+ Use Dukpt-Aes to encrypt data or calc MAC.
2107
+
2108
+
2109
+ Signature/prototype:
2110
+ ```java
2111
+ int DukptAesEncryptDataIV(int keyType, int keyIndex, int encMode,
2112
+ int workkeytype, byte[] iv, int ivLen, byte[] dataIn, int inLen, byte[] dataOut,
2113
+ int[] outLen, byte[] outKsn, int[] KsnLen)
2114
+ ```
2115
+
2116
+
2117
+ Parameters:
2118
+ Input
2119
+ keyType - Key type for Alg
2120
+ bit0~7:
2121
+ 0x01 - Pin;
2122
+ 0x02 - Mac;
2123
+ 0x03 - TrackData.
2124
+ bit8~15:
2125
+ when bit0~7=1 Pin
2126
+ 0x00 // Encrypt a PIN message
2127
+ when bit0~7=2 Mac
2128
+ 0x00, // MAC code verification
2129
+ 0x01, // MAC code generation
2130
+ 0x02, // Two-way message authentication
2131
+ when bit0~7=3 TrackData
2132
+ 0x00, // Data encryption
2133
+ 0x01, // Data decryption
2134
+ 0x02, // Two-way data encryption
2135
+ keyIndex - key index(1-4).
2136
+ encMode - 1bytes
2137
+ when Keytype=1,encmode:
2138
+ 0x00: format0
2139
+ 0x01: format1
2140
+ 0x02: format2
2141
+ 0x03: format3
2142
+ 0x04: format4
2143
+ when Keytype=3,encmode:
2144
+ 0x00: ecb encode.
2145
+ 0x01: cbc encode.
2146
+ 0x10: ecb decode.
2147
+ 0x11: cbc decode.
2148
+ when Keytype=2, encmode:
2149
+ mac alg
2150
+ 0x01: MAC_ALG_X9_19.
2151
+ 0x02: MAC_ALG_ISO_9797_1_MAC_ALG5.
2152
+ 0x03: CMAC.
2153
+ workkeytype- com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
2154
+ _2TDEA = 0
2155
+ _3TDEA = 1
2156
+ _AES128 = 2
2157
+ _AES192 = 3
2158
+ _AES256 = 4
2159
+ iv - the initial vector,default:new byte[16].
2160
+ ivLen - The length of initial vector.
2161
+ dataIn - input data.
2162
+ inLen - The length of rawData.
2163
+ Output
2164
+ dataOut - The encrypt result of rawData.
2165
+ outLen - The length of outData.
2166
+ outKsn - outKsn data(12-bytes).
2167
+ outLen - The length of outData.
2168
+
2169
+
2170
+ Return value:
2171
+ 0-success
2172
+
2173
+
2174
+ Source details:
2175
+ ```text
2176
+ Prototype
2177
+ int DukptAesEncryptDataIV(int keyType, int keyIndex, int encMode,
2178
+ int workkeytype, byte[] iv, int ivLen, byte[] dataIn, int inLen, byte[] dataOut,
2179
+ int[] outLen, byte[] outKsn, int[] KsnLen)
2180
+ Description
2181
+ Use Dukpt-Aes to encrypt data or calc MAC.
2182
+ Parameters
2183
+ Input
2184
+ keyType - Key type for Alg
2185
+ bit0~7:
2186
+ 0x01 - Pin;
2187
+ 0x02 - Mac;
2188
+ 0x03 - TrackData.
2189
+ bit8~15:
2190
+ when bit0~7=1 Pin
2191
+ 0x00 // Encrypt a PIN message
2192
+ when bit0~7=2 Mac
2193
+ 0x00, // MAC code verification
2194
+ 0x01, // MAC code generation
2195
+ 0x02, // Two-way message authentication
2196
+ when bit0~7=3 TrackData
2197
+ 0x00, // Data encryption
2198
+ 0x01, // Data decryption
2199
+ 0x02, // Two-way data encryption
2200
+ keyIndex - key index(1-4).
2201
+ encMode - 1bytes
2202
+ when Keytype=1,encmode:
2203
+ 0x00: format0
2204
+ 0x01: format1
2205
+ 0x02: format2
2206
+ 0x03: format3
2207
+ 0x04: format4
2208
+ when Keytype=3,encmode:
2209
+ 0x00: ecb encode.
2210
+ 0x01: cbc encode.
2211
+ 0x10: ecb decode.
2212
+ 0x11: cbc decode.
2213
+ when Keytype=2, encmode:
2214
+ mac alg
2215
+ 0x01: MAC_ALG_X9_19.
2216
+ 0x02: MAC_ALG_ISO_9797_1_MAC_ALG5.
2217
+ 0x03: CMAC.
2218
+ workkeytype- com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
2219
+ _2TDEA = 0
2220
+ _3TDEA = 1
2221
+ _AES128 = 2
2222
+ _AES192 = 3
2223
+ _AES256 = 4
2224
+ iv - the initial vector,default:new byte[16].
2225
+ ivLen - The length of initial vector.
2226
+ dataIn - input data.
2227
+ inLen - The length of rawData.
2228
+ Output
2229
+ dataOut - The encrypt result of rawData.
2230
+ outLen - The length of outData.
2231
+ outKsn - outKsn data(12-bytes).
2232
+ outLen - The length of outData.
2233
+ Return
2234
+ 0-success
2235
+ Remark
2236
+ ```
2237
+
2238
+ ## GetDukptAesPinBlock
2239
+
2240
+ Calculate PinBlock under DUKPT AES , like as GetDukptPinBlock.
2241
+
2242
+ ```java
2243
+ void GetDukptAesPinBlock(Bundle bundle, final PinInputListener pinInputListener)
2244
+ ```
2245
+
2246
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2247
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2248
+ - **源文档章节:** 3.26
2249
+
2250
+ - Source section: `3.26`
2251
+
2252
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2253
+
2254
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2255
+
2256
+
2257
+
2258
+ Purpose:
2259
+ Calculate PinBlock under DUKPT AES , like as GetDukptPinBlock.
2260
+
2261
+
2262
+ Signature/prototype:
2263
+ ```java
2264
+ void GetDukptAesPinBlock(Bundle bundle, final PinInputListener pinInputListener)
2265
+ ```
2266
+
2267
+
2268
+ Parameters:
2269
+ Input
2270
+ Same as GetDukptPinBlock parameters
2271
+ Add:
2272
+ WorkKeyType(int) - com.urovo.sdk.pinpad.utils.Constant.DukptKeyType
2273
+ Output
2274
+
2275
+
2276
+ Source details:
2277
+ ```text
2278
+ Prototype
2279
+ void GetDukptAesPinBlock(Bundle bundle, final PinInputListener pinInputListener)
2280
+ Description
2281
+ Calculate PinBlock under DUKPT AES , like as GetDukptPinBlock.
2282
+ Parameters
2283
+ Input
2284
+ Same as GetDukptPinBlock parameters
2285
+ Add:
2286
+ WorkKeyType(int) - com.urovo.sdk.pinpad.utils.Constant.DukptKeyType
2287
+ Output
2288
+
2289
+ Return
2290
+
2291
+ Remark
2292
+ ```
2293
+
2294
+ ## getOfflinePinBlcok
2295
+
2296
+ Offline pin verification in emv process.
2297
+
2298
+ ```java
2299
+ void getOfflinePinBlock(Bundle bundle, final OfflinePinInputListener listener)
2300
+ ```
2301
+
2302
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2303
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2304
+ - **源文档章节:** 3.27
2305
+
2306
+ - Source section: `3.27`
2307
+
2308
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2309
+
2310
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2311
+
2312
+
2313
+
2314
+ Purpose:
2315
+ Offline pin verification in emv process.
2316
+
2317
+
2318
+ Signature/prototype:
2319
+ ```java
2320
+ void getOfflinePinBlock(Bundle bundle, final OfflinePinInputListener listener)
2321
+ ```
2322
+
2323
+
2324
+ Parameters:
2325
+ Input
2326
+ title(String): The Title to be displayed on the pinpad.
2327
+
2328
+ message (String): The messge to be displayed on the pinpad.
2329
+
2330
+ supportPinLen(String) : default(0, 4,5,6,7,8,9,10,11,12).
2331
+
2332
+ bypass(boolean): is support bypass.
2333
+
2334
+ timeoutMs(long) : enter pin Timeout(ms).
2335
+
2336
+ sound(boolean):whether play keyboard sound.
2337
+
2338
+ FullScreen(boolean):whether the pinpad is displayed in full screen.
2339
+
2340
+ randomKeyboard(boolean):whether display random number.
2341
+
2342
+ onlinePin(boolean): fixed with false.
2343
+
2344
+ CardSlot(int): fixed with 0.
2345
+
2346
+ inputType(int):3-plaintext pin, 4-ciphertext pin.
2347
+
2348
+ ModuleLen(int): used for ciphertext pin.
2349
+
2350
+ Module(String): used for ciphertext pin.
2351
+
2352
+ ExponentLen(int): used for ciphertext pin.
2353
+
2354
+ Exponent(String): used for ciphertext offline pin.
2355
+
2356
+ listener : callback listener for pin enter
2357
+ PIN input process listener:
2358
+ need to call "EmvNfcKernelApi.sendOfflinePINVerifyResult(int result)"
2359
+ after onCofirm/onCancel/onTimeOut/onError callback.
2360
+ Interface OfflinePinInputListener{
2361
+ /**
2362
+ * Button press event
2363
+ * @param len - password length entered
2364
+ * @param key - the current Key value
2365
+ */
2366
+ void onInput(int len, int key);
2367
+
2368
+ /**
2369
+ * Called when the user confirms the PIN input.
2370
+ * @param resultCode: offline verification result.
2371
+ */
2372
+ void onConfirm(int resultCode);
2373
+
2374
+ /**
2375
+ * Called when canceling PIN input.
2376
+ * @param pinEntryType: 0-plaintext pin, 1-ciphertext pin.
2377
+ * @param retryTimes: remaining retry attempts.
2378
+ */
2379
+ void onRetry(int pinEntryType, int retryTimes);;
2380
+
2381
+ /**
2382
+ * Called when canceling PIN input.
2383
+ * @param resultCode: offline verification result.
2384
+ */
2385
+ void onCancel(int errorCode);
2386
+
2387
+ /**
2388
+ * Called when PIN input timeOut.
2389
+ * @param resultCode: offline verification result.
2390
+ */
2391
+ void onTimeOut(int errorCode);
2392
+
2393
+ /**
2394
+ * Callback when wrong
2395
+ * @param errorCode - error code.
2396
+ * @param resultCode: offline verification result.
2397
+ */
2398
+ void onError(int errorCode);
2399
+ }
2400
+ Output
2401
+ None
2402
+
2403
+
2404
+ Return value:
2405
+ None
2406
+
2407
+
2408
+ Source details:
2409
+ ```text
2410
+ Prototype
2411
+ void getOfflinePinBlock(Bundle bundle, final OfflinePinInputListener listener)
2412
+ Description
2413
+ Offline pin verification in emv process.
2414
+ Parameters
2415
+ Input
2416
+ title(String): The Title to be displayed on the pinpad.
2417
+
2418
+ message (String): The messge to be displayed on the pinpad.
2419
+
2420
+ supportPinLen(String) : default(0, 4,5,6,7,8,9,10,11,12).
2421
+
2422
+ bypass(boolean): is support bypass.
2423
+
2424
+ timeoutMs(long) : enter pin Timeout(ms).
2425
+
2426
+ sound(boolean):whether play keyboard sound.
2427
+
2428
+ FullScreen(boolean):whether the pinpad is displayed in full screen.
2429
+
2430
+ randomKeyboard(boolean):whether display random number.
2431
+
2432
+ onlinePin(boolean): fixed with false.
2433
+
2434
+ CardSlot(int): fixed with 0.
2435
+
2436
+ inputType(int):3-plaintext pin, 4-ciphertext pin.
2437
+
2438
+ ModuleLen(int): used for ciphertext pin.
2439
+
2440
+ Module(String): used for ciphertext pin.
2441
+
2442
+ ExponentLen(int): used for ciphertext pin.
2443
+
2444
+ Exponent(String): used for ciphertext offline pin.
2445
+
2446
+ listener : callback listener for pin enter
2447
+ PIN input process listener:
2448
+ need to call "EmvNfcKernelApi.sendOfflinePINVerifyResult(int result)"
2449
+ after onCofirm/onCancel/onTimeOut/onError callback.
2450
+ Interface OfflinePinInputListener{
2451
+ /**
2452
+ * Button press event
2453
+ * @param len - password length entered
2454
+ * @param key - the current Key value
2455
+ */
2456
+ void onInput(int len, int key);
2457
+
2458
+ /**
2459
+ * Called when the user confirms the PIN input.
2460
+ * @param resultCode: offline verification result.
2461
+ */
2462
+ void onConfirm(int resultCode);
2463
+
2464
+ /**
2465
+ * Called when canceling PIN input.
2466
+ * @param pinEntryType: 0-plaintext pin, 1-ciphertext pin.
2467
+ * @param retryTimes: remaining retry attempts.
2468
+ */
2469
+ void onRetry(int pinEntryType, int retryTimes);;
2470
+
2471
+ /**
2472
+ * Called when canceling PIN input.
2473
+ * @param resultCode: offline verification result.
2474
+ */
2475
+ void onCancel(int errorCode);
2476
+
2477
+ /**
2478
+ * Called when PIN input timeOut.
2479
+ * @param resultCode: offline verification result.
2480
+ */
2481
+ void onTimeOut(int errorCode);
2482
+
2483
+ /**
2484
+ * Callback when wrong
2485
+ * @param errorCode - error code.
2486
+ * @param resultCode: offline verification result.
2487
+ */
2488
+ void onError(int errorCode);
2489
+ }
2490
+ Source note: section truncated for chunk size; consult the source document for remaining detailed tables (85 source lines total).
2491
+ ```
2492
+
2493
+ ## downloadKeyTR31
2494
+
2495
+ Load mksk key in tr31 format
2496
+
2497
+ ```java
2498
+ boolean downloadKeyTR31(int mKeyType, int wKeyType, Bundle bundle)
2499
+ ```
2500
+
2501
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2502
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2503
+ - **源文档章节:** 3.28
2504
+
2505
+ - Source section: `3.28`
2506
+
2507
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2508
+
2509
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2510
+
2511
+
2512
+
2513
+ Purpose:
2514
+ Load mksk key in tr31 format
2515
+
2516
+
2517
+ Signature/prototype:
2518
+ ```java
2519
+ boolean downloadKeyTR31(int mKeyType, int wKeyType, Bundle bundle)
2520
+ ```
2521
+
2522
+
2523
+ Parameters:
2524
+ Input
2525
+ mKeyType - kbpk type.
2526
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2527
+ wKeyType - work key type.
2528
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2529
+ bundle:
2530
+ /**
2531
+ keyNo: kbpk index.
2532
+ sKeyNo: work key index.
2533
+ content-tr31: tr31 keyblock.
2534
+ content_size: length of tr31 keyblock.
2535
+ **/
2536
+ Output
2537
+ None
2538
+
2539
+
2540
+ Return value:
2541
+ true-success, false: failed.
2542
+
2543
+
2544
+ Source details:
2545
+ ```text
2546
+ Prototype
2547
+ boolean downloadKeyTR31(int mKeyType, int wKeyType, Bundle bundle)
2548
+ Description
2549
+ Load mksk key in tr31 format
2550
+ Parameters
2551
+ Input
2552
+ mKeyType - kbpk type.
2553
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2554
+ wKeyType - work key type.
2555
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2556
+ bundle:
2557
+ /**
2558
+ keyNo: kbpk index.
2559
+ sKeyNo: work key index.
2560
+ content-tr31: tr31 keyblock.
2561
+ content_size: length of tr31 keyblock.
2562
+ **/
2563
+ Output
2564
+ None
2565
+ Return
2566
+ true-success, false: failed.
2567
+ Remark
2568
+ ```
2569
+
2570
+ ## DukptInitialTr31
2571
+
2572
+ Load tdes dukpt key in tr31 format
2573
+
2574
+ ```java
2575
+ int DukptInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2576
+ ```
2577
+
2578
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2579
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2580
+ - **源文档章节:** 3.29
2581
+
2582
+ - Source section: `3.29`
2583
+
2584
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2585
+
2586
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2587
+
2588
+
2589
+
2590
+ Purpose:
2591
+ Load tdes dukpt key in tr31 format
2592
+
2593
+
2594
+ Signature/prototype:
2595
+ ```java
2596
+ int DukptInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2597
+ ```
2598
+
2599
+
2600
+ Parameters:
2601
+ Input
2602
+ KbpkUsage - kbpk type.
2603
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2604
+ KbpkKeyNo - kbpk index.
2605
+ keySetNum - dukpt key index.
2606
+ isBdk - bdk or ipek.(0-ipek, others-bdk).
2607
+ KeyInfo - tr31 key block.
2608
+ KeyLen - length of tr31 key block.
2609
+ Ksn - ksn.
2610
+ KsnLen - length of ksn.
2611
+ Kcv_Alg - kcv algorithm.(0-ecb, 1-cmac).
2612
+ Kcv_IV - kcv iv data.
2613
+ Kcv_IVLen - length of kcv iv data.
2614
+ Output
2615
+ out_kcv - response kcv.
2616
+
2617
+ outLen - length of reponse kcv.
2618
+
2619
+
2620
+ Return value:
2621
+ 0-success, else: failed.
2622
+
2623
+
2624
+ Source details:
2625
+ ```text
2626
+ Prototype
2627
+ int DukptInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2628
+ Description
2629
+ Load tdes dukpt key in tr31 format
2630
+ Parameters
2631
+ Input
2632
+ KbpkUsage - kbpk type.
2633
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2634
+ KbpkKeyNo - kbpk index.
2635
+ keySetNum - dukpt key index.
2636
+ isBdk - bdk or ipek.(0-ipek, others-bdk).
2637
+ KeyInfo - tr31 key block.
2638
+ KeyLen - length of tr31 key block.
2639
+ Ksn - ksn.
2640
+ KsnLen - length of ksn.
2641
+ Kcv_Alg - kcv algorithm.(0-ecb, 1-cmac).
2642
+ Kcv_IV - kcv iv data.
2643
+ Kcv_IVLen - length of kcv iv data.
2644
+ Output
2645
+ out_kcv - response kcv.
2646
+
2647
+ outLen - length of reponse kcv.
2648
+ Return
2649
+ 0-success, else: failed.
2650
+ Remark
2651
+ ```
2652
+
2653
+ ## DukptAesInitialTr31
2654
+
2655
+ Load tdes dukpt key in tr31 format
2656
+
2657
+ ```java
2658
+ int DukptAesInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, int driveKeyType, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2659
+ ```
2660
+
2661
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2662
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2663
+ - **源文档章节:** 3.30
2664
+
2665
+ - Source section: `3.30`
2666
+
2667
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2668
+
2669
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2670
+
2671
+
2672
+
2673
+ Purpose:
2674
+ Load tdes dukpt key in tr31 format
2675
+
2676
+
2677
+ Signature/prototype:
2678
+ ```java
2679
+ int DukptAesInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, int driveKeyType, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2680
+ ```
2681
+
2682
+
2683
+ Parameters:
2684
+ Input
2685
+ KbpkUsage - kbpk type.
2686
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2687
+ KbpkKeyNo - kbpk index.
2688
+ keySetNum - dukpt key index.
2689
+ isBdk - bdk or ipek.(0-ipek, others-bdk).
2690
+ driveKeyType:
2691
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
2692
+ KeyInfo - tr31 key block.
2693
+ KeyLen - length of tr31 key block.
2694
+ Ksn - ksn.
2695
+ KsnLen - length of ksn.
2696
+ Kcv_Alg - kcv algorithm.(0-ecb, 1-cmac).
2697
+ Kcv_IV - kcv iv data.
2698
+ Kcv_IVLen - length of kcv iv data.
2699
+ Output
2700
+ out_kcv: response kcv.
2701
+
2702
+ outLen: length of reponse kcv.
2703
+
2704
+
2705
+ Return value:
2706
+ 0-success, else: failed.
2707
+
2708
+
2709
+ Source details:
2710
+ ```text
2711
+ Prototype
2712
+ int DukptAesInitialTr31(int KbpkUsage, int KbpkKeyNo, int keySetNum, int isBdk, int driveKeyType, byte[] KeyInfo, int KeyLen, byte[] Ksn, int KsnLen, int Kcv_Alg, byte[] Kcv_IV, int Kcv_IVLen, byte[] out_kcv, int[] outLen)
2713
+ Description
2714
+ Load tdes dukpt key in tr31 format
2715
+ Parameters
2716
+ Input
2717
+ KbpkUsage - kbpk type.
2718
+ Refer to com.urovo.sdk.pinpad.utils.Constant.KeyType.
2719
+ KbpkKeyNo - kbpk index.
2720
+ keySetNum - dukpt key index.
2721
+ isBdk - bdk or ipek.(0-ipek, others-bdk).
2722
+ driveKeyType:
2723
+ Refer to com.urovo.sdk.pinpad.utils.Constant.DukptKeyType.
2724
+ KeyInfo - tr31 key block.
2725
+ KeyLen - length of tr31 key block.
2726
+ Ksn - ksn.
2727
+ KsnLen - length of ksn.
2728
+ Kcv_Alg - kcv algorithm.(0-ecb, 1-cmac).
2729
+ Kcv_IV - kcv iv data.
2730
+ Kcv_IVLen - length of kcv iv data.
2731
+ Output
2732
+ out_kcv: response kcv.
2733
+
2734
+ outLen: length of reponse kcv.
2735
+ Return
2736
+ 0-success, else: failed.
2737
+ Remark
2738
+ ```
2739
+
2740
+ ## generateRSAKey
2741
+
2742
+ Generates RSA key pair.
2743
+
2744
+ ```java
2745
+ int generateRSAKey(int rsaIndex, int keySize, String exponent)
2746
+ ```
2747
+
2748
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2749
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2750
+ - **源文档章节:** 3.31
2751
+
2752
+ - Source section: `3.31`
2753
+
2754
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2755
+
2756
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2757
+
2758
+
2759
+
2760
+ Purpose:
2761
+ Generates RSA key pair.
2762
+
2763
+
2764
+ Signature/prototype:
2765
+ ```java
2766
+ int generateRSAKey(int rsaIndex, int keySize, String exponent)
2767
+ ```
2768
+
2769
+
2770
+ Parameters:
2771
+ Input
2772
+ rsaIndex - 0-9.
2773
+ keySize - 512, 1024, 2048, 3072, 4096.
2774
+ exponent: - default value is 010001.
2775
+ Output
2776
+ None
2777
+
2778
+
2779
+ Return value:
2780
+ 0:success, others:failed
2781
+
2782
+
2783
+ Source details:
2784
+ ```text
2785
+ Prototype
2786
+ int generateRSAKey(int rsaIndex, int keySize, String exponent)
2787
+ Description
2788
+ Generates RSA key pair.
2789
+ Parameters
2790
+ Input
2791
+ rsaIndex - 0-9.
2792
+ keySize - 512, 1024, 2048, 3072, 4096.
2793
+ exponent: - default value is 010001.
2794
+ Output
2795
+ None
2796
+ Return
2797
+ 0:success, others:failed
2798
+ Remark
2799
+ ```
2800
+
2801
+ ## readRSAPublicKey
2802
+
2803
+ Read RSA public key from device.
2804
+
2805
+ ```java
2806
+ RSAPublicKey readRSAPublicKey(int rsaIndex)
2807
+ ```
2808
+
2809
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2810
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2811
+ - **源文档章节:** 3.32
2812
+
2813
+ - Source section: `3.32`
2814
+
2815
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2816
+
2817
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2818
+
2819
+
2820
+
2821
+ Purpose:
2822
+ Read RSA public key from device.
2823
+
2824
+
2825
+ Signature/prototype:
2826
+ ```java
2827
+ RSAPublicKey readRSAPublicKey(int rsaIndex)
2828
+ ```
2829
+
2830
+
2831
+ Parameters:
2832
+ Input
2833
+ rsaIndex - 0-9.
2834
+ Output
2835
+ None
2836
+
2837
+
2838
+ Return value:
2839
+ The RSA public key.
2840
+
2841
+
2842
+ Source details:
2843
+ ```text
2844
+ Prototype
2845
+ RSAPublicKey readRSAPublicKey(int rsaIndex)
2846
+ Description
2847
+ Read RSA public key from device.
2848
+ Parameters
2849
+ Input
2850
+ rsaIndex - 0-9.
2851
+ Output
2852
+ None
2853
+ Return
2854
+ The RSA public key.
2855
+ Remark
2856
+ ```
2857
+
2858
+ ## calculateWithRSAPrivateKey
2859
+
2860
+ Calculation with RSA private key.
2861
+
2862
+ ```java
2863
+ byte[] calculateWithRSAPrivateKey(int rsaIndex, byte[] data)
2864
+ ```
2865
+
2866
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2867
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2868
+ - **源文档章节:** 3.33
2869
+
2870
+ - Source section: `3.33`
2871
+
2872
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2873
+
2874
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2875
+
2876
+
2877
+
2878
+ Purpose:
2879
+ Calculation with RSA private key.
2880
+
2881
+
2882
+ Signature/prototype:
2883
+ ```java
2884
+ byte[] calculateWithRSAPrivateKey(int rsaIndex, byte[] data)
2885
+ ```
2886
+
2887
+
2888
+ Parameters:
2889
+ Input
2890
+ rsaIndex - 0-9.
2891
+
2892
+ data -the data used for calculation.(Data with padding).
2893
+ Output
2894
+ None
2895
+
2896
+
2897
+ Return value:
2898
+ The calculation result.
2899
+
2900
+
2901
+ Source details:
2902
+ ```text
2903
+ Prototype
2904
+ byte[] calculateWithRSAPrivateKey(int rsaIndex, byte[] data)
2905
+ Description
2906
+ Calculation with RSA private key.
2907
+ Parameters
2908
+ Input
2909
+ rsaIndex - 0-9.
2910
+
2911
+ data -the data used for calculation.(Data with padding).
2912
+ Output
2913
+ None
2914
+ Return
2915
+ The calculation result.
2916
+ Remark
2917
+ ```
2918
+
2919
+ ## calculateWithRSAPublicKey
2920
+
2921
+ Calculation with RSA public key.
2922
+
2923
+ ```java
2924
+ byte[] calculateWithRSAPublicKey(int rsaIndex, byte[] data)
2925
+ ```
2926
+
2927
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2928
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2929
+ - **源文档章节:** 3.34
2930
+
2931
+ - Source section: `3.34`
2932
+
2933
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2934
+
2935
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2936
+
2937
+
2938
+
2939
+ Purpose:
2940
+ Calculation with RSA public key.
2941
+
2942
+
2943
+ Signature/prototype:
2944
+ ```java
2945
+ byte[] calculateWithRSAPublicKey(int rsaIndex, byte[] data)
2946
+ ```
2947
+
2948
+
2949
+ Parameters:
2950
+ Input
2951
+ rsaIndex - 0-9.
2952
+
2953
+ data -the data used for calculation.(Data with padding).
2954
+ Output
2955
+ None
2956
+
2957
+
2958
+ Return value:
2959
+ The calculation result.
2960
+
2961
+
2962
+ Source details:
2963
+ ```text
2964
+ Prototype
2965
+ byte[] calculateWithRSAPublicKey(int rsaIndex, byte[] data)
2966
+ Description
2967
+ Calculation with RSA public key.
2968
+ Parameters
2969
+ Input
2970
+ rsaIndex - 0-9.
2971
+
2972
+ data -the data used for calculation.(Data with padding).
2973
+ Output
2974
+ None
2975
+ Return
2976
+ The calculation result.
2977
+ Remark
2978
+ ```
2979
+
2980
+ ## isDukptKeyExist
2981
+
2982
+ Determine is the dukpt key exist.
2983
+
2984
+ ```java
2985
+ boolean isDukptKeyExist(boolean aesAlg, int keyIndex, byte[] outKsn)
2986
+ ```
2987
+
2988
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
2989
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
2990
+ - **源文档章节:** 3.35
2991
+
2992
+ - Source section: `3.35`
2993
+
2994
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
2995
+
2996
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
2997
+
2998
+
2999
+
3000
+ Purpose:
3001
+ Determine is the dukpt key exist.
3002
+
3003
+
3004
+ Signature/prototype:
3005
+ ```java
3006
+ boolean isDukptKeyExist(boolean aesAlg, int keyIndex, byte[] outKsn)
3007
+ ```
3008
+
3009
+
3010
+ Parameters:
3011
+ Input
3012
+ aesAlg - is aes algorithm.
3013
+
3014
+ keyIndex - key index.
3015
+
3016
+ outKsn - the ksn.
3017
+ Output
3018
+ None
3019
+
3020
+
3021
+ Return value:
3022
+ The calculation result.
3023
+
3024
+
3025
+ Source details:
3026
+ ```text
3027
+ Prototype
3028
+ boolean isDukptKeyExist(boolean aesAlg, int keyIndex, byte[] outKsn)
3029
+ Description
3030
+ Determine is the dukpt key exist.
3031
+ Parameters
3032
+ Input
3033
+ aesAlg - is aes algorithm.
3034
+
3035
+ keyIndex - key index.
3036
+
3037
+ outKsn - the ksn.
3038
+ Output
3039
+ None
3040
+ Return
3041
+ The calculation result.
3042
+ Remark
3043
+ ```
3044
+
3045
+ ## getLastErrorCode
3046
+
3047
+ The last error code
3048
+
3049
+ ```java
3050
+ int getLastErrorCode()
3051
+ ```
3052
+
3053
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
3054
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
3055
+ - **源文档章节:** 3.36
3056
+
3057
+ - Source section: `3.36`
3058
+
3059
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
3060
+
3061
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
3062
+
3063
+
3064
+
3065
+ Purpose:
3066
+ The last error code
3067
+
3068
+
3069
+ Signature/prototype:
3070
+ ```java
3071
+ int getLastErrorCode()
3072
+ ```
3073
+
3074
+
3075
+ Parameters:
3076
+ Input
3077
+ None
3078
+ Output
3079
+ None
3080
+
3081
+
3082
+ Return value:
3083
+ The error code.
3084
+
3085
+
3086
+ Usage notes:
3087
+ Refer to the Pinpad Error Code Definition.
3088
+
3089
+
3090
+ Source details:
3091
+ ```text
3092
+ Prototype
3093
+ int getLastErrorCode()
3094
+ Description
3095
+ The last error code
3096
+ Parameters
3097
+ Input
3098
+ None
3099
+ Output
3100
+ None
3101
+ Return
3102
+ The error code.
3103
+ Remark
3104
+ Refer to the Pinpad Error Code Definition.
3105
+ ```
3106
+
3107
+ ## getLastErrorMsg
3108
+
3109
+ The last error message.
3110
+
3111
+ ```java
3112
+ String getLastErrorMsg()
3113
+ ```
3114
+
3115
+ - **类路径:** `com.urovo.sdk.pinpad.PinPadProviderImpl`
3116
+ - **Demo Activity(参考):** PinpadActivity, PinpadUtil
3117
+ - **源文档章节:** 3.35
3118
+
3119
+ - Source section: `3.35`
3120
+
3121
+ - Package/class path: `com.urovo.sdk.pinpad.PinPadProviderImpl`
3122
+
3123
+ - Demo reference: `UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/view/PinpadActivity.java and UrovoPosSdkDemo/app/src/main/java/com/urovo/sdk/utils/PinpadUtil.java`
3124
+
3125
+
3126
+
3127
+ Purpose:
3128
+ The last error message.
3129
+
3130
+
3131
+ Signature/prototype:
3132
+ ```java
3133
+ String getLastErrorMsg()
3134
+ ```
3135
+
3136
+
3137
+ Parameters:
3138
+ Input
3139
+ None
3140
+ Output
3141
+ None
3142
+
3143
+
3144
+ Return value:
3145
+ The error message.
3146
+
3147
+
3148
+ Usage notes:
3149
+ Pinpad Error Code Definition
3150
+ Error Code
3151
+ Error Description
3152
+ 0x00
3153
+ Success
3154
+ 0x01
3155
+ Unsupported command
3156
+ 0x02
3157
+ Command length error
3158
+ 0x03
3159
+ Command separator error
3160
+ 0x04
3161
+ Command separator length error
3162
+ 0x05
3163
+ command head (CB) error
3164
+ 0x06
3165
+ Data crc16 error
3166
+ 0x07
3167
+ Message mac error
3168
+ 0x09
3169
+ Message format error
3170
+ 0x0C
3171
+ Unsupported algorithm
3172
+ 0x0D
3173
+ Unsupported format
3174
+ 0x0E
3175
+ Unsupported mode
3176
+ 0x12
3177
+ Keys not ready or init
3178
+ 0x14
3179
+ Keys number not found
3180
+ 0x15
3181
+ Keys number out of range
3182
+ 0x16
3183
+ Keys download
3184
+ 0x17
3185
+ Keys not download
3186
+ 0x18
3187
+ Keys out of space
3188
+ 0x19
3189
+ Keys exists or can not be overwrite
3190
+ 0x1A
3191
+ Keys encrypt keys not download
3192
+ 0x1B
3193
+ Keys unsupported specified use
3194
+ 0x1C
3195
+ Unsupported keys length
3196
+ 0x1D
3197
+ Reserved
3198
+ 0x28
3199
+ Unsupported pinblock format
3200
+ 0x29
3201
+ Username length error
3202
+ 0x2A
3203
+ Username value error
3204
+ 0x2B
3205
+ User pinblock length error
3206
+ 0x2C
3207
+ User pinblock value error
3208
+ 0x2D
3209
+ Pinblock char error
3210
+ 100
3211
+ Parameter is null or empty
3212
+ 101
3213
+ Mismatch data length
3214
+ 102
3215
+ Invalid data length
3216
+ 103
3217
+ Invalid key index
3218
+ 104
3219
+ Invalid parameter
3220
+ 105
3221
+ InvalidRSA public key
3222
+ 106
3223
+ Runtime exption
3224
+
3225
+
3226
+ Source details:
3227
+ ```text
3228
+ Prototype
3229
+ String getLastErrorMsg()
3230
+ Description
3231
+ The last error message.
3232
+ Parameters
3233
+ Input
3234
+ None
3235
+ Output
3236
+ None
3237
+ Return
3238
+ The error message.
3239
+ Remark
3240
+
3241
+ Pinpad Error Code Definition
3242
+ Error Code
3243
+ Error Description
3244
+ 0x00
3245
+ Success
3246
+ 0x01
3247
+ Unsupported command
3248
+ 0x02
3249
+ Command length error
3250
+ 0x03
3251
+ Command separator error
3252
+ 0x04
3253
+ Command separator length error
3254
+ 0x05
3255
+ command head (CB) error
3256
+ 0x06
3257
+ Data crc16 error
3258
+ 0x07
3259
+ Message mac error
3260
+ 0x09
3261
+ Message format error
3262
+ 0x0C
3263
+ Unsupported algorithm
3264
+ 0x0D
3265
+ Unsupported format
3266
+ 0x0E
3267
+ Unsupported mode
3268
+ 0x12
3269
+ Keys not ready or init
3270
+ 0x14
3271
+ Keys number not found
3272
+ 0x15
3273
+ Keys number out of range
3274
+ 0x16
3275
+ Keys download
3276
+ 0x17
3277
+ Keys not download
3278
+ 0x18
3279
+ Keys out of space
3280
+ 0x19
3281
+ Keys exists or can not be overwrite
3282
+ 0x1A
3283
+ Keys encrypt keys not download
3284
+ 0x1B
3285
+ Keys unsupported specified use
3286
+ 0x1C
3287
+ Unsupported keys length
3288
+ 0x1D
3289
+ Reserved
3290
+ 0x28
3291
+ Unsupported pinblock format
3292
+ 0x29
3293
+ Username length error
3294
+ 0x2A
3295
+ Username value error
3296
+ 0x2B
3297
+ User pinblock length error
3298
+ 0x2C
3299
+ User pinblock value error
3300
+ 0x2D
3301
+ Pinblock char error
3302
+ Parameter is null or empty
3303
+ Mismatch data length
3304
+ Invalid data length
3305
+ Invalid key index
3306
+ Invalid parameter
3307
+ InvalidRSA public key
3308
+ Source note: section truncated for chunk size; consult the source document for remaining detailed tables (81 source lines total).
3309
+ ```