*/
#include "internal.h"
+#include "logging.h"
#include "security/BasicX509Credential.h"
#include "security/KeyInfoCredentialContext.h"
#include "security/KeyInfoResolver.h"
#include "util/XMLConstants.h"
#include "validation/ValidatorSuite.h"
-#include <log4cpp/Category.hh>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xsec/dsig/DSIGKeyInfoX509.hpp>
#include <xsec/enc/XSECKeyInfoResolverDefault.hpp>
#include <xsec/framework/XSECException.hpp>
using namespace xmlsignature;
+using namespace xmltooling::logging;
using namespace xmltooling;
-using namespace log4cpp;
using namespace std;
namespace xmltooling {
return NULL;
}
- const KeyInfo* getKeyInfo(bool compact=false) const {
- return m_credctx->getKeyInfo();
+ KeyInfo* getKeyInfo(bool compact=false) const {
+ KeyInfo* ret = m_credctx->getKeyInfo() ? m_credctx->getKeyInfo()->cloneKeyInfo() : NULL;
+ if (ret) {
+ ret->setId(NULL);
+ ret->getRetrievalMethods().clear();
+ if (compact) {
+ ret->getKeyValues().clear();
+ ret->getSPKIDatas().clear();
+ ret->getPGPDatas().clear();
+ ret->getUnknownXMLObjects().clear();
+ VectorOf(X509Data) x509Datas=ret->getX509Datas();
+ for (VectorOf(X509Data)::size_type pos = 0; pos < x509Datas.size();) {
+ x509Datas[pos]->getX509Certificates().clear();
+ x509Datas[pos]->getX509CRLs().clear();
+ x509Datas[pos]->getUnknownXMLObjects().clear();
+ if (x509Datas[pos]->hasChildren())
+ ++pos;
+ else
+ x509Datas.erase(x509Datas.begin() + pos);
+ }
+ }
+ }
+ if (!ret->hasChildren()) {
+ delete ret;
+ ret = NULL;
+ }
+ return ret;
}
const CredentialContext* getCredentialContext() const {
bool InlineCredential::resolveKey(const KeyInfo* keyInfo)
{
- Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver");
+ Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver."INLINE_KEYINFO_RESOLVER);
// Check for ds:KeyValue
const vector<KeyValue*>& keyValues = keyInfo->getKeyValues();
bool InlineCredential::resolveCerts(const KeyInfo* keyInfo)
{
- Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver");
+ Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver."INLINE_KEYINFO_RESOLVER);
// Check for ds:X509Data
const vector<X509Data*>& x509Datas=keyInfo->getX509Datas();
bool InlineCredential::resolveCRL(const KeyInfo* keyInfo)
{
- Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver");
+ Category& log = Category::getInstance(XMLTOOLING_LOGCAT".KeyInfoResolver."INLINE_KEYINFO_RESOLVER);
// Check for ds:X509Data
const vector<X509Data*>& x509Datas=keyInfo->getX509Datas();
}
catch(XSECException& e) {
auto_ptr_char temp(e.getMsg());
- Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver").error("caught XML-Security exception loading certificate: %s", temp.get());
+ Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver."INLINE_KEYINFO_RESOLVER).error("caught XML-Security exception loading certificate: %s", temp.get());
}
catch(XSECCryptoException& e) {
- Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver").error("caught XML-Security exception loading certificate: %s", e.getMsg());
+ Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver."INLINE_KEYINFO_RESOLVER).error("caught XML-Security exception loading certificate: %s", e.getMsg());
}
}
}
catch(XSECException& e) {
auto_ptr_char temp(e.getMsg());
- Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver").error("caught XML-Security exception loading CRL: %s", temp.get());
+ Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver."INLINE_KEYINFO_RESOLVER).error("caught XML-Security exception loading CRL: %s", temp.get());
}
catch(XSECCryptoException& e) {
- Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver").error("caught XML-Security exception loading CRL: %s", e.getMsg());
+ Category::getInstance(XMLTOOLING_LOGCAT".KeyResolver."INLINE_KEYINFO_RESOLVER).error("caught XML-Security exception loading CRL: %s", e.getMsg());
}
}
}