Professional Communication
Software Development Tools

OPC Foundation member and certified logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions or issues. You do not have to own a commercial license in order to use the OPC Labs supportOur team is actively monitoring the forums, and provides replies as soon as possible.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible.

Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

EasyUAClient SignAndEncrypt Basic256Sha256 Username and Password

More
12 Aug 2026 14:22 #14669 by support
Hello,
thank you for posting this. 

I'd like to point out that if the code is meant to be complete, then the part that creates and configures the new UACommunicationProfile object is unnecessary, because all it does is that it creates an in-memory object that is not then used for anything. The code behaviour would be the same without those 3 lines. It probably works due to the QuickOPC auto-negotiation of the endpoint.

If you really wanted to make sure that the specified message security mode and security policy URI is used (and nothing else, ever), you will keep these lines, but also assign the "inst"  into "myEndpointDescriptor.EndpointSelectionPolicy.CommunicationProfile" .

Regards
 
The following user(s) said Thank You: AlexSFromG

Please Log in or Create an account to join the conversation.

More
12 Aug 2026 12:20 #14668 by AlexSFromG
Hello everybody,

finally I got a code that works for me.

OPC Labs Version 5.84.294.1

Requirements: Open Connection with username and password, Security Mode SignAndExcrypt, SecuityPolicy Basic256Sha256

In Visual Basic 2019:

        Dim nodeDescriptor As String = txtNodeDescriptor.Text

        Dim inst As New UACommunicationProfile
        inst.MessageSecurityModes = Engine.UAMessageSecurityModes.SecuritySignAndEncrypt
        inst.SecurityPolicyUriString = Engine.UASecurityPolicyUriStrings.Basic256Sha256

        Dim myEndpointDescriptor As UAEndpointDescriptor = New UAEndpointDescriptor(txtEndpointDescriptor.Text)
        myEndpointDescriptor.UserIdentityInfo.UserNameTokenInfo.UserName = txtUsername.Text
        myEndpointDescriptor.UserIdentityInfo.UserNameTokenInfo.Password = txtPassword.Text


        Dim myC As New EasyUAClient()

        Dim value As String = myC.ReadValue(myEndpointDescriptor, NodeDescriptor)

        MessageBox.Show(nodeDescriptor & " >>" & value.ToString & "<<")


I hope somebody will save time in looking for this solution.

Best regards
Alex 

 

Please Log in or Create an account to join the conversation.

More
10 Aug 2026 11:36 #14667 by support
Hello.

Right-click on the server node, select the User Identity command, specify the credentials, press OK. It should work then.

I hope this helps.
Best regards
 

Please Log in or Create an account to join the conversation.

More
10 Aug 2026 08:41 #14666 by AlexSFromG
Hello Support,

to become more experienced what to do I used the examples which come with the demo. In the easyopcua example 
I can connect ot my opcua server. The user identity provided is detected as anonymous.

But when I try to connect to a node id I get the error 

OPC UA service result - {BadIdentityTokenRejected}. Endpoint does not support the user identity type provided. Endpoint does not support the user identity type provided.

How can I troubleshoot this behaviour?

Best regards
Alex
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Jul 2026 08:56 #14663 by support
Hello.
Your code for username / password looks good.

By default, QuickOPC negotiates the message security model and security policy with the server. So, for example, if the server only allowed SignAndEncrypt and Basic256Sha256, this is what will get used, without further effort.

If you need to make sure specific values are used from the client side, set the parameters inside myEndpointDescriptor.EndpointSelectionPolicy.CommunicationProfile. Specifically:

www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio...file~MessageSecurityModes.html

www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio...e~SecurityPolicyUriString.html


I hope this helps
Best regards
 

Please Log in or Create an account to join the conversation.

More
27 Jul 2026 06:24 #14662 by AlexSFromG
Hello People, 

i need some help. 
My OPC-Admin gave me a username and a passwort. He said the security mode is "SignAndEncrypt" and the Security Police "Basic256Sha256".

How can I use this information to connect to the server? 

My code goes like ...


            Dim myEndpointDescriptorString = txtEndpointDescriptor.Text

            Dim myEndpointDescriptor As New UAEndpointDescriptor(txtEndpointDescriptor.Text)
            myEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "xxxxxxxxx"
            myEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "yyyyyyyyyyy"

            Dim myC As New EasyUAClient()

            Dim value As String = myC.ReadValue(myEndpointDescriptor, NodeDescriptor)

But this cannot work as the info for security mode and policy are missing. 

Is there an example how to do it? Or do you have a hint for me?

Best regards
Alex 

Please Log in or Create an account to join the conversation.

Moderators: supportvaclav.zaloudek
Time to create page: 0.183 seconds