Allow for SAML 1.0 whole doc signing.
authorScott Cantor <cantor.2@osu.edu>
Fri, 29 Sep 2006 17:42:09 +0000 (17:42 +0000)
committerScott Cantor <cantor.2@osu.edu>
Fri, 29 Sep 2006 17:42:09 +0000 (17:42 +0000)
saml/signature/ContentReference.cpp

index 8253be4..b63e3de 100644 (file)
@@ -44,22 +44,23 @@ public:
 \r
 void ContentReference::createReferences(DSIGSignature* sig)\r
 {\r
+    DSIGReference* ref=NULL;\r
     const XMLCh* id=m_signableObject.getXMLID();\r
     if (!id || !*id)\r
-        throw xmlsignature::SignatureException("Cannot create Signature reference to SAML object without an identifier."); \r
-    \r
-    DSIGReference* ref=NULL;\r
-    XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2];\r
-    buf[0]=chPound;\r
-    buf[1]=chNull;\r
-    XMLString::catString(buf,id);\r
-    try {\r
-        ref=sig->createReference(buf);\r
-        delete[] buf;\r
-    }\r
-    catch(...) {\r
-        delete[] buf;\r
-        throw;\r
+        ref=sig->createReference(&chNull);  // whole doc reference\r
+    else {\r
+        XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2];\r
+        buf[0]=chPound;\r
+        buf[1]=chNull;\r
+        XMLString::catString(buf,id);\r
+        try {\r
+            ref=sig->createReference(buf);\r
+            delete[] buf;\r
+        }\r
+        catch(...) {\r
+            delete[] buf;\r
+            throw;\r
+        }\r
     }\r
     ref->appendEnvelopedSignatureTransform();\r
     DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(CANON_C14NE_NOC);\r