-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * ContentReference.cpp\r
- * \r
- * SAML-specific signature reference profile \r
- */\r
- \r
-#include "internal.h"\r
-#include "signature/ContentReference.h"\r
-#include "signature/SignableObject.h"\r
-\r
-#include <xmltooling/signature/Signature.h>\r
-#include <xercesc/util/XMLUniDefs.hpp>\r
-#include <xsec/dsig/DSIGReference.hpp>\r
-#include <xsec/dsig/DSIGTransformC14n.hpp>\r
-\r
-using namespace opensaml;\r
-using namespace std;\r
-\r
-class _addprefix : public binary_function<DSIGTransformC14n*,string,void> {\r
-public:\r
- void operator()(DSIGTransformC14n* t, const string& s) const {\r
- if (s.empty())\r
- t->addInclusiveNamespace("#default");\r
- else \r
- t->addInclusiveNamespace(s.c_str());\r
- }\r
-};\r
-\r
-void ContentReference::createReferences(DSIGSignature* sig)\r
-{\r
- DSIGReference* ref=NULL;\r
- const XMLCh* id=m_signableObject.getXMLID();\r
- if (!id || !*id)\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
- for_each(m_prefixes.begin(), m_prefixes.end(), bind1st(_addprefix(),c14n));\r
-}\r
+/*
+ * Copyright 2001-2006 Internet2
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ContentReference.cpp
+ *
+ * SAML-specific signature reference profile
+ */
+
+#include "internal.h"
+#include "signature/ContentReference.h"
+#include "signature/SignableObject.h"
+
+#include <xmltooling/signature/Signature.h>
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xsec/dsig/DSIGReference.hpp>
+#include <xsec/dsig/DSIGTransformC14n.hpp>
+
+using namespace opensaml;
+using namespace std;
+
+class _addprefix : public binary_function<DSIGTransformC14n*,string,void> {
+public:
+ void operator()(DSIGTransformC14n* t, const string& s) const {
+ if (s.empty())
+ t->addInclusiveNamespace("#default");
+ else
+ t->addInclusiveNamespace(s.c_str());
+ }
+};
+
+void ContentReference::createReferences(DSIGSignature* sig)
+{
+ DSIGReference* ref=NULL;
+ const XMLCh* id=m_signableObject.getXMLID();
+ if (!id || !*id)
+ ref=sig->createReference(&chNull); // whole doc reference
+ else {
+ XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2];
+ buf[0]=chPound;
+ buf[1]=chNull;
+ XMLString::catString(buf,id);
+ try {
+ ref=sig->createReference(buf);
+ delete[] buf;
+ }
+ catch(...) {
+ delete[] buf;
+ throw;
+ }
+ }
+ ref->appendEnvelopedSignatureTransform();
+ DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(CANON_C14NE_NOC);
+ for_each(m_prefixes.begin(), m_prefixes.end(), bind1st(_addprefix(),c14n));
+}