Hello.
Please study a little bit about OPC UA security, because parts of your request are confused. The very first thing to know is that there in OPC UA, there is both application security, and user security, and they are independent. Application security, if used, is always done using certificates. User security, if used, can be done using username/password, or using certificates (and there are other methods too). So there are not just "three methods" you mentioned, as there are combinations.
Read the documentation:
-
www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio...0Client-Server%20Security.html
There is a whole chapter in the doc about the fact that QuickOPC-based apps auto-generate their self-signed instance certificates, so you do not need to do anything in this respect.
Whether the application-level security is used or not is determined by a negotiation between the client and the server. In case multiple options are supported by both parties, QuickOPC will choose one. If you want to specifically say that the application must be unauthenticated, or that it must be authenticated, set the endpoint selection policy in the endpoint descriptor similar to this:
Code:
// Define which server we will work with.
UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
// Require secure connection, in order to enforce the certificate check.
endpointDescriptor.EndpointSelectionPolicy = UAMessageSecurityModes.Secure;
In order to use username and password, use code similar to this:
Code:
UAEndpointDescriptor endpointDescriptor =
((UAEndpointDescriptor)"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer")
.WithUserNameIdentity("appadmin", "demo");
I hope this helps
Best regards