12/22/2023
I’m new with OPC Ua but i have to connect e comunicate with our customer’s opc ua server. First of all i built a client in C# and then the certificate for my client with OpenSSL and i sent it to the customer who put it in the trusted folder for certificate, but every time i try to connect i keep get ‘Certficate Not Trusted’ after the session creation. Thats the code of the client and a copy of the certificate that i created https://github.com/PaulettoJacopo/OPC-UA
05/30/2017
The client needs access to a private key.
The code you are using does not load the private key.
If there is not a good certificate available the SDK will auto-create a new certificate which will not be trusted.
You need to disable the auto-create certificate option.
If you get an error connecting then this is the issue.
12/22/2023
Thank you for the clarification.
I decided to create a PFX file that, as i read online, should contains the certificate that i created for the client and the private key, changed my code as:
// Load the certificate from a file
string pfxFilePath = @”xx\xxxx.pfx”;
string pfxPassword = “password”;
X509Certificate2 certificate = new X509Certificate2(pfxFilePath, pfxPassword);
Now i have to share the PFX file with the costumer as i did with the previous certificate or he only needs the .der certificate that i already sent?
05/30/2017
The private key must never leave the machine where it is created.
Only the DER is distributed.
If the DER is the same as the current PFX then nothing more is needed.
You should confirm that you can connect securely to a sample server running on your local machine before you update the customer.
1 Guest(s)