OPC Studio User's Guide and Reference
SetOwnCertificate Method



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Application Namespace > AbstractEasyUAClientServerApplication Class : SetOwnCertificate Method
The sub-id of the certificate. Normally an empty string.

The value of this parameter cannot be null (Nothing in Visual Basic).

The application's own certificate.

The value of this parameter cannot be null (Nothing in Visual Basic).

The format of the private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

The private key of the application's own certificate.

The value of this parameter can be null (Nothing in Visual Basic).

Password to the certificate's current private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

New password to the certificate's private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

Determines whether the trusted peers certificate store will also be updated.
Determines whether the certificate is allowed to have a subject name that is different from the requested subject name.
Infrastructure. Sets the application's own certificate.
Syntax
'Declaration
 
Protected MustOverride Sub SetOwnCertificate( _
   ByVal certificateSubId As String, _
   ByVal pkiCertificate As IPkiCertificate, _
   ByVal privateKeyFormat As String, _
   ByVal formattedPrivateKey() As Byte, _
   ByVal oldPrivateKeyPassword As String, _
   ByVal newPrivateKeyPassword As String, _
   ByVal updateTrustedPeerCertificates As Boolean, _
   ByVal allowSubjectNameRemapping As Boolean _
) 
'Usage
 
Dim instance As AbstractEasyUAClientServerApplication
Dim certificateSubId As String
Dim pkiCertificate As IPkiCertificate
Dim privateKeyFormat As String
Dim formattedPrivateKey() As Byte
Dim oldPrivateKeyPassword As String
Dim newPrivateKeyPassword As String
Dim updateTrustedPeerCertificates As Boolean
Dim allowSubjectNameRemapping As Boolean
 
instance.SetOwnCertificate(certificateSubId, pkiCertificate, privateKeyFormat, formattedPrivateKey, oldPrivateKeyPassword, newPrivateKeyPassword, updateTrustedPeerCertificates, allowSubjectNameRemapping)

Parameters

certificateSubId
The sub-id of the certificate. Normally an empty string.

The value of this parameter cannot be null (Nothing in Visual Basic).

pkiCertificate
The application's own certificate.

The value of this parameter cannot be null (Nothing in Visual Basic).

privateKeyFormat
The format of the private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

formattedPrivateKey
The private key of the application's own certificate.

The value of this parameter can be null (Nothing in Visual Basic).

oldPrivateKeyPassword
Password to the certificate's current private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

newPrivateKeyPassword
New password to the certificate's private key.

The value of this parameter cannot be null (Nothing in Visual Basic).

updateTrustedPeerCertificates
Determines whether the trusted peers certificate store will also be updated.
allowSubjectNameRemapping
Determines whether the certificate is allowed to have a subject name that is different from the requested subject name.
Exceptions
ExceptionDescription

The OPC UA operation has failed. This operation exception in uniformly used to allow common handling of various kinds of errors. The System.Exception.InnerException always contains information about the actual error cause.

This is an operation error that depends on factors external to your program, and thus cannot be always avoided. Your code must handle it appropriately.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also