OPC Studio User's Guide and Reference
AddCertificate Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Security.Cryptography.PkiCertificates Namespace > IPkiStore Interface : AddCertificate Method
The certificate to add.

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

Specifies whether to overwrite an existing certificate if it exists.
A password to access the private key.

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

Adds a certificate to a PKI store.
Syntax
'Declaration
 
Sub AddCertificate( _
   ByVal pkiCertificate As IPkiCertificate, _
   ByVal overwrite As Boolean, _
   ByVal password As String _
) 
'Usage
 
Dim instance As IPkiStore
Dim pkiCertificate As IPkiCertificate
Dim overwrite As Boolean
Dim password As String
 
instance.AddCertificate(pkiCertificate, overwrite, password)

Parameters

pkiCertificate
The certificate to add.

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

overwrite
Specifies whether to overwrite an existing certificate if it exists.
password
A password to access the private key.

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

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

An error occurred during a cryptographic operation.

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