I am trying to register my open62541 server to the Local Discovery Server running on the same machine. However, I get the following error:
I have another server (written using UnifiedAutomation) that's able to connect to the LDS, so I know it is running. Here is the code I use to initialize and start my server:
/* Load certificate and private key */
UA_ByteString certificate = loadFile("server_cert.der");
UA_ByteString privateKey = loadFile("server_key.der");
/* Load the trustlist */
UA_ByteString *trustList = (UA_ByteString *) UA_Array_new(1, &UA_TYPES[UA_TYPES_BYTESTRING]);
size_t trustListSize = 1;
UA_ByteString_copy(&certificate, &trustList[0]);
/* Loading of a revocation list currently unsupported */
UA_ByteString *revocationList = NULL;
size_t revocationListSize = 0;
UA_ServerConfig *config = UA_ServerConfig_new_basic128rsa15(4841, &certificate, &privateKey,
trustList, trustListSize,
revocationList, revocationListSize);
UA_Server *server = UA_Server_new(config);
/* Try to register server to LDS */
UA_StatusCode retval =
UA_Server_addPeriodicServerRegisterCallback(server,
"opc.tcp://localhost:4840",
10 * 60 * 1000,
500,
NULL);
/* Run the server */
retval = UA_Server_run(server, &running);
return (int)retval;
The certificate and private key were generated using the create_self-signed.py script located in /tools/certs, and I copied those two files into my project files. I use UaExpert to try to connect to my server, but I get the message "Connecting failed with error 'BadSecurityChecksFailed'" when I choose an endpoint higher than None.
How can I enable my server to connect to the LDS? Thanks.