Refactor extraction of certificate details.
[shibboleth/xmltooling.git] / xmltooling / signature / impl / XMLSecSignatureImpl.cpp
index 388ceb0..da8eb1a 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "internal.h"
 #include "exceptions.h"
+#include "logging.h"
 #include "impl/UnknownElement.h"
 #include "security/Credential.h"
 #include "signature/KeyInfo.h"
@@ -30,7 +31,6 @@
 #include "util/XMLConstants.h"
 #include "util/XMLHelper.h"
 
-#include <log4cpp/Category.hh>
 #include <xercesc/framework/MemBufInputSource.hpp>
 #include <xercesc/framework/Wrapper4InputSource.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
@@ -45,8 +45,8 @@
 #include <xsec/transformers/TXFMOutputFile.hpp>
 
 using namespace xmlsignature;
+using namespace xmltooling::logging;
 using namespace xmltooling;
-using namespace log4cpp;
 using namespace std;
 using xmlconstants::XMLSIG_NS;
 using xmlconstants::XMLSIG_PREFIX;
@@ -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,18 +529,3 @@ 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;
-        }
-    }
-}