如何读取社保卡基本信息?即无需验证密码的信息!

社会保障(个人)卡规范

//更多请阅读 《社会保障(个人)卡规范》
//cls in 
const unsigned char Coco_MF[2] = { 0x3f,0x00 };//MF 主文件

const unsigned char Coco_Response[2] = { 0x00,0xC0 };//取得响应数据 ISO
const unsigned char Coco_CreateFile[2] = { 0x80,0xE0 };//创建文件 Tecsun
const unsigned char Coco_SelectFile[2] = { 0x00,0xA4 };//选择文件 ISO
const unsigned char Coco_EraseDF[2] = { 0x80,0x0E };//擦出目录文件 Tecsun
const unsigned char Coco_ReadBinary[2] = { 0x00,0xB0 };//读取二进制文件 ISO
const unsigned char Coco_ReadRecord[2] = { 0x00,0xB2 };//读取记录文件 ISO
const unsigned char Coco_UpdataBinary[2] = { 0x00,0xD6 };//更新二进制文件 ISO
const unsigned char Coco_UpdataRecord[2] = { 0x00,0xDC };//更新记录文件 ISO
const unsigned char Coco_AppendRecord[2] = { 0x00,0xE2 };//追加记录文件 ISO
const unsigned char Coco_VerifyPIN[2] = { 0x00,0x20 };//验证口令 ISO

//【out】读取实际数据长度 < 【IN】读取长度 :cn 数据项左靠齐并且右补 F ,使据项的长度达到本规范所定义的长度。
//【out】读取实际数据长度 < 【IN】读取长度 :an 数据项右靠齐并且右补 0 ,使据项的长度达到本规范所定义的长度。
//基本应用数据区
const unsigned char Coco_CardIssuerDataFile[2] = { 0xEF,0x05 };//发卡机构数据文件
const unsigned char Coco_CardCode[3] = { 0x01,0x00,0x10 };//卡的识别码 cn
const unsigned char Coco_CardType[3] = { 0x02,0x00,0x01 };//卡的类别 an
const unsigned char Coco_CardVersion[3] = { 0x03,0x00,0x04 };//规范版本 an
const unsigned char Coco_CardMechanismCoding[3] = { 0x04,0x00,0x0C };//初始化机构编码 cn
const unsigned char Coco_CardIssuingDate[3] = { 0x05,0x00,0x04 };//发卡日期 cn
const unsigned char Coco_CardValidity[3] = { 0x06,0x00,0x04 };//卡有效期 cn
const unsigned char Coco_CardID[3] = { 0x07,0x00,0x09 };//卡号 cn
const unsigned char Coco_CardHolderIsBasicInformationFile[2] = { 0xEF,0x06 };//持卡人基本信息文件
const unsigned char Coco_IDCard[3] = { 0x08,0x00,0x12};//身份证ID an  读取长度为 18字节
const unsigned char Coco_Name[3] = { 0x09,0x00,0x1E};//姓名 an
const unsigned char Coco_Sex[3] = { 0x0A,0x00,0x01};//性别 an
const unsigned char Coco_Nation[3] = { 0x0B,0x00,0x01};//民族 cn
const unsigned char Coco_Native[3] = { 0x0C,0x00,0x03};//出生地 cn
const unsigned char Coco_Birth[3] = { 0x0D,0x00,0x04};//出生日期 cn

/*
命令例子:
//选择主文件 MF
Coco_SelectFile + {0x00,0x00,0x02} + Coco_MF
//选择文件
Coco_SelectFile + {0x02,0x00,0x02}+ Coco_CardIssuerDataFile
//读取规范版本信息
Coco_ReadRecord + Coco_CardVersion
*/

posted @ 2017-10-28 18:48  學海無涯  阅读(1597)  评论(0编辑  收藏  举报