# OpcCertificateValidationFailedEventArgs Members

> Reference: Provides the event data for 'CertificateValidationFailed' events.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcCertificateValidationFailedEventArgs</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 [EventArgs](https://learn.microsoft.com/dotnet/api/system.eventargs).

## Constructors

### OpcCertificateValidationFailedEventArgs

Initializes a new instance of the [OpcCertificateValidationFailedEventArgs](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/) class using the event data specified.

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

```csharp
public OpcCertificateValidationFailedEventArgs(
    X509Certificate2 certificate,
    OpcCertificateValidationResult result,
    OpcResult resultInfo)
```

</div>

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

```vbnet
Public Sub New(
    certificate As X509Certificate2,
    result As OpcCertificateValidationResult,
    resultInfo As OpcResult)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `certificate` | [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) | The [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) instance providing the certificate data to validate/validated. |
| `result` | [OpcCertificateValidationResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationresult/) | The so far reached [OpcCertificateValidationResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationresult/) which indicates the reason, why the validation of the certificate failed. |
| `resultInfo` | [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) | The [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) which provides additional information about the `result`. This information is also used in case of an un-accepted certificate for an exception. |

**Exceptions**

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

## Properties

### Accept

Gets or sets a value indicating whether to accept the [Certificate](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#certificate) independent from the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#result) of the certificate validation.

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

```csharp
public bool Accept { get; set; }
```

</div>

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

```vbnet
Public Property Accept As Boolean
```

</div>

**Property value**

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

The value true to trust the [Certificate](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#certificate); otherwise the value false. The default value is false.

### Certificate

Gets the certificate its validation has failed.

<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)

An instance of the [X509Certificate2](https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2) class representing the certificate its validation has been failed.

### Result

Gets a value indicating the outcome of the certificate validation.

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

```csharp
public OpcCertificateValidationResult Result { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Result As OpcCertificateValidationResult
```

</div>

**Property value**

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

One of the members defined by the [OpcCertificateValidationResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationresult/) enumeration.

### ResultInfo

Gets the information used to represent the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#result) in case there an exception is to be thrown.

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

```csharp
public OpcResult ResultInfo { get; }
```

</div>

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

```vbnet
Public ReadOnly Property ResultInfo As OpcResult
```

</div>

**Property value**

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

The information associated with the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#result) which is used for any subsequently thrown exception.

## Methods

### ToString

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

Returns a string that represents the current [OpcCertificateValidationFailedEventArgs](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/).

<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 that represents the current [OpcCertificateValidationFailedEventArgs](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/) including either the [ResultInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#resultinfo) (if available) or the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccertificatevalidationfailedeventargs/members#result) of the event data represented.

**Overrides**

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