OPC_UA: UA_Client_connectUsername lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- luca · 2023-07-11 15:35 Hi, there is already a post about this topic but don't fix my problem. I've dowloaded the wrapper from https://lacak.users.sourceforge.net/freepascal.html for Open62541 dll. All is fine if I use None as Authentication settings If I enable the username and password the connection returns the error Fail status code: 80020000 BadInternalError Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   (*** Connection - Anonymous user, Security None ***)// THIS WORKS  res := UA_Client_connect(client, PAnsiChar(cbServer.Text));   // UA_Client_connect() -> connectSync() -> UA_Client_run_iterate() -> UA_Client_renewSecureChannel() + UA_Client_backgroundConnectivity()//THIS RETURNS THE ERROR  res := UA_Client_connectUsername(client, PAnsiChar(cbServer.Text),'user','pass');   if res <> UA_STATUSCODE_GOOD then begin    Memo1.Lines.Append(Format('Fail status code: %x %s', [res, AnsiString(UA_StatusCode_name(res))]));    UA_Client_delete(client);    client := nil;    Exit;  end; Any suggestions? Many thanks ---------------------------------------------------------------------- tr_escape · 2023-07-12 06:33 Did you check last version of this library? https://github.com/fluisgirardi/fpopen62541 Maybe related. ---------------------------------------------------------------------- luca · 2023-07-19 08:42 Hi, I was able to compile the library using Visual Studio 2019. Then I ran the example using None as authentication settings and all is working exactly as in Lazarus. To use Username and Password it seems it's mandatory to use the certificate to set the Encryption. This is the part of the example in C: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         ...                UA_ByteString certificate = loadFile(certfile);        UA_ByteString privateKey = loadFile(keyfile);        if(trustList) {          /* Load the trust list */            size_t trustListSize = 1;            UA_STACKARRAY(UA_ByteString, trustListAuth, trustListSize);            trustListAuth[0] = loadFile(trustList);          UA_ClientConfig_setDefaultEncryption(cc, certificate, privateKey,                                                 trustListAuth, trustListSize, NULL, 0);...  This is a discussion about this topic: https://github.com/open62541/open62541/issues/4766 Now the point is that I have the .der certificate file BUT I'm not able to find the UserKey file. I'm using Windows 10 and Lazarus 2.2.0 Regards Luca