CryptoSys Home > Sc14n

SC14N, a straightforward XML canonicalization utility

The program SC14N performs the canonicalization (C14N) transformations you need to do when creating signed XML documents using XML-DSIG. It takes an input XML file and outputs the canonicalized transformation or its digest value.

Download | BUY NOW! | Documentation | Notes | References | Contact us

When we say "straightforward", we mean the documents not the procedure. We mean the usual XML documents you come across in practice, not the obscure corner cases using the more arcane parts of the XML specification.

SC14N carries out both inclusive and exclusive canonicalization (see Notes). You can canonicalize the entire document (which you'd do for a detached signature), or omit a given element (e.g. the Signature element for an enveloped signature), or just transform a subset of the document (e.g. the SignedInfo element, or a given Id reference).

You can output the result to a new XML file, or compute its SHA-1 or SHA-256 digest value directly. The APIs allow you to work entirely in memory.

You can use SC14N from the Windows command-line or use one of the programming interfaces using C#, VB.NET, C, C++, VBA, VB6 or Python.

If you're reading this then we assume you understand what canonicalization is and how it is used to sign an XML document. For background, see our related pages on the topic Canonicalization of an XML document and Signing an XML document using XMLDSIG.

2022-04-05: Released new version 3.1 of SC14N. See New in the latest version.
2021-08-03: Released new version 3.0 of SC14N.
2019-12-28: Released version 2.1.1 of Sc14n Py updated from Python 2 to Python 3.
2019-12-14: Released new version 2.1 of SC14N.
2018-11-28: Added page on exclusive C14N. See Exclusive C14N examples.
2018-11-19: Released version 2.0 of SC14N with support for exclusive c14n.
See also our new free utility xmlsq, XML Simple Query. xmlsq is a simple lightweight utility to query XML documents using XPath 1.0 and an ideal companion for SC14N. Use xmlsq to query your XML files and use SC14N to canonicalize it.

Here are two quick examples.

Example using command line

This example transforms the input XML document excluding the <Signature> element. This is the transformation used for an enveloped-signature.

sc14n -x Signature olamundo.xml
<Envelope xmlns="">
    Olá mundo


sc14n --digest-value --exclude-bytag=Signature olamundo.xml

For the full command-line syntax see Using Sc14n from the command line.

Example using C#

using Sc14n;
// ...
// Example 1. Excludes the first element with the tag name <Signature>
r = C14n.ToFile("c14nfile1.txt", "input.xml", "Signature", Tran.OmitByTag);

// Example 2. Finds and transforms the first element with the tag name <SignedInfo>
r = C14n.ToFile("c14nfile2.txt", "input.xml", "SignedInfo", Tran.SubsetByTag);

For more details on using C# (and other programming languages) see Programming interfaces to SC14N.

A tip to check XML well-formedness

To check if your XML document is well-formed, just c14n the entire document and check the error message. new New in v3.0: use the --check (-k) option.

> sc14n --check notxml.xml
Error code -9: Invalid XML structure:
Error: Invalid at the top level of the document (Line: 1)

> sc14n -k olamundo-bad.xml
Error code -9: Invalid XML structure:
Error: Tag 'Envelope' was not closed (Line: 35)

> sc14n -k olamundo.xml

Other links


Download the Trial Edition of SC14N for Windows now. The Trial Edition is fully-functional and expires after 60 days. Please read the licence conditions for the Trial Edition and the Notes and Limitations below.

Licensed users can download the latest licensed version here.

Most recent production version 3.1.0 compiled 5 April 2022 with updated v3.1.0.1 of sc14n.exe 13 August 2023. Use either

Either unzip the zip file and run the install.exe program inside it, or download the exe program directly and run it. Minimum required operating system is Windows XP-SP2 and above (that is, XP/Vista/W7/W8/W10) or Windows Server 2003 and above.

Please note it is a breach of copyright to put a copy of these installation files on another server or to distribute them in any manner except by providing a link to this page.

Trouble installing: If Microsoft Defender Smartscreen gives you a warning, see Unrecognized app error. (TL;DR Click "More info" then "Run anyway"). Check that you see "Publisher: D.I. MANAGEMENT SERVICES PTY LIMITED".

After installing, test by opening a command line window and typing sc14n --help. See Command-line syntax for more details.

Check out our free XML companion utility xmlsq

Our free XML Simple Query utility xmlsq makes an ideal companion tool for SC14N. Use xmlsq to query your XML files and use SC14N to canonicalize it. xmlsq is lightweight, free and does not expire. Download now.

Buy now

You can purchase a licenced version here. (Please make sure you have tested the Trial Edition before purchase and make sure it does what you require.)

Existing licence holders can download the latest Developer Version here.


See the documentation page



We don't support: Microsoft .NET incompatibility:

New in the latest version

NewChanges in v3.1 (April 2022)

Changes in v3.0 (August 2021)

Changes in v2.1 (December 2019)

Changes in v2.0 (November 2018)


Contact us

For more information about SC14N, please send us a message.

Revision History

This page first published 11 July 2017. Last updated 13 August 2023

[Go to top]