---
title: "Signing external content"
description: "XML signatures of content outside the document, local or online, with DetachedResourceXmlSigner and OnlineResourceXmlSigner in PKI SDK."
canonical: "https://docs.lacunasoftware.com/en-us/articles/pki-sdk/signatures/xml/detached-resources"
locale: "en"
product: "PKI SDK"
last_updated: "2026-10-12"
---

# Signing external content

The XML signature standard lets you create signatures whose signed content is outside the XML document, or signatures of any
content.

PKI SDK offers two ways to sign external content. The @Lacuna.Pki.Xml.DetachedResourceXmlSigner signer is meant for content that
is local to the application. The @Lacuna.Pki.Xml.OnlineResourceXmlSigner signer is meant for online content, outside the
application.

In this signature mode, you can choose not to pass any XML document to the signer. The `signedXml` result is then a new XML
document with the signature node as its root node.

If you pass an XML document to the signer (`signer.SetXml(xmlDocument)`), the signature node is included in that XML, following
the insertion rules described in [Insertion modes](https://docs.lacunasoftware.com/en-us/articles/pki-sdk/signatures/xml/insertion).

Below are examples of each signer:

## Local external content

```cs
var signer = new DetachedResourceXmlSigner();
signer.SetToSignDetachedResource(resource, "uri.to.resource");
signer.SetPolicy(policy);
signer.SetSigningCertificate(certWithKey);
signer.ComputeSignature();
var signedXml = signer.GetSignedXml();
```

## Online external content

```cs
var signer = new OnlineResourceXmlSigner();
signer.SetToSignResourceUri(resourceUri);
signer.SetPolicy(policy);
signer.SetSigningCertificate(certWithKey);
signer.ComputeSignature();
var signedXml = signer.GetSignedXml();
```
