# OpcCertificateStoreInfo Members

> Reference: Represents a certificate store, which provides access to the certificates stored at its Path.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcCertificateStoreInfo</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

### OpcCertificateStoreInfo

Initializes a new instance of the [OpcCertificateStoreInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/) class using the `path` and `type` specified.

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

```csharp
public OpcCertificateStoreInfo(string path, OpcCertificateStoreType type)
```

</div>

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

```vbnet
Public Sub New(path As String, type As OpcCertificateStoreType)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `path` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The path of the certificate store. |
| `type` | [OpcCertificateStoreType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoretype/) | The purpose of the certificate store. |

**Exceptions**

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

**Remarks**

The [PathType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#pathtype) is determined from the `path`: a path which starts with "LocalMachine\\", "CurrentUser\\", "User\\" or "Service\\" is a store of the operating system ([System](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestorepathtype/#system)), any other path a directory ([Directory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestorepathtype/#directory)).

## Properties

### Path

Gets or sets the path of the certificate store.

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

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

</div>

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

```vbnet
Public Property Path As String
```

</div>

**Property value**

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

The path of the certificate store.

**Remarks**

Setting the path does not change the [PathType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#pathtype).

### PathType

Gets or sets the kind of the [Path](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#path) of the certificate store.

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

```csharp
public OpcCertificateStorePathType PathType { get; set; }
```

</div>

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

```vbnet
Public Property PathType As OpcCertificateStorePathType
```

</div>

**Property value**

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

One of the members of [OpcCertificateStorePathType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestorepathtype/).

### Type

Gets the purpose of the certificate store.

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

```csharp
public OpcCertificateStoreType Type { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Type As OpcCertificateStoreType
```

</div>

**Property value**

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

One of the members of [OpcCertificateStoreType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoretype/).

## Methods

### Add

Adds the `certificate` specified to the certificate store.

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

```csharp
public void Add(X509Certificate2 certificate)
```

</div>

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

```vbnet
Public Sub Add(certificate As X509Certificate2)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `certificate` | [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) | The certificate to add. |

**Exceptions**

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

### Clear

Removes all certificates from the certificate store.

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

```csharp
public void Clear()
```

</div>

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

```vbnet
Public Sub Clear()
```

</div>

**Remarks**

For a store of trusted certificates, the method also removes the certificates listed in its configuration.

### Contains

<span class="api-meta">2 overloads</span>

| Overload | Description |
|---|---|
| [Contains(X509Certificate2)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#contains-system-security-cryptography-x509certificates-x509certificate2) | Determines whether the certificate store contains a certificate with the thumbprint of the `certificate` specified. |
| [Contains(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#contains-system-string) | Determines whether the certificate store contains a certificate with the `thumbprint` specified. |

#### Contains(X509Certificate2)

Determines whether the certificate store contains a certificate with the thumbprint of the `certificate` specified.

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

```csharp
public bool Contains(X509Certificate2 certificate)
```

</div>

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

```vbnet
Public Function Contains(certificate As X509Certificate2) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `certificate` | [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) | The certificate to locate. |

**Returns**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the store contains a certificate with the thumbprint of the `certificate`; otherwise the value false.

**Exceptions**

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

#### Contains(string)

Determines whether the certificate store contains a certificate with the `thumbprint` specified.

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

```csharp
public bool Contains(string thumbprint)
```

</div>

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

```vbnet
Public Function Contains(thumbprint As String) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `thumbprint` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The thumbprint of the certificate to locate. |

**Returns**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the store contains a certificate with the `thumbprint`; otherwise the value false.

**Exceptions**

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

### GetCertificate

Gets the certificate with the `thumbprint` specified from the certificate store.

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

```csharp
public OpcCertificateInfo GetCertificate(string thumbprint)
```

</div>

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

```vbnet
Public Function GetCertificate(thumbprint As String) As OpcCertificateInfo
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `thumbprint` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The thumbprint of the certificate to get. |

**Returns**

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

An [OpcCertificateInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificateinfo/) representing the certificate, or a null reference (Nothing in Visual Basic) if the store does not contain a certificate with the `thumbprint`.

**Exceptions**

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

### GetCertificates

Gets the certificates of the certificate store.

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

```csharp
public OpcCertificateInfo[] GetCertificates()
```

</div>

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

```vbnet
Public Function GetCertificates() As OpcCertificateInfo()
```

</div>

**Returns**

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

An array of the certificates of the store, each certificate once.

**Remarks**

For the store of the application certificate, the array also contains the configured application certificate. For a store of trusted certificates, it also contains the certificates listed in its configuration.

### Remove

<span class="api-meta">2 overloads</span>

| Overload | Description |
|---|---|
| [Remove(X509Certificate2)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#remove-system-security-cryptography-x509certificates-x509certificate2) | Removes the certificate with the thumbprint of the `certificate` specified from the certificate store. |
| [Remove(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#remove-system-string) | Removes the certificate with the `thumbprint` specified from the certificate store. |

#### Remove(X509Certificate2)

Removes the certificate with the thumbprint of the `certificate` specified from the certificate store.

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

```csharp
public bool Remove(X509Certificate2 certificate)
```

</div>

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

```vbnet
Public Function Remove(certificate As X509Certificate2) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `certificate` | [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) | The certificate to remove. |

**Returns**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the certificate has been removed; otherwise the value false.

**Exceptions**

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

#### Remove(string)

Removes the certificate with the `thumbprint` specified from the certificate store.

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

```csharp
public bool Remove(string thumbprint)
```

</div>

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

```vbnet
Public Function Remove(thumbprint As String) As Boolean
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `thumbprint` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The thumbprint of the certificate to remove. |

**Returns**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true if the certificate has been removed; otherwise the value false.

**Exceptions**

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

### ToString

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

Returns a string that represents the certificate store.

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

```csharp
public override string ToString()
```

</div>

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

```vbnet
Public Overrides Function ToString() As String
```

</div>

**Returns**

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

A string containing the [Type](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#type), the [PathType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#pathtype) and the [Path](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatestoreinfo/members#path) of the store.

**Overrides**

[ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)
