X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=xmltooling%2Fsignature%2Fimpl%2FXMLSecSignatureImpl.cpp;h=dec07c1bf651daeaa059bd383be4d48aadfede24;hb=83de10b45721b7882182aaa8a6df0c729db8fc01;hp=7bce903c2153826a065b03772e2ed3a363a0ef91;hpb=1fa9cd91b91474c524695857a35e892d197266e3;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/signature/impl/XMLSecSignatureImpl.cpp b/xmltooling/signature/impl/XMLSecSignatureImpl.cpp index 7bce903..dec07c1 100644 --- a/xmltooling/signature/impl/XMLSecSignatureImpl.cpp +++ b/xmltooling/signature/impl/XMLSecSignatureImpl.cpp @@ -91,12 +91,15 @@ namespace xmlsignature { } const XMLCh* getSignatureAlgorithm() const { if (!m_sm && m_signature) { +#ifdef XMLTOOLING_XMLSEC_SIGALGORITHM + m_sm = XMLString::replicate(m_signature->getAlgorithmURI()); +#else safeBuffer sURI; - if (signatureHashMethod2URI(sURI, m_signature->getSignatureMethod(), m_signature->getHashMethod()) == false) - return NULL; - m_sm = XMLString::replicate(sURI.sbStrToXMLCh()); + if (signatureHashMethod2URI(sURI, m_signature->getSignatureMethod(), m_signature->getHashMethod())) + m_sm = XMLString::replicate(sURI.sbStrToXMLCh()); +#endif } - return m_sm ? m_sm : DSIGConstants::s_unicodeStrURIRSA_SHA1; + return m_sm; } KeyInfo* getKeyInfo() const { return m_keyInfo; } @@ -276,7 +279,10 @@ DOMElement* XMLSecSignatureImpl::marshall(DOMDocument* document, const vectornewSignature(); temp->setDSIGNSPrefix(XMLSIG_PREFIX); - cachedDOM=temp->createBlankSignature(document, getCanonicalizationMethod(), getSignatureAlgorithm()); + const XMLCh* alg = getSignatureAlgorithm(); + if (!alg) + alg = DSIGConstants::s_unicodeStrURIRSA_SHA1; + cachedDOM=temp->createBlankSignature(document, getCanonicalizationMethod(), alg); m_signature = temp; } else { @@ -373,7 +379,10 @@ DOMElement* XMLSecSignatureImpl::marshall(DOMElement* parentElement, const vecto log.debug("creating empty Signature element"); DSIGSignature* temp=XMLToolingInternalConfig::getInternalConfig().m_xsecProvider->newSignature(); temp->setDSIGNSPrefix(XMLSIG_PREFIX); - cachedDOM=temp->createBlankSignature(parentElement->getOwnerDocument(), getCanonicalizationMethod(), getSignatureAlgorithm()); + const XMLCh* alg = getSignatureAlgorithm(); + if (!alg) + alg = DSIGConstants::s_unicodeStrURIRSA_SHA1; + cachedDOM=temp->createBlankSignature(parentElement->getOwnerDocument(), getCanonicalizationMethod(), alg); m_signature = temp; } else {