-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdesfire_xp.go
68 lines (63 loc) · 1.74 KB
/
desfire_xp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
// MifareDesfireATQA := [2]byte{0x03, 0x44}
// MifareDesfireSAK := [1]byte{0x20}
// MifareDesfireATS := [5]byte{0x06, 0x75, 0x77, 0x81, 0x02, 0x80} // |06 75 77 81 02| 80(HST BYTE) XX XX (CRC)
// https://www.st.com/resource/en/datasheet/st25ta64k.pdf page 37, http://www.emutag.com/iso/14443-4.pdf page 15,26
// 0x06 - TL (length of ATS response)
// 0x75 - T0 FSCI (he maximum frame size that the PICC is able to recv.) | least significant nibble defines FSD. In this case its 0x5 which is 64 bytes.
// 0x77 - TA1 (data rate value)
// 0x81 - TB1 (b8-b5 == FWI | 0b1000 in this case, b4-b1 == SFGI | 0b0001 in this case) | change to 0xE1 for max FWI ~4949 ms
// 0x02 - TC1 (DID support)
// 0x80 - HIST BYTE
type MifareDesireDF struct {
AID uint32
FID uint16
DFName [16]uint8
DFNameLen uint64
}
type MifareDesfireFileSettings struct {
FileType uint8
CommunicationSettings uint8
AccessRights uint8
// standard file
StandardFile struct {
Size uint32
}
// value file
ValueFile struct {
LowerLimit uint32
UpperLimit uint32
LimitedCreditValue uint32
LimitedCreditEnabled uint8
}
// linear record file
LinearRecordFile struct {
RecordSize uint32
MaxNumberOfRecords uint32
CurrentNumberOfRecords uint32
}
}
type MifareDesfireVersionInfo struct {
Hardware struct {
VendorId uint8
Type uint8
Subtype uint8
VersionMajor uint8
VersionMinor uint8
StorageSize uint8
Protocol uint8
}
Software struct {
VendorId uint8
Type uint8
Subtype uint8
VersionMajor uint8
VersionMinor uint8
StorageSize uint8
Protocol uint8
}
UID [7]uint8
BatchNumber [5]uint8
ProdWeek uint8
ProdYear uint8
}