# OpcCertificateIdentity Members

> Reference: Represents the identity of a user which is described by a certificate.

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

Inherits members from [OpcUserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcuseridentity/members), [OpcIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcidentity/members).

## Constructors

### OpcCertificateIdentity

Initializes a new instance of the [OpcCertificateIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificateidentity/) class using the `certificate` specified.

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

```csharp
public OpcCertificateIdentity(X509Certificate2 certificate)
```

</div>

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

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

</div>

**Parameters**

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

**Exceptions**

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

## Properties

### Certificate

Gets the certificate which describes the identity.

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

```csharp
public X509Certificate2 Certificate { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Certificate As X509Certificate2
```

</div>

**Property value**

[X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2)

The certificate of the user.

## Methods

### Impersonate

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

Impersonates the user represented by the identity.

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

```csharp
public override OpcImpersonationContext Impersonate()
```

</div>

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

```vbnet
Public Overrides Function Impersonate() As OpcImpersonationContext
```

</div>

**Returns**

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

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

**Overrides**

[Impersonate](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcuseridentity/members#impersonate)

**Remarks**

The method does not impersonate the user; the context returned does nothing when it is undone.

### Matches

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

Determines whether the `certificate` specified is the certificate of the identity.

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

```csharp
public virtual bool Matches(X509Certificate2 certificate)
```

</div>

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

```vbnet
Public Overridable Function Matches(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 compare. |

**Returns**

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

The value true if the thumbprint of the `certificate` is equal to the thumbprint of the [Certificate](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificateidentity/members#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). |
