52梯控论坛
标题:
CPU卡操作函数
[打印本页]
作者:
Never-stop
时间:
2018-4-20 11:06
标题:
CPU卡操作函数
本帖最后由 Never-stop 于 2018-4-20 11:07 编辑
CPU卡与传统的MifareOne系列卡相比,具有更加安全、复杂的认证机制,这就意味着CPU卡的读写操作在软件开发中变得更加的复杂。我们这些复杂的操作封装成5个通用的函数,与我们的CPU读写器相结合,让您十分钟就搞定CPU的读写操作。
//'CPU卡寻卡及将卡复位到14443A-4的指令状态
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpurequest")]
static extern byte cpurequest(byte[] serial, byte[] param, byte[] cosver, byte[] code);
//-----------------------------------------------------------------------------------------------------------------------------
//初始化函数,(ctrlword是否需要先清空卡,不需要清空的话,可以需输入卡密码,卡密码长度)ctrlword_0是否先清空卡,分配空间(字节数),
//Public Declare Function cpursinit Lib "OUR_MIFARE.dll" (ByVal ctrlword As Byte, ByVal key As Long, ByVal keylen As Byte, ByVal customsize As Long) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpursinit", CallingConvention = CallingConvention.StdCall)]
static extern byte cpursinit(byte ctrlword, byte[] key, byte[] keylen, Int32 customsize);
//-----------------------------------------------------------------------------------------------------------------------------
//增加文件(文件序号0~5,文件只读密码:长度,文件读写密码,长度,分配空间)
//Public Declare Function cpursfileadd Lib "OUR_MIFARE.dll" (ByVal fileno As Byte, ByVal readonlykey As Long, ByVal readonlykeylen As Byte, ByVal writekey As Long, ByVal writekeylen As Byte, ByVal customsize As Long) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpursfileadd", CallingConvention = CallingConvention.StdCall)]
static extern byte cpursfileadd(byte fileno, byte[] readonlykey, byte[] readonlykeylen, byte[] writekey, byte[] writekeylen, Int32 customsize);
//-----------------------------------------------------------------------------------------------------------------------------
//'修改文件密码,修改后,请妥慎记住,否则该文件将无法再用
//Public Declare Function cpursfilekeychg Lib "OUR_MIFARE.dll" (ByVal fileno As Byte, ByVal keytype As Byte, ByVal oldkey As Long, ByVal oldkeylen As Byte, ByVal newkey As Long, ByVal newkeylen As Byte) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpursfilekeychg", CallingConvention = CallingConvention.StdCall)]
static extern byte cpursfilekeychg(byte fileno, byte keytype, byte[] oldkey, byte[] oldkeylen, byte[] newkey, byte[] newkeylen);
//-----------------------------------------------------------------------------------------------------------------------------
//'修改卡密码,卡密码和文件没有任何关系,卡密码只是用来清空卡,读和写文件是无效的。
//Public Declare Function cpurscardkeychg Lib "OUR_MIFARE.dll" (ByVal oldkey As Long, ByVal oldkeylen As Byte, ByVal newkey As Long, ByVal newkeylen As Byte) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpurscardkeychg", CallingConvention = CallingConvention.StdCall)]
static extern byte cpurscardkeychg(byte fileno, byte[] readonlykey, byte[] readonlykeylen, byte[] writekey, byte[] writekeylen, Int32 customsize);
//-----------------------------------------------------------------------------------------------------------------------------
//读文件数据(文件序号,读写密码,密码长度,读取起始位置,读取长度,读出内容)
//Public Declare Function cpursfiledataread Lib "OUR_MIFARE.dll" (ByVal fileno As Byte, ByVal keytype As Byte, ByVal key As Long, ByVal keylen As Byte, ByVal startaddr As Long, ByVal databuf As Long, ByVal datalen As Long) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpursfiledataread", CallingConvention = CallingConvention.StdCall)]
static extern byte cpursfiledataread(byte fileno, byte keytype, byte[] rwkey, byte[] rwkeylen, Int32 startaddr, byte[] databuf, Int32 datalen);
//-----------------------------------------------------------------------------------------------------------------------------
//写文件数据(文件序号,文件读写密码,密码长度,写入起始位置,写入长度,写入内容)
//Public Declare Function cpursfiledatawrite Lib "OUR_MIFARE.dll" (ByVal fileno As Byte, ByVal keytype As Byte, ByVal key As Long, ByVal keylen As Byte, ByVal startaddr As Long, ByVal databuf As Long, ByVal datalen As Long) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpursfiledatawrite", CallingConvention = CallingConvention.StdCall)]
static extern byte cpursfiledatawrite(byte fileno, byte keytype, byte[] rwkey, byte[] rwkeylen, Int32 startaddr, byte[] databuf, Int32 datalen);
//-----------------------------------------------------------------------------------------------------------------------------
//修改卡密码,卡密码和文件没有任何关系,卡密码只是用来清空卡,读和写文件是无效的。
//Public Declare Function cpurscardkeychg Lib "OUR_MIFARE.dll" (ByVal oldkey As Long, ByVal oldkeylen As Byte, ByVal newkey As Long, ByVal newkeylen As Byte) As Byte
[DllImport("OUR_MIFARE.dll", EntryPoint = "cpurscardkeychg", CallingConvention = CallingConvention.StdCall)]
static extern byte cpurscardkeychg(byte[] oldkey, byte[] oldlen, byte[] newkey, byte[] newlen);
来自网络
作者:
胆小的鱼
时间:
2018-4-20 11:13
有点高深了,不适合普通IC爱好者!
适合那些开发者
作者:
463924575
时间:
2018-4-20 11:26
看不懂啊 ,来点实际的呗
作者:
普洱印象
时间:
2018-4-20 11:42
我们只需要看懂每个电梯卡的数据(复制大家都会了)。知道怎么修改数据就OK了,开发数据就免了。
作者:
yangjunwl2
时间:
2018-4-20 13:05
直接看不懂,倒地。
作者:
疾风丶
时间:
2018-4-21 19:41
谢谢,学习了
作者:
陌上霜
时间:
2018-4-21 19:51
我说怎么疾风 都是疾风 还是疾风 跟着疾风来学习 赚积分
作者:
ghs
时间:
2018-4-21 19:54
路过看看
作者:
410562447
时间:
2018-4-21 20:27
作者:
radish
时间:
2018-4-22 00:29
这个我觉得这辈子我都不愿意去研究
作者:
申花电器
时间:
2018-4-22 07:31
谢谢,学习了
作者:
长工
时间:
2018-4-25 00:56
太高深,看不懂
作者:
888
时间:
2018-4-25 08:01
开发数据一般人用不上。
作者:
tonywithtony
时间:
2018-8-5 13:09
不错 能否一起研究cpu卡?
作者:
普洱印象
时间:
2018-8-5 15:43
CPU有人在研究破解,我们论坛还没有研究成果出来。
作者:
卡卡之家
时间:
2018-9-14 23:11
小手一抖,一分到手~
作者:
xintao
时间:
2018-9-15 10:24
太高深了看不懂
作者:
亲爱的路人
时间:
2019-9-12 12:18
作者:
wyrw003
时间:
2019-9-12 16:10
我是来学习滴
作者:
阿汤哥哥哥
时间:
2019-9-12 16:47
一头雾水啊
作者:
boayuwei
时间:
2019-12-31 08:11
作者:
jiqimao135
时间:
2024-6-15 01:34
好难啊
欢迎光临 52梯控论坛 (https://52tikong.com/)
Powered by Discuz! X3.4