Documentation ¶
Index ¶
- Variables
- func APDUGetBlockRsp(scardCard *scard.Card, apducmds [][]byte, apducmdRsp []byte) ([]byte, error)
- func APDUGetRsp(card *scard.Card, apducmds [][]byte, ispadzeroOptional ...bool) ([]byte, error)
- func CalculateChecksum(luhnString string, double bool) int
- func CalculateChecksumByte(luhnByte []byte, double bool, length int) int
- func DecodeICCID(iccid []byte) []byte
- func DecodeIMSI(ef []byte) []byte
- func EncodeICCID(iccid []byte) []byte
- func EncodeIMSI(imsi []byte) []byte
- func Generate(size int) string
- func LuhnByteValid(luhnByte []byte, length int) bool
- func LuhnStringValid(luhnString string) bool
- func WriteBlockToFile(databytes []byte, fullname string) (int, error)
Constants ¶
This section is empty.
Variables ¶
var APDUReadACC = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x78},
{0xA0, 0xB0, 0x00, 0x00, 0x02},
}
APDUReadACC ...
var APDUReadAD = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0xAD},
{0xA0, 0xB0, 0x00, 0x00, 0x03},
}
APDUReadAD ...
var APDUReadADN = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x10},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x3A},
{0xA0, 0xB0, 0x00, 0x00, 0x0D},
}
APDUReadADN ...
var APDUReadBCCH = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x74},
{0xA0, 0xB0, 0x00, 0x00, 0x10},
}
APDUReadBCCH ...
var APDUReadFDN = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x10},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x0B},
{0xA0, 0xB0, 0x00, 0x00, 0x0D},
}
APDUReadFDN ...
var APDUReadFPLMN = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x7B},
{0xA0, 0xB0, 0x00, 0x00, 0x0C},
}
APDUReadFPLMN ...
var APDUReadHPPLMN = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x31},
{0xA0, 0xB0, 0x00, 0x00, 0x01},
}
APDUReadHPPLMN ...
var APDUReadICCID = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x2F, 0xE2},
{0xA0, 0xB0, 0x00, 0x00, 0x0A},
}
APDUReadICCID ...
var APDUReadIMSI = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x07},
{0xA0, 0xB0, 0x00, 0x00, 0x09},
}
APDUReadIMSI ...
var APDUReadKC = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x20},
{0xA0, 0xB0, 0x00, 0x00, 0x09},
}
APDUReadKC ...
var APDUReadLOCI = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x7E},
{0xA0, 0xB0, 0x00, 0x00, 0x0B},
}
APDUReadLOCI ...
var APDUReadMSISDN = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x10},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x40},
{0xA0, 0xB0, 0x00, 0x00, 0x0D},
}
APDUReadMSISDN ...
var APDUReadPHASE = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0xAE},
{0xA0, 0xB0, 0x00, 0x00, 0x01},
}
APDUReadPHASE ...
var APDUReadSMS = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x10},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x3C},
{0xA0, 0xB2, 0x01, 0x04, 0xB0},
}
APDUReadSMS ...
var APDUReadSMSP = [][]byte{
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x10},
{0xA0, 0xA4, 0x00, 0x00, 0x02, 0x6F, 0x42},
{0xA0, 0xB0, 0x00, 0x00, 0x0D},
}
APDUReadSMSP ...
var APDUThaiIDCardAddress = [][]byte{
{0x80, 0xB0, 0x15, 0x79, 0x02, 0x00, 0x64},
{0x00, 0xc0, 0x00, 0x00, 0x64},
}
APDUThaiIDCardAddress Address resp: 704/82####...#...#...#...
var APDUThaiIDCardBirth = [][]byte{
{0x80, 0xB0, 0x00, 0xD9, 0x02, 0x00, 0x08},
{0x00, 0xc0, 0x00, 0x00, 0x08},
}
APDUThaiIDCardBirth Date of birth resp: 25351126
var APDUThaiIDCardCID = [][]byte{
{0x80, 0xb0, 0x00, 0x04, 0x02, 0x00, 0x0d},
{0x00, 0xc0, 0x00, 0x00, 0x0d},
}
APDUThaiIDCardCID ...
var APDUThaiIDCardExpiredate = [][]byte{
{0x80, 0xB0, 0x01, 0x6F, 0x02, 0x00, 0x08},
{0x00, 0xc0, 0x00, 0x00, 0x08},
}
APDUThaiIDCardExpiredate Expire Date resp: 25691125
var APDUThaiIDCardFullInfo = [][]byte{
{0x80, 0xb0, 0x00, 0x11, 0x02, 0x00, 0xd1},
{0x00, 0xc0, 0x00, 0x00, 0xd1},
}
APDUThaiIDCardFullInfo Fullname Thai + Eng + BirthDate + Sex
var APDUThaiIDCardFullnameEn = [][]byte{
{0x80, 0xb0, 0x00, 0x75, 0x02, 0x00, 0x64},
{0x00, 0xc0, 0x00, 0x00, 0x64},
}
APDUThaiIDCardFullnameEn Fullname English resp: Mr.#Napat##Rungruangbangchan
var APDUThaiIDCardFullnameTh = [][]byte{
{0x80, 0xb0, 0x00, 0x11, 0x02, 0x00, 0x64},
{0x00, 0xc0, 0x00, 0x00, 0x64},
}
APDUThaiIDCardFullnameTh Fullname Thai
var APDUThaiIDCardGender = [][]byte{
{0x80, 0xB0, 0x00, 0xE1, 0x02, 0x00, 0x01},
{0x00, 0xc0, 0x00, 0x00, 0x01},
}
APDUThaiIDCardGender Gender resp: 1=Male, 2=Female
var APDUThaiIDCardIssuedate = [][]byte{
{0x80, 0xB0, 0x01, 0x67, 0x02, 0x00, 0x08},
{0x00, 0xc0, 0x00, 0x00, 0x08},
}
APDUThaiIDCardIssuedate Issue Date resp: 25610119
var APDUThaiIDCardIssuer = [][]byte{
{0x80, 0xB0, 0x01, 0x67, 0x02, 0x00, 0x08},
{0x00, 0xc0, 0x00, 0x00, 0x08},
}
APDUThaiIDCardIssuer Card Issuer resp: 25610119
var APDUThaiIDCardPhoto = [][]byte{ []byte{0x80, 0xB0, 0x01, 0x7B, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x02, 0x7A, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x03, 0x79, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x04, 0x78, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x05, 0x77, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x06, 0x76, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x07, 0x75, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x08, 0x74, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x09, 0x73, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0A, 0x72, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0B, 0x71, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0C, 0x70, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0D, 0x6F, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0E, 0x6E, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x0F, 0x6D, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x10, 0x6C, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x11, 0x6B, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x12, 0x6A, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x13, 0x69, 0x02, 0x00, 0xFF}, []byte{0x80, 0xB0, 0x14, 0x68, 0x02, 0x00, 0xFF}, }
APDUThaiIDCardPhoto Card Photo (JPEG)
var APDUThaiIDCardPhotoRsp = []byte{0x00, 0xc0, 0x00, 0x00, 0xFF}
APDUThaiIDCardPhotoRsp ...
var APDUThaiIDCardSelect = [][]byte{{0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x00, 0x54, 0x48, 0x00, 0x01}}
APDUThaiIDCardSelect Select Thai ID Card
Functions ¶
func APDUGetBlockRsp ¶
APDUGetBlockRsp Send list of APDU and append all response
func APDUGetRsp ¶
APDUGetRsp Send list of APDU and get last command response ispadzeroOptional is optional(default = true) to replace adpu tail section
func CalculateChecksum ¶
CalculateChecksum ... For calculate to find checksum digit must not include checksum digit For Validate -> include checksumdigit if sum % 10 = 0 ->> Valid
func CalculateChecksumByte ¶
CalculateChecksumByte ... For calculate to find checksum digit must not include checksum digit For Validate -> include checksumdigit if sum % 10 = 0 ->> Valid
func DecodeIMSI ¶
DecodeIMSI ... swap hex in this format Source Hex : 59 02 30 59 20 57 03 30 Result Hex : 95 20 03 95 02 57 30 03
func Generate ¶
Generate creates and returns a string of the length of the argument targetSize. The returned string is valid according to the Luhn algorithm.
func LuhnByteValid ¶
LuhnByteValid returns a boolean indicating if the argument was valid according to the Luhn algorithm.
func LuhnStringValid ¶
LuhnStringValid returns a boolean indicating if the argument was valid according to the Luhn algorithm.
Types ¶
This section is empty.