X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsignature%2FContentReference.cpp;fp=saml%2Fsignature%2FSigningContext.cpp;h=1b452e8d96a2e00165706742f02bb370170f73fe;hb=b951d718d577ab1ec7c3a983e490e5926f19d089;hp=e77052b810a76dc75e6c72ccfd084defb95aeac5;hpb=7f406aae665046273b396888cd8e9422eb825267;p=shibboleth%2Fopensaml2.git diff --git a/saml/signature/SigningContext.cpp b/saml/signature/ContentReference.cpp similarity index 71% rename from saml/signature/SigningContext.cpp rename to saml/signature/ContentReference.cpp index e77052b..1b452e8 100644 --- a/saml/signature/SigningContext.cpp +++ b/saml/signature/ContentReference.cpp @@ -15,14 +15,16 @@ */ /** - * SigningContext.cpp + * ContentReference.cpp * - * SAML-specific signature construction + * SAML-specific signature reference profile */ #include "internal.h" -#include "signature/SigningContext.h" +#include "signature/ContentReference.h" +#include "signature/SignableObject.h" +#include #include #include #include @@ -40,13 +42,17 @@ public: } }; -bool SigningContext::createSignature(DSIGSignature* sig) +void ContentReference::createReferences(DSIGSignature* sig) { + const XMLCh* id=m_signableObject.getId(); + if (!id || !*id) + throw xmlsignature::SignatureException("Cannot create Signature reference to SAML object without an identifier."); + DSIGReference* ref=NULL; - XMLCh* buf=new XMLCh[XMLString::stringLen(m_id) + 2]; + XMLCh* buf=new XMLCh[XMLString::stringLen(id) + 2]; buf[0]=chPound; buf[1]=chNull; - XMLString::catString(buf,m_id); + XMLString::catString(buf,id); try { ref=sig->createReference(buf); delete[] buf; @@ -58,6 +64,4 @@ bool SigningContext::createSignature(DSIGSignature* sig) ref->appendEnvelopedSignatureTransform(); DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(CANON_C14NE_NOC); for_each(m_prefixes.begin(), m_prefixes.end(), bind1st(_addprefix(),c14n)); - - return false; }