經(jīng)典USB免驅(qū)全協(xié)議IC卡讀寫器讀取FM1208CPU卡。
FM1208CPU卡是一款由上海復(fù)旦微電子股份有限公司(Fudan Microelectronics Group, FMG)研發(fā)的高端智能非接觸CPU卡芯片。以下是對(duì)該產(chǎn)品的詳細(xì)介紹:
一、技術(shù)特點(diǎn)
1.先進(jìn)工藝:FM1208采用先進(jìn)的超深亞微米EEPROM工藝技術(shù)制造,具有高性能和穩(wěn)定性。
大容量存儲(chǔ):該芯片擁有64K Byte EEPROM的存儲(chǔ)容量,可以支持多種應(yīng)用,如公交結(jié)算、小額支付等金融行業(yè)應(yīng)用,實(shí)現(xiàn)一卡多種功能。
2.高安全性:芯片內(nèi)置硬件DES協(xié)處理器,支持Triple-DES加密,提供比普通卡片更高的安全性。同時(shí),芯片和卡片操作系統(tǒng)(COS)的協(xié)同安全技術(shù)為CPU卡提供了雙重的安全保證,有效防止金融交易中的數(shù)據(jù)錯(cuò)誤,保護(hù)消費(fèi)者交易的私密性、安全性及個(gè)人利益。
3.廣泛兼容性:FM1208符合ISO14443 Type A標(biāo)準(zhǔn)和ISO/IEC 7816-5規(guī)范,可以兼容現(xiàn)有的非接觸邏輯加密卡,如市場(chǎng)上廣泛應(yīng)用的S50等,方便在已有應(yīng)用下的升級(jí)和擴(kuò)展。
二、功能與應(yīng)用
功能強(qiáng)大:FM1208不僅具有數(shù)據(jù)存儲(chǔ)功能,還具有命令處理、計(jì)算和數(shù)據(jù)加密等功能。其內(nèi)置的卡片操作系統(tǒng)(COS)使得該芯片相當(dāng)于一臺(tái)微型計(jì)算機(jī),可以根據(jù)實(shí)際應(yīng)用情況靈活改變系統(tǒng),滿足客戶的不同需求。
應(yīng)用領(lǐng)域廣泛:FM1208CPU卡廣泛應(yīng)用于城市公交、一卡通、高速公路卡、小額消費(fèi)卡、校園卡、金融支付電子錢包、身份認(rèn)證等領(lǐng)域。其高安全性、大容量和廣泛兼容性使得該芯片在這些領(lǐng)域中具有顯著的優(yōu)勢(shì)。
三、性能指標(biāo)
通信協(xié)議:支持ISO 14443-A協(xié)議,工作頻率為13.56MHz。
數(shù)據(jù)傳輸速率:支持高達(dá)106Kbps的數(shù)據(jù)傳輸速率。
程序存儲(chǔ)器:32K x 8bit ROM。
數(shù)據(jù)存儲(chǔ)器:8K x 8bit EEPROM,滿足10萬次擦寫和10年數(shù)據(jù)保存指標(biāo)。
內(nèi)置RAM:256 x 8bit iRAM和384 x 8bit xRAM。
工作距離:不小于10CM。
識(shí)別時(shí)間:識(shí)別一張卡的時(shí)間約為3ms(包括復(fù)位應(yīng)答和防沖突)。
EEPROM擦寫時(shí)間:約為2.4ms。
典型交易過程:小于350ms。
四、市場(chǎng)應(yīng)用與反饋
FM1208CPU卡已在多個(gè)城市大面積推廣,如重慶的掌中行、合肥的一卡通等。特別是上海公共交通方面的試點(diǎn),為非接觸CPU卡在長(zhǎng)江三角洲乃至全國(guó)的公交領(lǐng)域的應(yīng)用推廣起到了示范和推動(dòng)作用。該產(chǎn)品的推出和應(yīng)用,不僅提高了城市區(qū)域經(jīng)濟(jì)合作水平,還實(shí)現(xiàn)了城際間的互聯(lián)互通,加強(qiáng)了城市間的聯(lián)系。
綜上所述,F(xiàn)M1208CPU卡憑借其先進(jìn)的技術(shù)特點(diǎn)、廣泛的應(yīng)用領(lǐng)域以及卓越的性能指標(biāo),在智能卡市場(chǎng)中占據(jù)了重要地位。
QT小程序UI界面:
QT小程序mainWindow.cpp代碼:
static bool checkinput(QString inputstr){ QString inputyes="0123456789abcdefABCDEF"; for(int i=0;isetupUi(this); QPalette pa; pa.setColor(QPalette::WindowText,QColor(255, 0, 0)); ui->label_7->setPalette(pa); ui->label_8->setPalette(pa); ui->label_9->setPalette(pa); ui->label_19->setPalette(pa); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pb_beep_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; if (mypcdbeep != NULL){ //是否成功連接上 pcdbeep()函數(shù) status = mypcdbeep(30); if(status==0){ } else { disperrinf(status); } } else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘pcdbeep’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_getdevnum_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char devicenumber[4]; //設(shè)備編號(hào)緩沖 unsigned char status; //函數(shù)返回狀態(tài) if (mypcdgetdevicenumber != NULL){ //是否成功連接上 pcdgetdevicenumber()函數(shù) status = mypcdgetdevicenumber(devicenumber); if(status==0){ mypcdbeep(30); QMessageBox::information(NULL, "提示", QString::asprintf("設(shè)備編號(hào):%03d-%03d-%03d-%03d", devicenumber[0],devicenumber[1],devicenumber[2],devicenumber[3])); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘pcdgetdevicenumber’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_request_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char mypiccserial[4]; //卡序列號(hào) unsigned char myparam[4]; //參數(shù) unsigned char myver[1]; //版本 unsigned char mycode[1]; //廠商代碼(復(fù)旦為90) unsigned char status; //函數(shù)返回狀態(tài) if (mycpurequest != NULL){ //是否成功連接上 cpurequest()函數(shù) status = mycpurequest(mypiccserial,myparam,myver,mycode); if(status==0 || status==52){ mypcdbeep(30); QString uidstr=QString::asprintf("%02X%02X%02X%02X", mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]); QString parstr=QString::asprintf("%02X%02X%02X%02X", myparam[0],myparam[1],myparam[2],myparam[3]); QString verstr=QString::asprintf("%02X", myver[0]); QString codestr=QString::asprintf("%02X", mycode[0]); ui->lineEdit_uid->setText(uidstr); QMessageBox::information(NULL, "提示", "卡號(hào):"+uidstr+",參數(shù):"+parstr+",版本號(hào):"+verstr+",廠商代碼:"+codestr+" 的CPU卡已激活進(jìn)入14443-4協(xié)議模式,可以繼續(xù)以下的功能操作!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpurequest’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_init_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char ctrlword; //是否先清空卡 unsigned char mylen[1]; //密鑰長(zhǎng)度 unsigned char keybuf[20]; //密鑰 int keylen; int spacesize; //空間大小 if(ui->checkBox_clear->isChecked()){ ctrlword=1; }else{ctrlword=0;} QString writinf = ui->lineEdit_cardkey->text().trimmed(); keylen=checkhexdata(writinf,keybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制卡密碼!"); ui-?>lineEdit_cardkey->setFocus(); return; } mylen[0]=keylen; spacesize=ui->spinBox_maxsize->value(); if (mycpursinit != NULL){ //是否成功連接上 cpursinit()函數(shù) status = mycpursinit(ctrlword,keybuf,mylen,spacesize); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "CPU卡初始化成功!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursinit’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_addeasyfile_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char readkeylen[1]; //只讀密鑰長(zhǎng)度 unsigned char readkeybuf[20]; //只讀密鑰 unsigned char rwkeylen[1]; //讀寫密鑰長(zhǎng)度 unsigned char rwkeybuf[20]; //讀寫密鑰 int keylen; int spacesize; //空間大小 QString keystr; fileno=ui->comboBox_addfile->currentIndex(); //新增加的文件號(hào) keystr = ui->lineEdit_readkey->text().trimmed(); keylen=checkhexdata(keystr,readkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件只讀密碼!"); ui-?>lineEdit_readkey->setFocus(); return; } readkeylen[0]=keylen; keystr = ui->lineEdit_rwkey->text().trimmed(); keylen=checkhexdata(keystr,rwkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件讀寫密碼!"); ui-?>lineEdit_rwkey->setFocus(); return; } rwkeylen[0]=keylen; spacesize=ui->spinBox_2->value(); if (mycpursfileadd_s != NULL){ //是否成功連接上 cpursfileadd_s()函數(shù) status = mycpursfileadd_s(fileno,readkeybuf,readkeylen,rwkeybuf,rwkeylen,spacesize); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "CPU卡創(chuàng)建易寫文件成功,需要使用易寫函數(shù)寫入文件數(shù)據(jù)!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfileadd_s’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_addfile_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char readkeylen[1]; //只讀密鑰長(zhǎng)度 unsigned char readkeybuf[20]; //只讀密鑰 unsigned char rwkeylen[1]; //讀寫密鑰長(zhǎng)度 unsigned char rwkeybuf[20]; //讀寫密鑰 int keylen; int spacesize; //空間大小 QString keystr; fileno=ui->comboBox_addfile->currentIndex(); //新增加的文件號(hào) keystr = ui->lineEdit_readkey->text().trimmed(); keylen=checkhexdata(keystr,readkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件只讀密碼!"); ui-?>lineEdit_readkey->setFocus(); return; } readkeylen[0]=keylen; keystr = ui->lineEdit_rwkey->text().trimmed(); keylen=checkhexdata(keystr,rwkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件讀寫密碼!"); ui-?>lineEdit_rwkey->setFocus(); return; } rwkeylen[0]=keylen; spacesize=ui->spinBox_2->value(); if (mycpursfileadd != NULL){ //是否成功連接上 cpursfileadd()函數(shù) status = mycpursfileadd(fileno,readkeybuf,readkeylen,rwkeybuf,rwkeylen,spacesize); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "CPU卡創(chuàng)建標(biāo)準(zhǔn)文件成功,需使用寫標(biāo)準(zhǔn)文件函數(shù)寫入數(shù)據(jù)!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfileadd’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_changkey_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char ctrlword; //控制字 unsigned char oldkeylen[1]; //舊密鑰長(zhǎng)度 unsigned char oldkeybuf[20]; //舊密鑰 unsigned char newkeylen[1]; //新密鑰長(zhǎng)度 unsigned char newkeybuf[20]; //新密鑰 int keylen; QString keystr; fileno=ui->comboBox_changekeyfile->currentIndex(); //要更改密鑰的文件號(hào) if(ui->comboBox_changekey->currentIndex()==0){ ctrlword=NEWKEYR; //更改只讀密碼 }else{ctrlword=NEWKEYWR;} //更改讀寫密碼 if(ui->comboBox_authkey->currentIndex()==0){ ctrlword=ctrlword+OLDKEYR; //用只讀密碼來認(rèn)證 }else{ctrlword=ctrlword+OLDKEYWR;} //用讀寫密碼來認(rèn)證 keystr = ui->lineEdit_authkey->text().trimmed(); keylen=checkhexdata(keystr,oldkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件認(rèn)證密碼!"); ui-?>lineEdit_authkey->setFocus(); return; } oldkeylen[0]=keylen; keystr = ui->lineEdit_newkey->text().trimmed(); keylen=checkhexdata(keystr,newkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件新密碼!"); ui-?>lineEdit_newkey->setFocus(); return; } newkeylen[0]=keylen; if (mycpursfilekeychg != NULL){ //是否成功連接上 cpursfilekeychg()函數(shù) status = mycpursfilekeychg(fileno,ctrlword,oldkeybuf,oldkeylen,newkeybuf,newkeylen); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "修改文件密碼成功"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfilekeychg’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_read_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char ctrlword; //控制字 unsigned char oldkeylen[1]; //舊密鑰長(zhǎng)度 unsigned char oldkeybuf[20]; //舊密鑰 int staradd; //讀寫起始地址 int datalen; //讀寫長(zhǎng)度 unsigned char rwbuf[8000]; //讀寫數(shù)據(jù)緩沖 int keylen; QString keystr; fileno=ui->comboBox_rwfile->currentIndex(); //要讀寫的文件號(hào) staradd=ui->spinBox_rwbegin->value(); //讀寫起始地址 datalen=ui->spinBox_rwlen->value(); //讀寫數(shù)據(jù)長(zhǎng)度 if(datalen1 || datalen?>255){ QMessageBox::critical(NULL, "提示", "每次讀卡最多255字節(jié),請(qǐng)輸入正確的讀卡長(zhǎng)度!"); ui->spinBox_rwlen->setFocus(); return; } if(ui->comboBox_authrwkey->currentIndex()==0){ ctrlword=OLDKEYR; //用只讀密碼來認(rèn)證 }else{ctrlword=OLDKEYWR;} //用讀寫密碼來認(rèn)證 keystr = ui->lineEdit_authkey2->text().trimmed(); keylen=checkhexdata(keystr,oldkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件認(rèn)證密碼!"); ui-?>lineEdit_authkey2->setFocus(); return; } oldkeylen[0]=keylen; if (mycpursfiledataread != NULL){ //是否成功連接上 cpursfiledataread()函數(shù) status = mycpursfiledataread(fileno,ctrlword,oldkeybuf,oldkeylen,staradd,rwbuf,datalen); if(status==0 ){ mypcdbeep(30); QString datastr=""; for(int i=0;iplainTextEdit->setPlainText(datastr); QMessageBox::information(NULL, "提示", "讀取數(shù)據(jù)成功!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfiledataread’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_write_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char ctrlword; //控制字 unsigned char oldkeylen[1]; //舊密鑰長(zhǎng)度 unsigned char oldkeybuf[20]; //舊密鑰 int staradd; //讀寫起始地址 int datalen; //讀寫長(zhǎng)度 unsigned char rwbuf[8000]; //讀寫數(shù)據(jù)緩沖 int keylen; QString keystr; QString datastr; keystr = ui->lineEdit_authkey2->text().trimmed(); keylen=checkhexdata(keystr,oldkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件認(rèn)證密碼!"); ui-?>lineEdit_authkey2->setFocus(); return; } oldkeylen[0]=keylen; datastr = ui->plainTextEdit->toPlainText().trimmed(); datalen=checkhexdata(datastr,rwbuf); if(datalen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制寫入數(shù)據(jù)!"); ui-?>plainTextEdit->setFocus(); return; } fileno=ui->comboBox_rwfile->currentIndex(); //要讀寫的文件號(hào) staradd=ui->spinBox_rwbegin->value(); //讀寫起始地址 datalen=ui->spinBox_rwlen->value(); //讀寫數(shù)據(jù)長(zhǎng)度 if(datalen1 || datalen?>247){ QMessageBox::critical(NULL, "提示", "每次寫卡最多247字節(jié),請(qǐng)輸入正確的寫卡長(zhǎng)度!"); ui->spinBox_rwlen->setFocus(); return; } if(ui->comboBox_authrwkey->currentIndex()==0){ ctrlword=OLDKEYR; //用只讀密碼來認(rèn)證 }else{ctrlword=OLDKEYWR;} //用讀寫密碼來認(rèn)證 if (mycpursfiledatawrite != NULL){ //是否成功連接上 cpursfiledatawrite()函數(shù) status = mycpursfiledatawrite(fileno,ctrlword,oldkeybuf,oldkeylen,staradd,rwbuf,datalen); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "寫入數(shù)據(jù)成功!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfiledatawrite’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_easy_write_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char fileno; //文件號(hào) unsigned char ctrlword; //控制字 unsigned char oldkeylen[1]; //舊密鑰長(zhǎng)度 unsigned char oldkeybuf[20]; //舊密鑰 int staradd; //讀寫起始地址 int datalen; //讀寫長(zhǎng)度 unsigned char rwbuf[8000]; //讀寫數(shù)據(jù)緩沖 int keylen; QString keystr; QString datastr; keystr = ui->lineEdit_authkey2->text().trimmed(); keylen=checkhexdata(keystr,oldkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制文件認(rèn)證密碼!"); ui-?>lineEdit_authkey2->setFocus(); return; } oldkeylen[0]=keylen; datastr = ui->plainTextEdit->toPlainText().trimmed(); datalen=checkhexdata(datastr,rwbuf); if(datalen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制寫入數(shù)據(jù)!"); ui-?>plainTextEdit->setFocus(); return; } fileno=ui->comboBox_rwfile->currentIndex(); //要讀寫的文件號(hào) staradd=ui->spinBox_rwbegin->value(); //讀寫起始地址 datalen=ui->spinBox_rwlen->value(); //讀寫數(shù)據(jù)長(zhǎng)度 if(ui->comboBox_authrwkey->currentIndex()==0){ ctrlword=OLDKEYR; //用只讀密碼來認(rèn)證 }else{ctrlword=OLDKEYWR;} //用讀寫密碼來認(rèn)證 if (mycpursfiledatawrite_s != NULL){ //是否成功連接上 cpursfiledatawrite_s()函數(shù) status = mycpursfiledatawrite_s(fileno,ctrlword,oldkeybuf,oldkeylen,staradd,rwbuf,datalen); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "寫入數(shù)據(jù)成功!"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpursfiledatawrite_s’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_clear_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; if (mycpurscardclr != NULL){ //是否成功連接上 cpurscardclr()函數(shù) status = mycpurscardclr(); if(status==0){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "cpu卡強(qiáng)制清空卡成功"); }else{ if(status==64){ QMessageBox::information(NULL, "提示", "此卡為未經(jīng)過我們cpursinit函數(shù)成功初始化的卡"); }else{ disperrinf(status); } } } else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpurscardclr’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_changecardkey_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char status; //函數(shù)返回狀態(tài) unsigned char oldkeylen[1]; //舊密鑰長(zhǎng)度 unsigned char oldkeybuf[20]; //舊密鑰 unsigned char newkeylen[1]; //新密鑰長(zhǎng)度 unsigned char newkeybuf[20]; //新密鑰 int keylen; QString keystr; keystr = ui->lineEdit_cardoldkey->text().trimmed(); keylen=checkhexdata(keystr,oldkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制卡舊密碼!"); ui-?>lineEdit_cardoldkey->setFocus(); return; } oldkeylen[0]=keylen; keystr = ui->lineEdit_cardnewkey->text().trimmed(); keylen=checkhexdata(keystr,newkeybuf); if(keylen0){ QMessageBox::critical(NULL, "提示", "請(qǐng)輸入正確的16進(jìn)制卡新密碼!"); ui-?>lineEdit_cardnewkey->setFocus(); return; } newkeylen[0]=keylen; if (mycpurscardkeychg != NULL){ //是否成功連接上 cpurscardkeychg()函數(shù) status = mycpurscardkeychg(oldkeybuf,oldkeylen,newkeybuf,newkeylen); if(status==0 ){ mypcdbeep(30); QMessageBox::information(NULL, "提示", "修改卡片密碼成功"); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpurscardkeychg’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } } void MainWindow::on_pb_request1_clicked() { if(!checkdllos()){return;} //判斷運(yùn)行目錄內(nèi)動(dòng)態(tài)庫(kù)文件是否存在 unsigned char mypiccserial[4]; //卡序列號(hào) unsigned char atqasakbuf[3]; //參數(shù) unsigned char status; //函數(shù)返回狀態(tài) if (mypiccrequest1 != NULL){ //是否成功連接上 cpurequest()函數(shù) status = mypiccrequest1(mypiccserial,atqasakbuf); if(status==0 || status==52){ mypcdbeep(30); QString uidstr=QString::asprintf("%02X%02X%02X%02X", mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]); QString atqastr=QString::asprintf("%02X%02X", atqasakbuf[0],atqasakbuf[1]); QString sakstr=QString::asprintf("%02X", atqasakbuf[2]); ui->lineEdit_uid->setText(uidstr); QMessageBox::information(NULL, "提示", "卡號(hào):"+uidstr+",ATQA:"+atqastr+",SAK:"+sakstr); } else { disperrinf(status); } }else{ QMessageBox::critical(NULL, "提示", "函數(shù)‘cpurequest’未正確載入,請(qǐng)查詢DLL文件版本是否正確!"); } }
-
IC卡
+關(guān)注
關(guān)注
2文章
168瀏覽量
34170 -
讀卡器
+關(guān)注
關(guān)注
2文章
419瀏覽量
39418 -
EEPROM
+關(guān)注
關(guān)注
9文章
1030瀏覽量
81819 -
小程序
+關(guān)注
關(guān)注
1文章
239瀏覽量
12200
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論