Multi-line svn commit, see body.
[shibboleth/cpp-xmltooling.git] / xmltooling / signature / impl / XMLSecSignatureImpl.cpp
index 57ab8bc..e3aaaac 100644 (file)
@@ -306,9 +306,7 @@ DOMElement* XMLSecSignatureImpl::marshall(DOMDocument* document, const vector<Si
     if (credential) {
         delete m_keyInfo;
         m_keyInfo = NULL;
-        const KeyInfo* fromcred = credential->getKeyInfo();
-        if (fromcred)
-            m_keyInfo = fromcred->cloneKeyInfo();
+        m_keyInfo = credential->getKeyInfo();
     }
     if (m_keyInfo && (!m_signature->getKeyInfoList() || m_signature->getKeyInfoList()->isEmpty())) {
         m_keyInfo->marshall(cachedDOM);
@@ -391,9 +389,7 @@ DOMElement* XMLSecSignatureImpl::marshall(DOMElement* parentElement, const vecto
     if (credential) {
         delete m_keyInfo;
         m_keyInfo = NULL;
-        const KeyInfo* fromcred = credential->getKeyInfo();
-        if (fromcred)
-            m_keyInfo = fromcred->cloneKeyInfo();
+        m_keyInfo = credential->getKeyInfo();
     }
     if (m_keyInfo && (!m_signature->getKeyInfoList() || m_signature->getKeyInfoList()->isEmpty())) {
         m_keyInfo->marshall(cachedDOM);
@@ -533,3 +529,18 @@ bool Signature::verifyRawSignature(
         throw SignatureException(string("Caught an XMLSecurity exception while verifying raw signature: ") + e.getMsg());
     }
 }
+
+void Signature::extractNames(DSIGKeyInfoList* keyInfo, set<string>& names)
+{
+    char* kn;
+    const XMLCh* n;
+
+    for (size_t s=0; s<keyInfo->getSize(); s++) {
+        n=keyInfo->item(s)->getKeyName();
+        if (n && *n) {
+            kn=toUTF8(n);
+            names.insert(kn);
+            delete[] kn;
+        }
+    }
+}