Convert from NULL macro to nullptr.
[shibboleth/cpp-xmltooling.git] / xmltooling / security / impl / TrustEngine.cpp
index 1f7d246..7dc9ed4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2010 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 /**
  * TrustEngine.cpp
  * 
- * Registration of factories for built-in engines
+ * Registration of factories for built-in engines.
  */
 
 #include "internal.h"
-#include "security/TrustEngine.h"
+#include "security/KeyInfoResolver.h"
+#include "security/SignatureTrustEngine.h"
+#include "security/OpenSSLTrustEngine.h"
+#include "util/XMLHelper.h"
 
 #include <xercesc/util/XMLUniDefs.hpp>
 
 using namespace xmltooling;
 using namespace std;
 
+using xercesc::DOMElement;
+
 namespace xmltooling {
-    XMLTOOL_DLLLOCAL PluginManager<TrustEngine,const DOMElement*>::Factory ExplicitKeyTrustEngineFactory;
-    XMLTOOL_DLLLOCAL PluginManager<TrustEngine,const DOMElement*>::Factory ChainingTrustEngineFactory;
+    XMLTOOL_DLLLOCAL PluginManager<TrustEngine,string,const DOMElement*>::Factory ExplicitKeyTrustEngineFactory;
+    XMLTOOL_DLLLOCAL PluginManager<TrustEngine,string,const DOMElement*>::Factory StaticPKIXTrustEngineFactory;
+    XMLTOOL_DLLLOCAL PluginManager<TrustEngine,string,const DOMElement*>::Factory ChainingTrustEngineFactory;
 };
 
 void XMLTOOL_API xmltooling::registerTrustEngines()
 {
     XMLToolingConfig& conf=XMLToolingConfig::getConfig();
     conf.TrustEngineManager.registerFactory(EXPLICIT_KEY_TRUSTENGINE, ExplicitKeyTrustEngineFactory);
+    conf.TrustEngineManager.registerFactory(STATIC_PKIX_TRUSTENGINE, StaticPKIXTrustEngineFactory);
     conf.TrustEngineManager.registerFactory(CHAINING_TRUSTENGINE, ChainingTrustEngineFactory);
 }
 
-static const XMLCh GenericKeyResolver[] =           UNICODE_LITERAL_11(K,e,y,R,e,s,o,l,v,e,r);
-static const XMLCh type[] =                         UNICODE_LITERAL_4(t,y,p,e);
+static const XMLCh _KeyInfoResolver[] = UNICODE_LITERAL_15(K,e,y,I,n,f,o,R,e,s,o,l,v,e,r);
+static const XMLCh type[] =             UNICODE_LITERAL_4(t,y,p,e);
 
-TrustEngine::TrustEngine(const DOMElement* e) : m_keyResolver(NULL)
+TrustEngine::TrustEngine(const DOMElement* e) : m_keyInfoResolver(nullptr)
 {
-    DOMElement* child = e ? XMLHelper::getFirstChildElement(e,GenericKeyResolver) : NULL;
+    DOMElement* child = e ? XMLHelper::getFirstChildElement(e,_KeyInfoResolver) : nullptr;
     if (child) {
-        auto_ptr_char t(child->getAttributeNS(NULL,type));
+        auto_ptr_char t(child->getAttributeNS(nullptr,type));
         if (t.get())
-            m_keyResolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(t.get(),child);
+            m_keyInfoResolver = XMLToolingConfig::getConfig().KeyInfoResolverManager.newPlugin(t.get(),child);
         else
-            throw UnknownExtensionException("<KeyResolver> element found with no type attribute");
-    }
-    else if (!m_keyResolver) {
-        m_keyResolver = XMLToolingConfig::getConfig().KeyResolverManager.newPlugin(INLINE_KEY_RESOLVER, child);
+            throw UnknownExtensionException("<KeyInfoResolver> element found with no type attribute");
     }
 }
 
 TrustEngine::~TrustEngine()
 {
-    delete m_keyResolver;
+    delete m_keyInfoResolver;
+}
+
+SignatureTrustEngine::SignatureTrustEngine(const DOMElement* e) : TrustEngine(e)
+{
+}
+
+SignatureTrustEngine::~SignatureTrustEngine()
+{
+}
+
+X509TrustEngine::X509TrustEngine(const DOMElement* e) : TrustEngine(e)
+{
+}
+
+X509TrustEngine::~X509TrustEngine()
+{
+}
+
+OpenSSLTrustEngine::OpenSSLTrustEngine(const DOMElement* e) : X509TrustEngine(e)
+{
+}
+
+OpenSSLTrustEngine::~OpenSSLTrustEngine()
+{
 }