Recent Entries
- Real Season Begins!
- Good User Interface ...
- Restarting the User ...
- Flex Builder 3 Requi...
- A Good Night!
- OT: What happened to...
- Using jQuery
- Philly CFUG Dec. 18 ...
- Next Philly CFUG
- Philly CFUG Tomorrow
Popular Entries
- Import/Export in SQL...
- SAML and ColdFusion ...
- SAML and ColdFusion ...
- SAML and ColdFusion ...
- SQL Server 2005 Expr...
- SAML and ColdFusion ...
- Improving Performanc...
- Learning Flex
- SAML and ColdFusion ...
- Second Blog CFC Surv...
Top Commenters
- Nathan Mische (11)
- Peter Bell (4)
- Terrence Ryan (3)
- Scott (2)
- Jim Priest (2)
- David (2)
- Scott Stroz (2)
- Scott P (2)
- Justin Alpino (2)
- Ravneet (2)
Slideshows
Pool Surprises...Sponsored Links
Search
Subscribe
Enter your email address to subscribe to this blog.RSS
Tags
cfug coldfusion generalArchives
- Adobe (5) [RSS]
- AIR (6) [RSS]
- ASP.NET (2) [RSS]
- Books (1) [RSS]
- CFEclipse (5) [RSS]
- CFUG (24) [RSS]
- CFUnited (3) [RSS]
- ColdFusion (50) [RSS]
- College Football (3) [RSS]
- Conferences (1) [RSS]
- Development Tools (2) [RSS]
- DIY (1) [RSS]
- Eagles (3) [RSS]
- Fireworks (1) [RSS]
- Flash (3) [RSS]
- Flex (9) [RSS]
- Flyers (2) [RSS]
- Frameworks (5) [RSS]
- General (28) [RSS]
- Hockey (2) [RSS]
- Hosting (1) [RSS]
- House (2) [RSS]
- HTML (2) [RSS]
- JavaScript (1) [RSS]
- Jobs (1) [RSS]
- Macromedia (0) [RSS]
- Misc. (5) [RSS]
- Model-Glue (4) [RSS]
- Navy Football (5) [RSS]
- onair2007Philadelphia (3) [RSS]
- onairbustour (3) [RSS]
- Other Sports (4) [RSS]
- Performance (3) [RSS]
- Personal (2) [RSS]
- Phillies (2) [RSS]
- Projects, User Group Manager (1) [RSS]
- Rant (1) [RSS]
- Rants (1) [RSS]
- SAML (6) [RSS]
- Site (1) [RSS]
- Soccer (4) [RSS]
- SQL Server (2) [RSS]
- Transportation (1) [RSS]
- Wedding (2) [RSS]
AGGREGATORS
SAML and ColdFusion Part 3 : XML Digital Signatures
Posted On April 16, 2007 6:23 PM By Phil in SAML,ColdFusion
In parts one and two, I talked about the basics of SAML as well as the structure of a SAML assertion. In this entry, I am going to briefly cover a part of the assertion I skipped over last time, the Digital Signature. XML Digital Signatures are a common part of SAML artificats as they help to provide:
- Flexibility in signing documents
- Uses existing cryptographic and security technologies such as X509 and SHA1
- The integrity of the document and data transfered
- Creation and Verification of portable signatures
It is important to note that XML Digital Signature is different from the XML Encryption specification. The XML Signature is in plain text as part of an overall XML document. There are three ways that a signature can be constructed:
- Enveloping - The signature contains the information it signed
- Enveloped - The signature is contained within the document it is signing
- Detached - The signature is outside of the document it is signing and contained within a different document
I believe, and I could be wrong on this, but the requirements of SAML indicate the need to utilize an enveloped digital signature within a SAML artifact. Well, this is all well and good, but what exactly comprises an XML Digital Signature and what's it mean for a SAML assertion? Well, I could go into a lot of detail here, but instead, I will redirect you to some of the resources I used in my latest SAML project:
- W3C Xml Digital Signature specification
- Sitepoint article on Getting Started with XML Security
- Xml.com article Introduction to XML Digital Signatures
As you will see, the XML Digital Signature is comprised of essentially the following:
<SignedInfo>
<CanonicalizationMethod/>
<SignatureMethod />
<Reference URI="">
<Transforms>
<Transform/>
</Transforms>
<DigestMethod/>
<DigestValue></DigestValue>
</Reference>
</SignedInfo>
<SignatureValue></SignatureValue>
<KeyInfo></KeyInfo>
</Signature>
The Signature element can be comprised of 3 main areas: SignedInfo, SignatureValue, KeyInfo. At a minimum, the Singature node must contain the SignedInfo and SignatureValue nodes. It is possible to generate and send a signature without the KeyInfo node if both the generating and validating parties have exchanged certificates or keys already. The text value in the SignatureValue node is the encrypted form of the SignedInfo area of the Signature node. The Reference node can be a self-contained or external reference to some piece of data. This data does not have to be XML, HTML or any type of text as it can, through a URI reference, be an image or a file as well. This markup will have gone through transformation or processing directives identified in the Transforms node (there can be more than one Transform child node) and is encrypted using the Algorithm attribute of the DigestMethod to produce the text in the DigestValue node. Two nodes I haven't talked about are the SignatureMethod and CanonicalizationMethod nodes. The SignatureMethod describes how the Signature itself was created, ensuring that the document can be validated and that no substitution or alterations to the signature has occurred. The CanonicalizationMethod node identifies the method of XML canonicalization that has been used on the signature itself to ensure that the XML is processed correctly by varying XML parsers. Most likely one would also find canonicalization as a transformation of a reference as well. Finally, the KeyInfo node can contain various items all related to the key needed for decryption from the KeyName to an X509 Serial Number and even the entire X509 certificate itself. In most of the real-world examples I have seen, the KeyInfo is either omitted entirely or contains a simple KeyName or X509/X509SerialNumber node for certificate references. Below is a good example of an Assertion and Digital Signature together.
AssertionId="#id-353FE620-1143-EBE0-E1C96F56FD89EE2E"
IssueInstant="2007-01-01 14:30:23Z"
Version="2.0">
<saml:Issuer>https://www.identityprovider.com/IDP</saml:Issuer>
<saml:Conditions NotAfter="2007-01-01 14:31:23Z" NotBefore="2007-01-01 14:30:23Z">
<saml:AudienceRestriction>
<saml:Audience>http://www.serviceprovider.com/SP</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2007-01-01 14:30:23Z"
SessionIndex="1234567890">
<saml:AuthContext>
<saml:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:Password
</saml:AuthnContextClassRef>
</saml:AuthContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Subject>
<saml:NameID format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">
foppa@identityprovider.com
</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
</saml:Subject>
<saml:Attribute AttributeName="idpSystemID" AttributeNamespace="http://www.identityprovider.com">
<saml:AttributeValue>foppa21</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
<ds:Signature xmlns:ds=
"http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<ds:SignatureMethod Algorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds"Reference URI="#id-353FE620-1143-EBE0-E1C96F56FD89EE2E">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</ds:Transforms>
<ds:DigestMethod Algorithm=
"http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>kD4OdqaLdEE7p6EEM0TPEMZEwOk=
</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>UPV5eNf0XNsvmw6Lb6ejyc/BGkiMeU6X1Sh
JIBiHWnYMdpr+AACTKaZ33SSeWGn2PlhL4gcILOFA5+fXsqHIC+
TcyfXbEHj//ftH3f7J+DzfhBKEwDyT07B4ssHTSpd4jwheG/Kj8 Gg94KmTuhmuCTMPZLvzYI8x2mplLgqtNuI=</ds:SignatureValue>
</ds:Signature>
</saml:Assertion>
In the next part of this series, I will go into how we can create a SAML Assertion and sign it using ColdFusion and Java, what libraries to use, where to put them, and what steps are needed to ensure compilation and execution are done correctly.


philduba.com




Comments
Hopefully I'll get my first example done tonight and post an entry afterwards. It might be broken in two since there's a setup that has to happen as well.
Can I ask you how you manage to have CF working with the log4j version 1.2 that is needed by OpenSAML knowing that CF "need" log4j 1.1
I used the Apache XML Security library, version 1.2.0 and xmlsec-1.2.96.jar file instead of the inlcuded one in the 1.2.0 version.