# OpcCertificateSettings Members

> Reference: Defines the setup of an application instance certificate.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcCertificateSettings</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

## Constructors

### OpcCertificateSettings

Initializes a new instance of the [OpcCertificateSettings](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/) class using the name of the application its instance certificate information is to be represented by the settings.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcCertificateSettings(string applicationName)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(applicationName As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `applicationName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the application its certificate information is to be maintained. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `applicationName` is an empty string. |
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `applicationName` is a null reference (Nothing in Visual Basic). |

## Fields

### DefaultKeySize

<span class="api-meta">static</span>

Represents the default value that is used by the [OpcCertificateSettings](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/) as initial value of the [KeySize](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/members#keysize) property.

<div class="api-signature" data-lang="csharp">

```csharp
public static readonly int DefaultKeySize
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared ReadOnly DefaultKeySize As Integer
```

</div>

**Field value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

### DefaultLifetime

<span class="api-meta">static</span>

Represents the default value that is used by the [OpcCertificateSettings](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/) as initial value of the [Lifetime](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/members#lifetime) property.

<div class="api-signature" data-lang="csharp">

```csharp
public static readonly int DefaultLifetime
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Shared ReadOnly DefaultLifetime As Integer
```

</div>

**Field value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

## Properties

### ApplicationName

Gets the name of the application its instance certificate is setup.

<div class="api-signature" data-lang="csharp">

```csharp
public string ApplicationName { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property ApplicationName As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The full qualified name of the application to identify by the certificate.

### ApplicationUri

Gets or sets the uniform resource identifier of the application instance.

<div class="api-signature" data-lang="csharp">

```csharp
public Uri ApplicationUri { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property ApplicationUri As Uri
```

</div>

**Property value**

[Uri](https://learn.microsoft.com/dotnet/api/system.uri)

The full qualified [Uri](https://learn.microsoft.com/dotnet/api/system.uri) to the application instance resource identified by the certificate or a null reference (Nothing in Visual Basic). The default value is a null reference (Nothing in Visual Basic).

### DomainNames

Gets a collection of domain names typically used by the application instance. In case of a server application the list have to contain the name of the machine used to access the server.

<div class="api-signature" data-lang="csharp">

```csharp
public Collection<string> DomainNames { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property DomainNames As Collection(Of String)
```

</div>

**Property value**

[Collection](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1)&lt;[String](https://learn.microsoft.com/dotnet/api/system.string)&gt;

A [Collection&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1) of domain names used within the environment of the application instance (can be left empty). The default list of domain names is empty.

**Remarks**

In case there is no domain name defined the host name of the machine which creates the application instance certificate is used instead. In case of a server application the domain name have to be the name of the machine which is to be used by the clients to access the server.

### KeySize

Gets or sets the number of bits to use to create the key of the certificate.

<div class="api-signature" data-lang="csharp">

```csharp
public int KeySize { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property KeySize As Integer
```

</div>

**Property value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

The number of bits (a multiple of eight) to use for the key.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The value is not a multiple of eight. |
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The value is lower than eight. |

**Remarks**

The default value is [DefaultKeySize](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/members#defaultkeysize).

### Lifetime

Gets or sets the number of months the certificate will be valid.

<div class="api-signature" data-lang="csharp">

```csharp
public int Lifetime { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property Lifetime As Integer
```

</div>

**Property value**

[Int32](https://learn.microsoft.com/dotnet/api/system.int32)

The number of months until the certificate will expire, starting at the month within the certificate has been created.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception) | The value is lower than one. |

**Remarks**

The default value is [DefaultLifetime](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/members#defaultlifetime).

### Organization

<span class="api-meta">since v2.58</span>

Gets or sets the name of the organization running the application instance.

<div class="api-signature" data-lang="csharp">

```csharp
public string Organization { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property Organization As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The name of the organization used as the organization name (O) portion of the subject of the application instance certificate or a null reference (Nothing in Visual Basic) in case there the subject does not contain an organization name. The default value is a null reference (Nothing in Visual Basic).

**Remarks**

The value is only used in case there the [SubjectName](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/members#subjectname) is a null reference (Nothing in Visual Basic).

### SubjectName

Gets or sets the subject name portion of the certificate.

<div class="api-signature" data-lang="csharp">

```csharp
public string SubjectName { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property SubjectName As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The subject name (SN) portion of the application instance certificate or a null reference (Nothing in Visual Basic). The default value is a null reference (Nothing in Visual Basic).

## Methods

### Of

<span class="api-meta">static</span>

Retrieves the best certificate setup for the application `instance` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public static OpcCertificateSettings Of(IOpcApplicationInstance instance)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Shared Function [Of](
    instance As IOpcApplicationInstance) As OpcCertificateSettings
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `instance` | [IOpcApplicationInstance](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcapplicationinstance/) | The application instance for that the best certificate setup is to be retrieved. |

**Returns**

[OpcCertificateSettings](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/)

An instance of the [OpcCertificateSettings](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatesettings/) setup using the application information provided the `instance` passed.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `instance` is a null reference (Nothing in Visual Basic). |
