Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Make ID card reader in C++/Qt5?
Forum Updated to NodeBB v4.3 + New Features

Make ID card reader in C++/Qt5?

Scheduled Pinned Locked Moved Unsolved C++ Gurus
12 Posts 3 Posters 4.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yumyumyum
    wrote on last edited by
    #1

    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?

    alt text

    jsulmJ 1 Reply Last reply
    0
    • Y yumyumyum

      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?

      alt text

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Y Offline
        Y Offline
        yumyumyum
        wrote on last edited by
        #3

        @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?)

        jsulmJ 1 Reply Last reply
        0
        • Y yumyumyum

          @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?)

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @yumyumyum There is nothing built-in in Qt for that.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            yumyumyum
            wrote on last edited by
            #5

            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?

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              take the C code, identify the piece of code that implements the functionality, isolate it from the rest and use it

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              3
              • Y Offline
                Y Offline
                yumyumyum
                wrote on last edited by yumyumyum
                #7

                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");
                
                
                1 Reply Last reply
                0
                • VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by
                  #8

                  What's inside Beidsdk_GetObjectValue? there must be a call in there that triggers the UI and you have to get rid of it

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  1 Reply Last reply
                  1
                  • Y Offline
                    Y Offline
                    yumyumyum
                    wrote on last edited by yumyumyum
                    #9

                    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;
                    }
                    
                    1 Reply Last reply
                    0
                    • Y Offline
                      Y Offline
                      yumyumyum
                      wrote on last edited by
                      #10

                      @VRonin so how the hell i am going to disable the GUI?? i have shared the member function did you checked yet???

                      jsulmJ VRoninV 2 Replies Last reply
                      -1
                      • Y yumyumyum

                        @VRonin so how the hell i am going to disable the GUI?? i have shared the member function did you checked yet???

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @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.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2
                        • Y yumyumyum

                          @VRonin so how the hell i am going to disable the GUI?? i have shared the member function did you checked yet???

                          VRoninV Offline
                          VRoninV Offline
                          VRonin
                          wrote on last edited by
                          #12

                          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;

                          😱

                          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                          ~Napoleon Bonaparte

                          On a crusade to banish setIndexWidget() from the holy land of Qt

                          1 Reply Last reply
                          2

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved