|
注册 | 登录 | 搜索 | 帮助 |
|
深圳销售经理(有线传输设备) 深圳售前工程师(HFC/EOC/PON) 珠海DVB-S国内销售 珠海DVB-S海外销售 杭州系统工程师(IPTV) 杭州CATV工程师(IP-QAM) 杭州新闻男主播 杭州电视广告经理 珠海机顶盒技术副总 杭州系统工程师(Linux服务器) 北京广电销售经理(调频发射机) 北京音响工程师(调音台功放) |
| 20万年薪诚聘软件工程师(BOSS) 50万年薪诚聘市场总监(有线电视) 30万年薪诚聘副总经理(机顶盒) 20万年薪诚聘市场经理(手机电视) |
| 数字电视中文网|DVB中国2009广告招商 中国数字电视人才网|51DTV招聘专业人才猎头解决方案 |
[转帖]CAS智能卡工作原理和破解关键点C源码示范 |
|---|
linhomel
等级:新手上路
文章:3
积分:10
注册:2003年6月4日
威望:1 点
|
小 大 楼主 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
#define U8 unsigned char
*/ Smart_ErrorCode_t Smart_Transfer(Smart_Handle_t Handle,U8* pucCommand, #endif /* __sc_def_h__ */
/****************************************************** #include <stdio.h>
static Smart_ErrorCode_t smsx_transfer( /************************************************************************/ if(!smsx_begincmd(handle)) if(!smsx_get_sn(handle)) printf("SMSX Init OK !!\n"); return true;
输入 Handle -- smart card 句柄 通讯示例: 00 A4 04 00 02 A4 3F 00 // if(bresult!=SMC_NO_ERROR) if((pbword[0]!=0x90)||(pbword[1]!=0x00))
// if(bresult!=SMC_NO_ERROR) if((pbword[0]!=0x90)||(pbword[1]!=0x00)) return true;
输入 Handle -- smart card 句柄 通讯示例:
U8 nextreadsize=0; bresult=smsx_transfer(Handle,cmd,cmdlen,response,&replen,pbword); // if(bresult!=SMC_NO_ERROR) if((pbword[0]&0xf0)!=0x60) memcpy(pstSmsxInfo->uCardUA, response+7, 8);//卡片上显示的一串号码 /************************************************************************/ 输入 Handle -- smart card 句柄 buf -- ECM信息,从0x80/0x81开始 bool smsx_parse_ecm(Smart_Handle_t Handle,U8* buf,U8* pucCW) writelen = pbuf[2]+3+5; if (replen >= 2) // printf("rsp len = %d\n", replen); return true; /************************************************************************/ 输入 Handle -- smart card 句柄 data -- EMM信息,len -- 数据长度 bool smsx_parse_emm(Smart_Handle_t Handle,U8* buf,U16 len) writelen = buf[2]+3+5; return true; 输入 Handle -- smart card 句柄,ins -- 要传送的数据,NumberToWrite -- error = Smart_Transfer(Handle,ins,NumberToWrite,Response,0,Read,Status); // printf("Status[0]=0x%02x Status[1]=0x%02x error = %d\n",Status[0],Status[1],error); /************************************************************************/ 输入 Handle -- smart card 句柄,len -- 要从智能卡中读取的数据长度 memset(reponse,0,255); // if(bresult!=SMC_NO_ERROR) if((pbword[0]==0x90)&&(pbword[1]==0x00)&&(replen==len)) [该帖子由作者于2008年9月10日 14:04:07最后编辑] |
|
linhomel
等级:新手上路
文章:3
积分:10
注册:2003年6月4日
威望:1 点
|
小 大 沙发 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
/****************************************************** #include <stdio.h> Yxtf_Info_t yxtf; static Smart_ErrorCode_t yxtf_transfer(Smart_Handle_t Handle,
if(!yxtf_begincmd(handle)) #if 0 if(!yxtf_get_sn(handle)) /************************************************************************/ 输入 Handle -- smart card 句柄 通讯示例: // if(bresult!=SMC_NO_ERROR) if((pbword[0]!=0x90)||(pbword[1]!=0x00)) /************************************************************************/ 输入 Handle -- smart card 句柄 通讯示例: 80 44 00 00 08 44 static bool yxtf_get_prov(Smart_Handle_t Handle) int provcount=0; cmdlen = 5+cmd[4];
输入 Handle -- smart card 句柄 通讯示例:
U8 nextreadsize=0; bresult=yxtf_transfer(Handle,cmd,cmdlen,response,&replen,pbword); // if(bresult!=SMC_NO_ERROR) if((pbword[0]&0xf0)!=0x60) pstYxtfInfo->uCardNumber=(response[0]<<24)+(response[1]<<16)\
输入 Handle -- smart card 句柄 通讯示例: static bool yxtf_check_pairing(Smart_Handle_t Handle) pstYxtfInfo->paringflag = 0; return true;
|
|
linhomel
等级:新手上路
文章:3
积分:10
注册:2003年6月4日
威望:1 点
|
小 大 板凳 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
输入 Handle -- smart card 句柄 pairingcode -- 4字节的配对信息,卡和 80 4C 00 00 04 4C xx xx xx xx bool yxtf_pairing(Smart_Handle_t Handle, U8* pairingcode)// pairingcode 4字节的配对信息, writelen = cmd1[4]+5; if((status[0]==0x90)||(status[1]==0x00)) return false; } /************************************************************************/ 输入 Handle -- smart card 句柄 buf -- ECM信息,从0x80/0x81开始 bool yxtf_parse_ecm(Smart_Handle_t Handle,U8* buf,U8* pucCW) for (i=0; i<(buf[2]+3); i++)//找到真正要往卡里送的数据 writelen = pbuf[4]+5; if (replen >= 2) //printf("rsp len = %d\n", replen); return true; /************************************************************************/ 输入 Handle -- smart card 句柄 data -- EMM信息,len -- 数据长度 bool yxtf_parse_emm(Smart_Handle_t Handle,U8* data,U16 len) writelen = data[15]+5; return true; /************************************************************************/ 输入 Handle -- smart card 句柄,ins -- 要传送的数据,NumberToWrite -- error = Smart_Transfer(Handle,ins,NumberToWrite,Response,0,Read,Status); /************************************************************************/ 输入 Handle -- smart card 句柄,len -- 要从智能卡中读取的数据长度 memset(reponse,0,255); // if(bresult!=SMC_NO_ERROR) if((pbword[0]==0x90)&&(pbword[1]==0x00)&&(replen==len))
/****************************************************** #ifndef _smsx_h_ #include "sc_def.h" typedef struct }Smsx_Info_t;
#endif /* _smsx_h_ */ |
|
左脚踩右脚,一蹦三丈高
等级:新手上路
文章:14
积分:24
注册:2008年5月14日
威望:0 点
|
小 大 木地板 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
|
|
cnfeihong
等级:业余侠客
文章:60
积分:386
注册:2005年10月15日
威望:1 点
|
小 大 第 5 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
|
|
塔尔诺夫斯基
等级:新手上路
文章:71
积分:84
注册:2008年4月28日
威望:3 点
|
小 大 第 6 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
晕!刚试过可以通啊! 就是没看懂! 你一个文件一个文件的来! 不用谢了!呵呵 |
|
jzheng
等级:新手上路
文章:6
积分:36
注册:2006年8月18日
威望:0 点
|
小 大 第 7 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
这段东西怎么用法啊,楼主不能光发了帖子,没个使用说明啊,如何知道是真的假的啊?? [em145][em145] |
|
xiaofeixia
等级:新手上路
文章:18
积分:90
注册:2007年3月26日
威望:0 点
|
小 大 第 8 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
|
|
happypaay
等级:新手上路
文章:14
积分:26
注册:2008年8月18日
威望:2 点
|
小 大 第 9 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
不知道要在哪个平台上编译 |
|
happypaay
等级:新手上路
文章:14
积分:26
注册:2008年8月18日
威望:2 点
|
小 大 第 10 楼 个性首页 QQ 邮箱 主页 发短信 加为好友 |
|
貌似有几个函数的原型没有给出来哦 只是给了接口 |
|