Skip to content

Examples Index

Aleksey Sanin edited this page Apr 5, 2026 · 2 revisions

XML Security Library Examples

The following examples demonstrate how to use the XML Security Library to sign, verify, encrypt, and decrypt XML documents.

Table of Contents

  1. Signing a template file — Signs an XML document using a pre-created signature template file and a PEM private key.
  2. Signing a dynamically created template — Signs an XML document using a dynamically created signature template.
  3. Signing enveloped signature with X509 certificate — Creates an enveloped XML Digital Signature using an X509 certificate.
  4. Signing a node by ID with X509 certificate — Signs a specific XML node referenced by ID attribute using an X509 certificate.
  5. Verifying a signature with a single key — Verifies an XML Digital Signature using a single public key loaded from a PEM file.
  6. Verifying a signature with keys manager — Verifies an XML Digital Signature using a keys manager loaded with multiple keys.
  7. Verifying an enveloped signature with X509 certificates — Verifies an enveloped XML Digital Signature using X509 certificate chain verification.
  8. Verifying a signature of a node with X509 certificates — Verifies a node signature with X509 certificates.
  9. Verifying a signature with additional restrictions — Verifies an XML Digital Signature with additional restrictions (SAML-style).
  10. Encrypting data with a template file — Encrypts binary data using a pre-created encryption template file.
  11. Encrypting data with a dynamically created template — Encrypts an XML document using a dynamically created encryption template.
  12. Encrypting data with a session key — Encrypts an XML document using a session key wrapped with an RSA key from the keys manager.
  13. Decrypting data with a single key — Decrypts encrypted XML data using a single DES key loaded from a binary file.
  14. Decrypting data with keys manager — Decrypts encrypted XML data using a keys manager loaded with DES keys.
  15. Writing a custom keys manager — Demonstrates implementing a custom file-based keys store for decryption.

Clone this wiki locally