X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2FXMLToolingConfig.cpp;h=ae102b9fcfb93be2735cfabf21a74ecb30797272;hb=a21d1f24fc3fb85928b014b69c0e6916dcb66955;hp=e8e6ad872acf074dcb68aa6db7bf96b34acd9226;hpb=289be7af572ff899efc2f75878bba2f79a893332;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/XMLToolingConfig.cpp b/xmltooling/XMLToolingConfig.cpp index e8e6ad8..ae102b9 100644 --- a/xmltooling/XMLToolingConfig.cpp +++ b/xmltooling/XMLToolingConfig.cpp @@ -25,7 +25,8 @@ #include "XMLToolingConfig.h" #include "encryption/Encryption.h" #include "impl/UnknownElement.h" -#include "signature/KeyInfo.h" +#include "signature/CredentialResolver.h" +#include "signature/KeyResolver.h" #include "signature/Signature.h" #include "util/NDC.h" #include "util/XMLConstants.h" @@ -35,16 +36,16 @@ # include #endif +#include #include #include #include #include #ifndef XMLTOOLING_NO_XMLSEC #include + #include #endif -#include - using namespace xmlencryption; using namespace xmlsignature; using namespace xmltooling; @@ -176,6 +177,8 @@ bool XMLToolingInternalConfig::init() #ifndef XMLTOOLING_NO_XMLSEC XMLObjectBuilder::registerBuilder(QName(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME),new SignatureBuilder()); REGISTER_EXCEPTION_FACTORY(SignatureException,xmlsignature); + registerKeyResolvers(); + registerCredentialResolvers(); #endif } catch (const xercesc::XMLException&) { @@ -190,9 +193,15 @@ bool XMLToolingInternalConfig::init() void XMLToolingInternalConfig::term() { XMLObjectBuilder::destroyBuilders(); - Validator::destroyValidators(); + KeyInfoSchemaValidators.destroyValidators(); + EncryptionSchemaValidators.destroyValidators(); XMLToolingException::deregisterFactories(); +#ifndef XMLTOOLING_NO_XMLSEC + CredentialResolverManager.deregisterFactories(); + KeyResolverManager.deregisterFactories(); +#endif + for (vector::reverse_iterator i=m_libhandles.rbegin(); i!=m_libhandles.rend(); i++) { #if defined(WIN32) FARPROC fn=GetProcAddress(static_cast(*i),"xmltooling_extension_term"); @@ -317,3 +326,21 @@ bool XMLToolingInternalConfig::load_library(const char* path, void* context) log.info("loaded extension: %s", path); return true; } + +#ifndef XMLTOOLING_NO_XMLSEC +void xmltooling::log_openssl() +{ + const char* file; + const char* data; + int flags,line; + + unsigned long code=ERR_get_error_line_data(&file,&line,&data,&flags); + while (code) { + Category& log=Category::getInstance("OpenSSL"); + log.errorStream() << "error code: " << code << " in " << file << ", line " << line << CategoryStream::ENDLINE; + if (data && (flags & ERR_TXT_STRING)) + log.errorStream() << "error data: " << data << CategoryStream::ENDLINE; + code=ERR_get_error_line_data(&file,&line,&data,&flags); + } +} +#endif