Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Build OPCUA secure connection function with QtOpcUa and 3rd party Open62541 backend



  • Hi All,

    First of all, information of my working environment: Window 10 64bit, Qt ver: 5.14.2, Qt Creator: 4.11.1 (based on Q 5.14.1(MSVC 2017, 32bit).
    I am a beginner of Qt or even software engineer. So please forgive me if I ask some stupid question. Below is some background info about my question.

    Recently, I am building the QtOpcUa environment with 3rd party plugin Open62541. I took a lot of reference from Basyskom and Qt forum.
    I have already tested the function of OPCUA Data access. It works good for me. I can write/read the variables from the OPCUA server (in my case is KEBA PLC under CoDeSys-base IDE) under none encryption connection (None-None). After this, I want to implement secure connection feature to my application. So first, I use UaExpert as a client to connect to my server with encrypted secure connection (Basic256Sha256, Sign and encrypted). It works, so I know the secure connection functionality of server part is okay. I also know I have to put the certificate into the PLC for it to recognize the client. Then I use QtOpcUa eample "Opcuaviewer", when I try to connect the server. It shows the error code:
    qt.opcua.plugins.open62541: The open62541 plugin has been built without encryption support
    qt.opcua.plugins.open62541: Unsupported security policy: "http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"

    And I realized that base on the information from BasysKom, one step of building qtopcua is after execute qmake, make sure "mbedtls ..........yes"1.JPG

    So now I try to make "mbedtls" function enable. I download the mbedtls lib from (https://github.com/ARMmbed/mbedtls) and extracted to QDIR\qtopcua\src\3rdparty\open62541". And I open the open62541.h via Qt creator to set UA_ENABLE_ENCRYPTION and build project. I got a lot of error related to not found mbedtls lib file and unknown type name. 2.JPG
    Because I feel that qt cannot link the lib of mbedtls, I include the lib (INCLUDEPATH += $$PWD/open62541/mbedtls-development/include) in open62541.pri and build project.
    The not found file and unknown type name error are gone. But it turns to "undefined reference" error.3.JPG

    But when I click "F2" on those undefined reference function. I can link to the mbedtls.h file. So I think it is linked and qt can find the lib, but I don't know why it shows undefined reference error.

    Therefore, I stuck. Can someone help me? Where I am getting wrong? If you can explain more detail about what I have to do, that would be grateful. Cause I am afraid that I cannot understand what I have to do.
    Thanks in advance.


Log in to reply