Nemavhidi
Nemavhidi

Reputation: 148

OPC UA UserIdentity

I am trying to connect to an OPC-UA Server using the credentials that I have set.

//user

var user = new UserIdentity("admin", "admin");

//session

var session = Session.Create(config, new ConfiguredEndpoint(null, selectedEndpoint, EndpointConfiguration.Create(config)), false, "", (uint)6000, user, null).GetAwaiter().GetResult();

I always get the error:

Failed to connect Certificate is not trusted.

When I login anonymously it works.

What am I doing wrong?

Upvotes: 2

Views: 1483

Answers (1)

eglease
eglease

Reputation: 2754

In order to use a username and password in OPC UA, they need to be encrypted during transport. This encryption is done using an X.509 certificate. Therefore, you need to exchange and trust X.509 certificates with the OPC UA server even if you do not encrypt the rest of your session.

Check your API for how to do this. Your certificate must also be trusted on the server.

Upvotes: 4

Related Questions