https://github.com/etheadev/delphi-saml
A SAML implementation for Delphi developers
https://github.com/etheadev/delphi-saml
Last synced: 5 months ago
JSON representation
A SAML implementation for Delphi developers
- Host: GitHub
- URL: https://github.com/etheadev/delphi-saml
- Owner: EtheaDev
- License: apache-2.0
- Created: 2022-10-21T06:51:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-14T18:47:53.000Z (10 months ago)
- Last Synced: 2025-09-14T20:44:07.291Z (10 months ago)
- Language: Pascal
- Size: 2.95 MB
- Stars: 39
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.htm
- License: LICENSE
- Support: Docs/SupportingDelphi.jpg
Awesome Lists containing this project
README
code{
font-family: "Consolas", monospace;
}
pre{
border: 1px solid #ddd;
border-left: 3px solid #f36d33;
overflow: auto;
padding: 1em 1.5em;
display: block;
}
Blockquote{
border-left: 3px solid #d0d0d0;
padding-left: 0.5em;
margin-left:1em;
}
Blockquote p{
margin: 0;
}
table{
border:1px solid;
border-collapse:collapse;
}
th{ padding:5px;
border:1px solid;
}
td{
padding:5px;
border:1px solid;
}
Delphi SAML implementation
Delphi SAML is a SAML implementation written on top of xmlsec. The basic idea behind the code comes from samltools.
Supported Delphi versions: from Delphi 10.1 to Delphi 13

How to setup a service provider locally?
- Clone the repo
- Copy all the DLL in the Demos\bin folder (see installation)
- Setup a loopback mapping to “sp.samltools.com”. On windows:
- Open
C:\Windows\System32\drivers\etc\hosts - Add
127.0.0.1 sp.samltools.com - Compile Demos\SAML\SPDemo.dpr
- Run it
- Choose
idp-auth0.iniin Identity Provider settings - Choose
sp-auth0.iniin Serivce Provider settings - Click
Open Browserand follow the instructions
Demo

Installation
Download the zip files for your platform and extract all DLLs into the demos\bin folder.
You can found the precompiled binaries of the DLL here:
-
32bit: https://www.zlatkovic.com/pub/libxml/ -
64bit: https://www.aleksey.com/xmlsec/download/win64/
The required DLL are:
-
libxmlsec.dll: main DLL-
libxml2.dll: to handle XML-
iconv.dll: to convert between charsets
-
-
libxmlsec-mscrypto.dll: if you want to use cryptographics functions from msCrypto (install msCrypto from MS) -
libxmlsec-openssl.dll: or if you want to use cryptographics functions from OpenSSLlibeay32.dllssleay32.dll
-
-
zlib1.dll: compression… but I'm not sure who need it -
libexslt.dll: xsl transformations (optional) -
libxslt.dll: xsl transformations (optional)
If you want you can extract xmlsec.exe and openssl.exe. The first can be used to test XML signing and encryption, and the second to handle certificates and cryptography.
TODO
- 📌 Better metadata support
- ✨ Identity provider implementation
- ✨ Basic key format conversion (PEM, DER, …)
Documentation
Delphi SAML consists of some modules:
- The cryptographic units: used to handle signing and encryption
- The SAML message units: to build request and parse response
- The metadata unit: to read and write metadata
- The demos: to see how
Delphi SAMLworks
If you need more help you can read the API documentation.
License
Delphi SAML is released under the term of the Apache License. Here follows the licenses of all dependencies:
Library
License
Using with proprietary applications/libraries
xmlsec-core
MIT license
Yes
xmlsec-openssl
OpenSSL License
Yes
xmlsec-mscrypto
Microsoft licensing: The libraries are part of MS Windows, and are also distributed with Internet Explorer.
Unknown
libxml2
MIT license
Yes
iconv
LGPL
Yes
openssl
Apache-2.0 license
Yes
zlib1
Zlib license
Yes
libexslt
MIT License
Yes
libxslt
MIT License
Yes
Resources
SAML documentation:
- http://docs.oasis-open.org/security/saml/v2.0/saml-2.0-os.zip
- https://developer.okta.com/docs/concepts/saml/
- https://shibboleth.atlassian.net/wiki/spaces/CONCEPT/overview
- https://en.wikipedia.org/wiki/SAML_2.0
XML-Sec API:
- https://www.aleksey.com/xmlsec/api/
Resources:
- https://samltest.id/
- https://www.samltool.com/online_tools.php
- https://github.com/monmohan/samltools
Generate the keys
If you want to sign you request you need a private and a public key. You can generate both with this command:
keygen.bat -h sp.samltools.com -e urn:msingh.samltools:sp -y 10
See command line for further detail.
Release Notes:
ver.1.3.0 - 13 Mar 2023
- 64bit support
- support for xmlsec 1.3
- New SAML.inc file to use the right version of the DLLs bindings
- Better demo
- Support for encrypted private keys
ver.1.2.0 - 11 Jul 2023
- Certificates and keys can be loaded from a buffer
- SP configuration improvement: NameIdFormat, Comparison, IssuerNameQualifier, IssuerFormat
- Support for signatures in nodes different from the root node
ver.1.1.0 - 1 Apr 2023
- SPID support (Italy's public digital identity)
- Support for HTTP-POST binding
- New AuthnRequest attribute “AuthnContext”
ver.1.0.0 - 24 Oct 2022
- First stable version