我用的是SLE4442的IC卡,卡片存储区内的起始地址是多少?
我默认起始地址为0,可我读卡时长度只能到128(长度为256字节),超过128就报地址错误.
出厂初始密码是多少?我用读密码函数读出的是000000,但这肯定是错误的.
如何写卡?如何验证密码?
请高手指教,分不够我可以再开贴子给分.

解决方案 »

  1.   

    这种IC卡一般都只有通过厂商的文档,接口才知道的,或者别人有用过才知道,
    一般 不知道建议 楼主去咨询厂商。读取密码,验证密码肯定有相应的函数 或者DLL,文档的,按照里面的声明去做,应该OK 的。。
      

  2.   

    不知道IC卡的格式也说不出来。并且每个厂家的IC卡读与写的函数名提供的也不一样。厂家应该会提公DLL、使用文档给你的。并且加密的方式也不知道最重要就是要从厂家哪里得到资料。
      

  3.   

    我写进去的是asc码,但读出的怎么是乱的?
      

  4.   

    我用的是SLE4442的IC卡,卡片存储区内的起始地址是多少?
    我默认起始地址为0,可我读卡时长度只能到128(长度为256字节),超过128就报地址错误.
    出厂初始密码是多少?我用读密码函数读出的是000000,但这肯定是错误的.
    如何写卡?如何验证密码?
    请高手指教,分不够我可以再开贴子给分.
    SLE4442卡为256字节加密卡卡片存储区内的起始地址是0x20出厂密码是FFFFFF下面是我拷贝的相关函数写操作函数: swr_4442()
    读操作函数: srd_4442()
    测卡型函数: chk_4442()
    效验密码函数: csc_4442()
    读取密码函数: rsc_4442()
    更改密码函数: wsc_4442()
    读密码错误计数: rsct_4442()
    写保护位函数: pwr_4442()
    读保护位函数: prd_4442()
    int swr_4442(int icdev, int offset, int len, unsigned char *w_string)
    说明:向指定地址写数据
    调用:icdev:通讯设备标识符 
    offset: 偏移地址,其值范围0~255
    len:字符串长度,其值范围1~256
    w_string: 写入数据
    返回: <0 错误
    =0 正确int srd_4442(int icdev, int offset, int len, unsigned char* r_string )
    说明:从指定地址读数据 
    调用:icdev:通讯设备标识符 
    offset: 偏移地址,其值范围0~255len:字符串长度,其值范围1~256 
    r_string: 读出数据所存放地址指针
    返回: <>0 错误
    =0int chk_4442(int icdev)
    说明:检查卡型是否正确 
    调用:icdev: 通讯设备标识符 
    返回: <0 错误
    =0 正确
    读写SLE4442卡范例
    下面C语言范例,首先测试是否有SLE4442卡插入读写器。若有,核对密码,然后进行读写操作,并比较两次操作数据是否相同,若相同,返回操作正确。#include <stdio.h>
    #include "mwic.h"int main()
    {
    int i,st;
    unsigned char ch1[100],ch2[100];
    int icdev;
    //intialize COM2 with baud rate 9600
    icdev=auto_init(1,9600);
    if(icdev<0)
    {
    printf("initialize error !\n");
    return(icdev);
    }
    //check whether SLE4442 card inserted
    st=chk_4442(icdev);
    if(st)
    {
    printf("Wrong card or have no card inserted !\n");
    return(st);
    }
    ch1[0]=0xb6;
    ch1[1]=0x23;
    ch1[2]=0x07;
    //Compare secury code
    st=csc_4442(icdev,3,ch1);if(st)
    {
    printf("Compare secury code error !\n");
    return(st);
    }
    //initialize char ch1 and ch2
    for(i=0;i<100;i++)
    {
    ch1[i]=i;
    ch2[i]=0xff;
    }
    //Write ch1 to card with offset=0x20,len=100
    st=swr_4442(icdev,0x20,100,ch1);
    if(st)
    {
    printf("Write error !\n");
    return(st);
    }
    //Read form card and stroe in ch2 with offset=0x20,len=100
    st=srd_4442(icdev,0x20,100,ch2);
    if(st)
    {
    printf("Read error !\n");return(st);
    }
    //Compare ch1 with ch2
    for(i=0;i<100;i++)
    {
    if(ch1[i]!=ch2[i])
    {
    printf("Compare error !\n");
    return(st);
    }
    }
    printf("OK !\n");
    return(0);
    }
    int csc_4442(int icdev, int len, unsigned char* p_string)
    说明:核对卡密码 
    调用:icdev:通讯设备标识符 
    len:密码个数,其值为3
    p_string: 密码字符串指针
    返回: <0 错误
    =0 密码正确int wsc_4442(int icdev, int len,unsigned char* p_string)
    说明:改写卡密码
    调用:icdev:通讯设备标识符 
    len:密码个数,其值为3
    p_string: 新密码地址指针
    返回:<0 错误
    =0 正确int rsc_4442(int icdev, int len, unsigned char* p_string)
    说明:读出卡密码 
    调用:icdev:通讯设备标识符 
    len:密码个数,其值为3
    p_string: 存放密码地址指针
    返回:<>0 错误
    =0 正确int rsct_4442(int icdev, int* counter)
    说明:读出密码错误计数器值
    调用:icdev:通讯设备标识符
    counter:密码错误记数值存放指针
    返回: <0 错误
    >=0 正确SLE4442密码操作范例:下面C语言范例,首先测试是否有SLE4442卡插入读写器。若有,核对密码并读取错误计数,然后改写密码并回读,比较两次操作数据是否相同,若相同,返回操作正确。#include <stdio.h>
    #include "mwic.h"
    int main()
    {
    int i,st;
    unsigned char ch1[100],ch2[100];
    int icdev;
    //intialize COM2 with baud rate 9600
    icdev=auto_init(1,9600);
    if(icdev<0)
    {
    printf("initialize error !\n");
    return(icdev);
    }
    //check whether SLE4442 card inserted
    st=chk_4442(icdev);if(st)
    {
    printf("Wrong card or have no card inserted !\n");
    return(st);
    }
    ch1[0]=0xb6;
    ch1[1]=0x23;
    ch1[2]=0x07;
    //Compare secury code
    st=csc_4442(icdev,3,ch1);
    if(st)
    {
    printf("Compare secury code error !\n");
    return(st);
    }
    //Read error counter
    st=rsct_4442(icdev,&i);
    if(st)
    {
    printf("Read error counter error !\n");
    return(st);
    }
    printf(揺rror counter = %d\n?i);
    ch1[0]=0xaa;ch1[1]=0xaa;
    ch1[2]=0xaa;
    //Change security code with 0xaaaaaa
    st=wsc_4442(icdev,3,ch1);
    if(st)
    {
    printf("Write security code error !\n");
    return(st);
    }
    printf(揘ew security code is 0xaaaaaa\n?;
    //Read security code
    st=rsc_4442(icdev,3,ch2);
    if(st)
    {
    printf("Read security code error !\n");
    return(st);
    }
    //Compare ch1 with ch2
    for(i=0;i<3;i++)
    {
    if(ch1[i]!=ch2[i])
    {
    printf("Compare error !\n");return(st);
    }
    }
    printf("OK !\n");
    return(0);
    }
      

  5.   

    我用的是SLE4442的IC卡,卡片存储区内的起始地址是多少?
    我默认起始地址为0,可我读卡时长度只能到128(长度为256字节),超过128就报地址错误.
    出厂初始密码是多少?我用读密码函数读出的是000000,但这肯定是错误的.
    如何写卡?如何验证密码?SLE4442的IC卡,卡片存储区内的起始地址是多少?  255个字节!其余问题,在SLE4442自带的一个开发盘里都可以找到相应的函数!