分享:身份证阅读器在ARM Linux系统调用libwlt2bmp.so解码库实现身份证头像解码

头像解码库:libwlt2bmp.so

照片文件名:photo.bmp

原始身份证相片数据:574C66007E00320000F........(此处省略)

调用身份证阅读器Linux开发包,然后调用libwlt2bmp.so解码库文件,传入身份证原始相片1024字节的加密信息,即可出来下面的明文相片信息。

测试X86_X64、ARM等有效。

分享:身份证阅读器在ARM Linux系统调用libwlt2bmp.so解码库实现身份证头像解码_第1张图片

以下编译工具实测有效。

arm-poky-linux-gnueabi-gcc
arm-xmv2-linux-uclibcgnueabi
gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf-32位
gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf-32位
gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf
gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu
gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu
SDK-6.4-aarch64-cortexa53-linux-gnu

分享:身份证阅读器在ARM Linux系统调用libwlt2bmp.so解码库实现身份证头像解码_第2张图片
 


typedef int (*wltdecode)(unsigned char *src, int nlen, unsigned char *dst, int *cbDst);
char imagePath[256] = "./photo.bmp";  //照片文件名


static int writePhoto(unsigned char photo[], unsigned char *bmpfileData, const char *image_file)
{
    int ret = 0;
    int nlen;
    int i, offset;
    unsigned char tmp[5] = {0};
    unsigned char *imageData = bmpfileData;

    char outbmpdata[40960] = {0};

    // printf("image_file = %s\n",image_file) ;

    wltdecode_t pFun = NULL;
    void *handle = dlopen("./libwlt2bmp.so", RTLD_LAZY);
    if (NULL == handle)
    {
        printf("调用相片解码库失败,返回值:%s.\n", dlerror());
        return 0;
    }

    pFun = (wltdecode_t)dlsym(handle, "_Unpack");
    if (NULL == pFun)
    {
        printf("pFun = (wltdecode) dlsym(handle, _Unpack == NULL \n");
        dlclose(handle);
        return 0;
    }

    if ((ret = (*pFun)((char *)photo, 1024, outbmpdata, &nlen)) == 1)
    {
        FILE *fpWrite = NULL;
        fpWrite = fopen(image_file, "wb");
        if (NULL != fpWrite)
        {
            fwrite(outbmpdata, 1, nlen, fpWrite);
            fclose(fpWrite);
        }
        else
        {
            printf("相片解码失败\n");
        }
    }
    else
    {

        // printf("ret = %d\n",ret) ;
    }
    dlclose(handle);
    return 0;
}

int main()
{
//广东东信智能科技有限公司
//EST-100多功能智能卡读写器
//照片原始数据示例
    char pic1024[1024*5]="111166888800111100FF85175151513E710DD564F335902D039CB4F2528DBAF0CC39213ED161D92FA5A926C853ECD2A1012F80DF523E1BC5256084DDADBE510C3A46E08DD31B3BC495A2DE1B7506FE57D4C27151AEDC5251515A3E9246D6C208748C2D3A5BCCE7451E57929F31522C75FDABEECBD6C8557372BF9181CE1EE460E1111FE8E77B1AA6902E1E41A28F479888839CA6BC73B4874295BFB7A6D839EADBF54D6C8E4AC63041D32A07045EDF136A8175A6F22A538A017293140904FC1111F3AAB75EC0404F58744D5FA8AD714F71573819625ED9EA15E715F4140035E337D55FAA0AA434D10F4542C5BCD80D526C1FE8AC62336BCDDB8A2BFDB29E33A96E287AD75983C11C24348D7B5779775E4B9D8F7A51111126ED5C1723B325F22B3ADB810A4D1111143D9F92FC23BECD204F8B76943F70A128C0E6AB07CB57FB2F61C4B45D6102D256E93AB59B5F228A58F33141825C6C617E5ADB2D186F7481D145A9167213FF450C5F1AE749344415B5CBD2DD608906DD30835D7D59F5BB1B5B80A38740E63AFFA6A4638B7426869B79FBA120EF925D9BFBC56918B79D9993D08DA9AD81171AD9F6357EF3F9549BE8088C08F30EFC160B85BA8A07EBBB9CB25DEAAAD7F3FB21444A0AD8ED6949499D01111029B06E040CFD84FC3D7C4847887BB993334FA0437624B0BE7C318AD02A73580A8029829760039986DA8BEA1192B502726391E9B598AD50D33FE917028716E1316098A24E64851E1568E410EC0BA1E6FC6605FB33894B02E48BA5BC30542DCF352F9836C3B7736C5D5BD2F12CB56436220111118B632908CA8336C4BE3A5CFDDD4B7C109BC5E983C3AE512A23F9BFB4C839491057CC502B2EB5D092EB9DCB2BA890D45AF3A9D9AC98888630963CB4F99A00D1E5C6C510F82055FFDCB3B69DCDFBBC3C8C766CDF59AF8EC68D95E1498C66796D6A686D511D3234990D9A22DF2213E7A06F3A60828F98824A15C350CF94B06B2E6FBD165D0CAA0897C4AC4F9783CB356814D52B8E4C11FB67287282F27777B1785AB0B22EF45BCD51C47D16F2A148DF57D1EDAFF71EBE481E6DC7DF495B562E899417BFD5FC8F43FDEA29B5250E5F275B62DD4E09FC06239D6AEA6CBF0075762E9FBA2AFC35F01BA9D2BA02878A78ED1767585170E990DD42FA0E1EF25E82BEFB3FE6BD5C394C3509EE70938119B284A45E67CAC44DC57ABE6711D60E7CB8B2A45A3EA6016C3DCE110A12A6AE51B03EAFF5665DB259D38F0F77B98DDFB476A55519E7680E2A797154416028888136F82DE0A516F8F49790145E9B0B46CB01E6A92218AE512393E8EFEE8126CF0401B34198125A3EC64EA738CF8820C5E22EACB3853A2CF2CEA7768F2B3B6147C8F424B89C92CCE20103839E0B6F6424022DEDE4C09D8A55D51111C6BCBD6D03A2E1769645A5248DBEFD9F0E02601234";

        unsigned char temp[300];
	unsigned char OutReport[2048];
	unsigned char Response_APDU[1024] = {0};
	int t_nCmdLen;
	unsigned char t_arrCmdRe[1024] = {0};
	char t_arrCmdSend[1024] = {0};
	t_nCmdLen = util_putHex2Char(pic1024, t_arrCmdSend, 0);
       unsigned char t_charTempEDZ[5 * 1024 * 1024] = {0} ;
       writePhoto(t_arrCmdSend, t_charTempEDZ, imagePath);
       return 0 ;
}

你可能感兴趣的:(linux,相片解码,libwlt2bmp.so,身份证阅读器,开发)