X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsignature%2FContentReference.cpp;h=121d8bcebb1e90b7a6e703c2f0419d33eb62a3bc;hb=9d8a89e650195f2b083af82f030aa0eceb75d9bb;hp=b63e3de9ed714b0f5b1140dc6a361d215c97a472;hpb=a3920d52b3f6ed678e72b820d9c90b6acaf38116;p=shibboleth%2Fopensaml2.git diff --git a/saml/signature/ContentReference.cpp b/saml/signature/ContentReference.cpp index b63e3de..121d8bc 100644 --- a/saml/signature/ContentReference.cpp +++ b/saml/signature/ContentReference.cpp @@ -1,68 +1,68 @@ -/* - * 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 -#include -#include -#include - -using namespace opensaml; -using namespace std; - -class _addprefix : public binary_function { -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)); -} +/* + * 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 +#include +#include +#include + +using namespace opensaml; +using namespace std; + +class _addprefix : public binary_function { +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)); +}