---
title: "XmlPolicySpec"
description: "Namespace: Lacuna.Pki.Xml"
canonical: "https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec"
locale: "pt-BR"
product: "PKI SDK"
last_updated: "2026-06-02"
---

# XmlPolicySpec

**Namespace:** `Lacuna.Pki.Xml`  
**Assembly:** `Lacuna.Pki`  
_Class_

```csharp
public class XmlPolicySpec : ITrustArbitrator
```

**Hierarquia:** [`object`](https://learn.microsoft.com/dotnet/api/system.object) → `XmlPolicySpec`

## Construtores

### `XmlPolicySpec()`

```csharp
public XmlPolicySpec()
```

---

## Propriedades

### `ArchiveTimestampPolicy`

```csharp
public CadesPolicySpec ArchiveTimestampPolicy { get; set; }
```

**Retorno**

[`CadesPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Cades/CadesPolicySpec)

---

### `DigestAlgorithms`

```csharp
public List<DigestAlgorithm> DigestAlgorithms { get; set; }
```

**Retorno**

[`List<DigestAlgorithm>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)

---

### `Generation`

```csharp
public XmlPolicySpec.GenerationSpec Generation { get; set; }
```

**Retorno**

[`XmlPolicySpec.GenerationSpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec.GenerationSpec)

---

### `PolicyId`

Optionally specifies the policy's OID and other identifying properties.

```csharp
public XmlPolicyIdentifier PolicyId { get; set; }
```

**Retorno**

[`XmlPolicyIdentifier`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicyIdentifier)

---

### `SigAndRefsTimestampPolicy`

```csharp
public CadesPolicySpec SigAndRefsTimestampPolicy { get; set; }
```

**Retorno**

[`CadesPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Cades/CadesPolicySpec)

---

### `SignatureAlgorithms`

```csharp
public List<SignatureAlgorithm> SignatureAlgorithms { get; set; }
```

**Retorno**

[`List<SignatureAlgorithm>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)

---

### `SignatureTimestampPolicy`

```csharp
public CadesPolicySpec SignatureTimestampPolicy { get; set; }
```

**Retorno**

[`CadesPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Cades/CadesPolicySpec)

---

### `SigningPeriodEnd`

```csharp
public DateTimeOffset? SigningPeriodEnd { get; set; }
```

**Retorno**

[`DateTimeOffset?`](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

---

### `SigningPeriodStart`

```csharp
public DateTimeOffset? SigningPeriodStart { get; set; }
```

**Retorno**

[`DateTimeOffset?`](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

---

### `Validation`

```csharp
public XmlPolicySpec.ValidationSpec Validation { get; set; }
```

**Retorno**

[`XmlPolicySpec.ValidationSpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec.ValidationSpec)

---

## Métodos

### `AddTrustArbitrator(ITrustArbitrator, bool)`

Add a trust root arbitrator to the policy spec. The policy spec needs at least one arbitrator added.

```csharp
public void AddTrustArbitrator(ITrustArbitrator arbitrator, bool propagateToTimestampPolicies = false)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `arbitrator` | [`ITrustArbitrator`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ITrustArbitrator) |  |
| `propagateToTimestampPolicies` | [`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) |  |

---

### `AddTrustArbitrator(params ITrustArbitrator[])`

Add a trust root arbitrator to the policy spec. The policy spec needs at least one arbitrator added.

```csharp
public void AddTrustArbitrator(params ITrustArbitrator[] arbitrators)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `arbitrators` | `ITrustArbitrator[]` |  |

---

### `CheckIntegrity()`

```csharp
public void CheckIntegrity()
```

---

### `ClearTrustArbitrators(bool)`

Clear the trust arbitrators in this policy spec

```csharp
public void ClearTrustArbitrators(bool propagateToTimestampPolicies = false)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `propagateToTimestampPolicies` | [`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) |  |

---

### `GetCertificateStore()`

Returns a certificate store based on the arbitrator root certificates

```csharp
public ICertificateStore GetCertificateStore()
```

**Retorno**

[`ICertificateStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ICertificateStore) — Certificate store based on the arbitrator root certificates. Can be null.

**Comentários**

If that method does not make sense for your implementation or there is
            no certificate in your arbitrator logic, it can return null.

---

### `GetFailureLevel(ValidationItemTypes)`

```csharp
public ValidationFailureLevels GetFailureLevel(ValidationItemTypes failureType)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `failureType` | [`ValidationItemTypes`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ValidationItemTypes) |  |

**Retorno**

[`ValidationFailureLevels`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ValidationFailureLevels)

---

### `GetXadesBasic(ITrustArbitrator, bool)`

```csharp
public static XmlPolicySpec GetXadesBasic(ITrustArbitrator arbitrator, bool includeSigningTime = false)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `arbitrator` | [`ITrustArbitrator`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ITrustArbitrator) |  |
| `includeSigningTime` | [`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) |  |

**Retorno**

[`XmlPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec)

---

### `GetXmlDSigBasic(ITrustArbitrator, DigestAlgorithm)`

Returns the XmlDSig basic signature policy using the given digest algorithm for digest computation and also for
signing (RSA is implied).

```csharp
public static XmlPolicySpec GetXmlDSigBasic(ITrustArbitrator arbitrator, DigestAlgorithm preferredDigestAlgorithm)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `arbitrator` | [`ITrustArbitrator`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ITrustArbitrator) |  |
| `preferredDigestAlgorithm` | [`DigestAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/DigestAlgorithm) |  |

**Retorno**

[`XmlPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec)

---

### `GetXmlDSigBasic(ITrustArbitrator)`

```csharp
public static XmlPolicySpec GetXmlDSigBasic(ITrustArbitrator arbitrator)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `arbitrator` | [`ITrustArbitrator`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ITrustArbitrator) |  |

**Retorno**

[`XmlPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec)

---

### `IsRootTrusted(PKCertificate, DateTimeOffset?, out ValidationResults)`

Determines whether a given PKCertificate is trusted, optionally outputting a ValidationResults object
that represents validations done while asserting the trust status.

```csharp
public bool IsRootTrusted(PKCertificate root, DateTimeOffset? dateReference, out ValidationResults vr)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `root` | [`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate) | The certificate for which the trust status must be determined. |
| `dateReference` | [`DateTimeOffset?`](https://learn.microsoft.com/dotnet/api/system.datetimeoffset) | An optional date reference on which the trust is to be asserted. If null, validation is done considering the present moment (now). |
| `vr` | [`ValidationResults`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ValidationResults) | The retults of the validations necessary to assertain the trust status. Implementors of this interface should set this parameter to null             if no validations where required. |

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) — Whether the given certificate is to be trusted or not.

---

### `SetFailureLevel(ValidationItemTypes, ValidationFailureLevels)`

```csharp
public void SetFailureLevel(ValidationItemTypes failureType, ValidationFailureLevels level)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `failureType` | [`ValidationItemTypes`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ValidationItemTypes) |  |
| `level` | [`ValidationFailureLevels`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ValidationFailureLevels) |  |

---

## Membros herdados

[`ToString()`](https://learn.microsoft.com/dotnet/api/system.object.tostring), [`Equals(object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)>), [`Equals(object, object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)>), [`ReferenceEquals(object, object)`](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [`GetHashCode()`](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [`GetType()`](https://learn.microsoft.com/dotnet/api/system.object.gettype), [`MemberwiseClone()`](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)
