Unsolved Make ID card reader in C++/Qt5?
-
Can we make using C++/Qt5 ID Card reader life easy? I have this C code ( https://github.com/Fedict/eid-mw/tree/master/doc/sdk/examples/C ) which read the electronics ID card of europe, but the huge problem with that is that it shows a Dialog window to press yes or no. Which is horrible to use for automated Kiosks services or parking machine.
Can anyone show me some lights if Qt5/C++ has something which can easily resolve it for us?
-
@yumyumyum Why don't you just change the code for your needs?
The link you posted is just an example how to use the SDK. -
@jsulm i did changed the code but even i do that it always showing that Dialog window asking yes or no. Which is making it impossible to apply in kiosk applications.
Is there no way Qt5/C++ to make such id card reader? (so that i can scan ID card in the backend without showing any GUI for yes no?)
-
@yumyumyum There is nothing built-in in Qt for that.
-
OK - how could then Qt5/c++ developer will resolve it when they get a project where they need to read the ID Card information from the card reader silently for kiosk applications?
-
take the C code, identify the piece of code that implements the functionality, isolate it from the rest and use it
-
Took the C code. But if i dont execute Beidsdk_GetObjectValue then i wont get any data. When i execute Beidsdk_GetObjectValue it always open the GUI. Is there any Qt5 solution to fix this?
retVal = Beidsdk_GetObjectValue(pFunctions, session_handle, pFilename, &pFileValue, &FileValueLen); if(retVal == CKR_OK) Beidsdk_PrintValue(pFilename,(CK_BYTE_PTR)pFileValue, FileValueLen); else printf("error");
-
What's inside Beidsdk_GetObjectValue? there must be a call in there that triggers the UI and you have to get rid of it
-
Here is the method
Beidsdk_GetObjectValue
/* Read exactly one value from the card. */ CK_RV Beidsdk_GetObjectValue(CK_FUNCTION_LIST_PTR pFunctions, CK_SESSION_HANDLE session_handle,CK_CHAR_PTR pName,CK_VOID_PTR *ppValue, CK_ULONG_PTR pvalueLen) { CK_RV retVal = CKR_OK; CK_ULONG data = CKO_DATA; CK_ATTRIBUTE searchtemplate[2] = {{CKA_CLASS,&data,sizeof(CK_ULONG)},{CKA_LABEL,(CK_VOID_PTR)pName,(CK_ULONG)strlen(pName)}}; *pvalueLen = 0; //initialize the search for the objects with label <filename> retVal = (pFunctions->C_FindObjectsInit)(session_handle, searchtemplate, 2); if (retVal != CKR_OK) { return retVal; } CK_OBJECT_HANDLE hObject = 0; CK_ULONG ulObjectCount = 0; //find the first object with label <filename> retVal = (pFunctions->C_FindObjects)(session_handle, &hObject,1,&ulObjectCount); if (ulObjectCount != 1) { retVal = CKR_GENERAL_ERROR; } if (retVal != CKR_OK) { goto finalize; } /* NULL_PTR as second argument, so the length of value is filled in to * retValueLen. See the definition of C_GetAttributeValue in the PKCS#11 * standard for more details. */ CK_ATTRIBUTE attr_templ[1] = {CKA_VALUE,NULL_PTR,0}; //retrieve the length of the data from the object retVal = (pFunctions->C_GetAttributeValue)(session_handle,hObject,attr_templ,1); if(retVal != CKR_OK || ((CK_LONG)(attr_templ[0].ulValueLen) == -1)) { goto finalize; } *ppValue = malloc (attr_templ[0].ulValueLen); if (*ppValue == NULL) { retVal = CKR_GENERAL_ERROR; goto finalize; } attr_templ[0].pValue = *ppValue; /* now run C_GetAttributeValue a second time to actually retrieve the * data from the object */ retVal = (pFunctions->C_GetAttributeValue)(session_handle,hObject,attr_templ,1); *pvalueLen = attr_templ[0].ulValueLen; finalize: //finalize the search retVal = (pFunctions->C_FindObjectsFinal)(session_handle); return retVal; }
-
@VRonin so how the hell i am going to disable the GUI?? i have shared the member function did you checked yet???
-
@yumyumyum Why so rude? Did you try to find out how to disable the UI by yourself? @VRonin isn't obliged to fix your problems. Your question is not even related to Qt.
-
Put your program in debug mode and go step by step inside Beidsdk_GetObjectValue to see what line triggers the ui, once you find out, step into that line and repeat the process until you pinpoint the final WINAPI (or any other core API) call
P.S.
goto finalize;
😱