JCAlgTest icon indicating copy to clipboard operation
JCAlgTest copied to clipboard

Add various GETDATA commands to extract GlobalPlatform metadata (atop of CPLC)

Open petrs opened this issue 4 years ago • 0 comments

Add collection and parsing of GlobalPlatform information same as the GlobalPlatformPro tool. GlobalPlatformPro issues and parses following commands:

80CA0066 00 GET DATA(Card Data) 80CA0067 00 GET DATA(Card Capabilities) 80CA00E0 00 GET DATA(Key Info Template) 80CA0042 00 GET DATA(IIN) 80CA0045 00 GET DATA(CIN)

Out of these, following commands are meaningful with GlobalPlatform-related info:
80CA0066 00 GET DATA(Card Data) 80CA0067 00 GET DATA(Card Capabilities)

GPro performs parsing in GPData.java file, additional dependencies are required.

Example output from GPPro:

[TRACE] GPData - GET DATA(IIN)
A>> T=1 (4+0000) 80CA0042 00
A<< (0003+2) (16ms) 420100 9000
IIN: 420100
[TRACE] GPData - GET DATA(CIN)
A>> T=1 (4+0000) 80CA0045 00
A<< (0010+2) (16ms) 45080000000000000000 9000
CIN: 45080000000000000000
Card Data:
[TRACE] GPData - GET DATA(Card Data)
A>> T=1 (4+0000) 80CA0066 00
A<< (0065+2) (23ms) 663F733D06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B040255660C060A2B060104012A026E0102 9000
[TRACE] GPData -  [66]
[TRACE] GPData -      [73]
[TRACE] GPData -          [06] 2A864886FC6B01
[TRACE] GPData -          [60]
[TRACE] GPData -              [06] 2A864886FC6B02020101
[TRACE] GPData -          [63]
[TRACE] GPData -              [06] 2A864886FC6B03
[TRACE] GPData -          [64]
[TRACE] GPData -              [06] 2A864886FC6B040255
[TRACE] GPData -          [66]
[TRACE] GPData -              [06] 2B060104012A026E0102
Tag 6: 1.2.840.114283.1
-> Global Platform card
Tag 60: 1.2.840.114283.2.2.1.1
-> GP Version: 2.1.1
Tag 63: 1.2.840.114283.3
Tag 64: 1.2.840.114283.4.2.85
-> GP SCP02 i=55
Tag 66: 1.3.6.1.4.1.42.2.110.1.2
-> JavaCard v2
Card Capabilities:
[TRACE] GPData - GET DATA(Card Capabilities)
A>> T=1 (4+0000) 80CA0067 00
A<< (0060+2) (20ms) 673A6738A006800102810155A00A8001038102001082010781039EFE8082031E03008301028504010208408602040887040102084088050102030405 9000
[WARN] GPData - Bogus data detected, fixing double tag
[TRACE] GPData -  [67]
[TRACE] GPData -      [A0]
[TRACE] GPData -          [80] 02
[TRACE] GPData -          [81] 55
[TRACE] GPData -      [A0]
[TRACE] GPData -          [80] 03
[TRACE] GPData -          [81] 0010
[TRACE] GPData -          [82] 07
[TRACE] GPData -      [81] 9EFE80
[TRACE] GPData -      [82] 1E0300
[TRACE] GPData -      [83] 02
[TRACE] GPData -      [85] 01020840
[TRACE] GPData -      [86] 0408
[TRACE] GPData -      [87] 01020840
[TRACE] GPData -      [88] 0102030405
Supports: SCP02 i=55
Supports: SCP03 i=00 i=10 with AES-128 AES-196 AES-256
Supported DOM privileges: SecurityDomain, CardLock, CardTerminate, CardReset, CVMManagement, TrustedPath, AuthorizedManagement, TokenVerification, GlobalDelete, GlobalLock, GlobalRegistry, FinalApplication, ReceiptGeneration
Supported APP privileges: CardLock, CardTerminate, CardReset, CVMManagement, FinalApplication, GlobalService
Supported LFDB hash: 02
Supported Token Verification ciphers: 01020840
Supported Receipt Generation ciphers: 0408
Supported DAP Verification ciphers: 01020840
Supported ECC Key Parameters: 0102030405
[TRACE] GPData - GET DATA(Key Info Template)
A>> T=1 (4+0000) 80CA00E0 00
A<< (0020+2) (21ms) E012C00401FF8010C00402FF8010C00403FF8010 9000
[TRACE] GPKeyInfo -  [E0]
[TRACE] GPKeyInfo -      [C0] 01FF8010
[TRACE] GPKeyInfo -      [C0] 02FF8010
[TRACE] GPKeyInfo -      [C0] 03FF8010
Version: 255 (0xFF) ID:   1 (0x01) type: DES3 length:  16
Version: 255 (0xFF) ID:   2 (0x02) type: DES3 length:  16
Version: 255 (0xFF) ID:   3 (0x03) type: DES3 length:  16
Key version suggests factory keys
SCardEndTransaction("Alcor Micro USB Smart Card Reader 0")
SCardDisconnect("Alcor Micro USB Smart Card Reader 0", true) tx:35/rx:235

petrs avatar Feb 29 '20 10:02 petrs