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

# XmlElementSigner

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

Provides methods for creating a XML signature of an specific XML element in a XML document

```csharp
public class XmlElementSigner : XmlSigner
```

**Hierarquia:** [`object`](https://learn.microsoft.com/dotnet/api/system.object) → [`XmlSigner`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner) → `XmlElementSigner`

## Construtores

### `XmlElementSigner()`

```csharp
public XmlElementSigner()
```

---

## Métodos

### `AddReferences(SignedXml, DigestAlgorithm, XmlPolicySpec)`

```csharp
protected override void AddReferences(SignedXml signedXml, DigestAlgorithm digestAlgorithm, XmlPolicySpec policy)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `signedXml` | [`SignedXml`](https://learn.microsoft.com/dotnet/api/system.security.cryptography.xml.signedxml) |  |
| `digestAlgorithm` | [`DigestAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/DigestAlgorithm) |  |
| `policy` | [`XmlPolicySpec`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlPolicySpec) |  |

---

### `GetToSignEntityTransferData()`

```csharp
protected override byte[] GetToSignEntityTransferData()
```

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte)

---

### `InsertSignatureElement(XmlElement, string, XmlInsertionOptions)`

```csharp
protected override void InsertSignatureElement(XmlElement signatureElement, string xpath, XmlInsertionOptions insertionOption)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `signatureElement` | [`XmlElement`](https://learn.microsoft.com/dotnet/api/system.xml.xmlelement) |  |
| `xpath` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |
| `insertionOption` | [`XmlInsertionOptions`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlInsertionOptions) |  |

---

### `SetIdResolutionTable(XmlIdResolutionTable)`

Sets a table to handle the attribute ID name to be used as ID locally or globally in the XML

```csharp
public void SetIdResolutionTable(XmlIdResolutionTable idResolutionTable)
```

**Parâmetros**

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

---

### `SetToSignElementId(string)`

Sets the element ID, in the passed XML document, which is going to be signed.
If the specific ID attribute value is not known, an XPath can be passed instead: See method SetToSignElementXPath

```csharp
public void SetToSignElementId(string elementId)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `elementId` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | The ID attribute of the element to be signed |

---

### `SetToSignElementXPath(string, NamespaceManager)`

Sets an XPath for selecting the element, with ID attribute, in the passed XML document, which is going to be signed

```csharp
public void SetToSignElementXPath(string xpath, NamespaceManager namespaceMan)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `xpath` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | The XPath for selecting to sign element with ID |
| `namespaceMan` | [`NamespaceManager`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/NamespaceManager) | Namespaces and prefixed on XPath string, if needed |

---

### `SetToSignEntityTransferData(byte[])`

```csharp
protected override void SetToSignEntityTransferData(byte[] transferData)
```

**Parâmetros**

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

---

### `VerifyParameters(bool)`

```csharp
protected override void VerifyParameters(bool computeSignature)
```

**Parâmetros**

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

---

## Membros herdados

[`xmlDocument`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#xmldocument), [`namespaceMan`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#namespaceman), [`SetXml(byte[])`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setxml-system-byte), [`SetXml(XmlDocument)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setxml-system-xml-xmldocument), [`SetPolicy(XmlPolicySpec)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setpolicy-lacuna-pki-xml-xmlpolicyspec), [`SetPolicy(IXmlPolicyMapper)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setpolicy-lacuna-pki-xml-ixmlpolicymapper), [`SetSigningCertificate(PKCertificateWithKey)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setsigningcertificate-lacuna-pki-pkcertificatewithkey), [`SetSigningCertificate(PKCertificate)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setsigningcertificate-lacuna-pki-pkcertificate), [`SetSignatureElementLocation(string, NamespaceManager, XmlInsertionOptions)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setsignatureelementlocation-system-string-lacuna-pki-xml-namespacemanager-lacuna-pki-xml-xmlinsertionoptions), [`SetSignatureElementId(string)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setsignatureelementid-system-string), [`SetCommitmentType(CommitmentType)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setcommitmenttype-lacuna-pki-commitmenttype), [`SetDataObjectFormat(string)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setdataobjectformat-system-string), [`SetTimestampRequester(ITimestampRequester)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#settimestamprequester-lacuna-pki-itimestamprequester), [`SetClassicEnvelopedTransformation(bool)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setclassicenvelopedtransformation-system-boolean), [`SetCertificateValidationConfigurator(Action<CertificateValidationOptions>)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setcertificatevalidationconfigurator-system-action-lacuna-pki-certificatevalidationoptions), [`GenerateToSignHash(out SignatureAlgorithm, out byte[])`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#generatetosignhash-lacuna-pki-signaturealgorithm-system-byte), [`SetPrecomputedSignature(byte[], byte[])`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#setprecomputedsignature-system-byte-system-byte), [`ComputeSignature()`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#computesignature), [`VerifySignerParameters(bool)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#verifysignerparameters-system-boolean), [`GetSignatureElement()`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#getsignatureelement), [`GetSignedXml()`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#getsignedxml), [`InsertSignatureElement()`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#insertsignatureelement), [`FulfillTransformations(Reference)`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#fulfilltransformations-system-security-cryptography-xml-reference), [`Warnings`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#warnings), [`ValidationResults`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Xml/XmlSigner#validationresults), [`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)
