Opc Ua Client Sample with SignAndEncrypt Basic256Sha256 Certificate|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Opc Ua Client Sample with SignAndEncrypt Basic256Sha256 Certificate
Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
1
05/25/2023 - 03:40
sp_Permalink sp_Print
I'm trying to connect the sample client to a server that implements user certificate authentication, there are no examples of how to handle user certificates with .der and .pem files. 
Through ua expert i can connect but not through my c# .net core application.
Someone can help me? Thank you.
Avatar
Randy Armstrong
Admin
Forum Posts: 1445
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
3
05/25/2023 - 08:12
sp_Permalink sp_Print

Thank you for the fast reply.

I Try to connect but without success, the program return an error message: EndPoint does not support the user identity type provided

Avatar
Randy Armstrong
Admin
Forum Posts: 1445
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
05/25/2023 - 15:10
sp_Permalink sp_Print

You need to enable it in the server configuration.

Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
5
05/25/2023 - 22:53
sp_Permalink sp_Print

Randy Armstrong said
You need to enable it in the server configuration.

Thank you for the reply, but in the server I can't modify the type of connection or security parameters.

With uaexpert I can connect to the opcua server. In the uaexpert connection parameters i put the user .der and the private key .pem file and work fine, authentication type Sign&Encrypt and Basic256Sha256. I've copy the server ca certificate and server certificate and in the server pki i've copy the uaexpert certificate.

When I try to copy this configuration in the UA client sample application not work.

Avatar
Randy Armstrong
Admin
Forum Posts: 1445
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
05/26/2023 - 06:39
sp_Permalink sp_Print

The server configuration is here:

https://github.com/OPCFoundati.....Config.xml

You configure the available identity policies with the <UserTokenPolicies> element.

You configure the over all policies with <SecurityPolicies> element.

But I am not sure what your issue is.

Can you connect with security with anonymous credentials?

Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
7
05/27/2023 - 00:45
sp_Permalink sp_Print

Randy Armstrong said
The server configuration is here:

https://github.com/OPCFoundati.....Config.xml

You configure the available identity policies with the element.

You configure the over all policies with element.

But I am not sure what your issue is.

Can you connect with security with anonymous credentials?

  

No with anonimous wont connect.

I think that the client don't have the type of authentication required by the server, but I don't understand why ua expert can connected correctly with same parameters.

Probably the connect don't return the correct type of authentication required and the ua client sample don't recognize the certificate user authentication type.

I can't see the servers configuration xml because i don't have de access to the opcua server files.

Avatar
Randy Armstrong
Admin
Forum Posts: 1445
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
8
05/27/2023 - 01:19
sp_Permalink sp_Print

The issue is you have to ensure the Server trusts the Client and the Client trusts the Server.

Do you have access to the Server trust list?

Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
9
05/27/2023 - 01:43
sp_Permalink sp_Print

Randy Armstrong said
The issue is you have to ensure the Server trusts the Client and the Client trusts the Server.

Do you have access to the Server trust list?

  

Yes I keep the der server certificate and put it in app data/local/ opcua foundation/ pki / trusted

And put the ua client .der certificate into server pki / trusted

I keep also the server ca issuers into client issuer cert and crl

Now I doubt about the path location of pki ua sample client but i think was correct path on my local machine.

Avatar
Randy Armstrong
Admin
Forum Posts: 1445
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
10
05/30/2023 - 11:20
sp_Permalink sp_Print

You need to enable the server log and find the error in the log file.

Avatar
MattiaR
Member
Members
Forum Posts: 6
Member Since:
05/25/2023
sp_UserOfflineSmall Offline
11
06/24/2023 - 01:47
sp_Permalink sp_Print

Thank you for the help.

I resolved the problem.

The certificate is in the correct folder the problem is that for c# class i need the .pem file and not the .key file but i convert the .key file into another format to pass in c# class

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: Michael Pfannkuchen
Guest(s) 27
Currently Browsing this Page:
2 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1347
Posts: 4567