3.1.1 Create Certificate

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
dfeywyatt
Jr. Member
Jr. Member
Posts: 3
Joined: 06 Apr 2022, 22:51

3.1.1 Create Certificate

Post by dfeywyatt »

Apologies if this is a trivial question, but I am updating UA OPC dll's to support the latest .net using .netcoreapp3.1. Previously, we were using a static method to create a certificate given parameters: certificate path and certificate settings.
"UnitedAutomation.UaBase.CertificateFactory.Create"
With the new dll's, this seems to be deprecated. I see that there is an interface of ICertificateFactory, but it doesn't really make sense to me that I would need to implement my own version of create certificate.
How can I create a certificate with similar parameters (path and settings) using the latest OPC dll's? I am just not sure how to use the interface or the DefaultCertificateFactory, as there isn't a real implementation of either one.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: 3.1.1 Create Certificate

Post by Support Team »

Hello,

the way to call the CreateCertificate() method manually is the following:

First, set the SecurityProvider at the ApplicationInstance like shown in the Examples:
  • use WindowsSecurityProvider for Windows only application (provided in UaBase.Windows)
  • use BounsyCastleSecurityProvider for universal usage (provided in UaBase.BouncyCastle)

Code: Select all

ApplicationInstanceBase.Default.SecurityProvider = new BouncyCastleSecurityProvider();
Second, create a CertificateFactory from your chosen SecurityProvider[/list]

Code: Select all

var certificateFactory = ApplicationInstanceBase.Default.SecurityProvider.CreateCertificateFactory();
Now, call the CreateCertificate() method at the CertificateFactory with the path and settings parameters.

Code: Select all

var certifcate = certificateFactory.CreateCertificate(path, settings);
Best regards
Unified Automation Support Team

Post Reply