Missing guards for xmlsec EC support.
[shibboleth/cpp-xmltooling.git] / xmltooling / security / KeyInfoResolver.h
index 61c5bf2..042ccd3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 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.
@@ -23,7 +23,9 @@
 #if !defined(__xmltooling_keyres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
 #define __xmltooling_keyres_h__
 
-#include <xsec/dsig/DSIGKeyInfoList.hpp>
+#include <xmltooling/base.h>
+
+class DSIGKeyInfoList;
 
 namespace xmlsignature {
     class XMLTOOL_API KeyInfo;
@@ -34,18 +36,23 @@ namespace xmltooling {
 
     class XMLTOOL_API Credential;
     class XMLTOOL_API CredentialCriteria;
+    class XMLTOOL_API KeyInfoCredentialContext;
 
     /**
      * Resolves credentials from KeyInfo information.
      *
      * <p>Credential-specific bitmasks can be provided to control what to resolve.
+     *
+     * <p>Implementations should only establish KeyNames on the basis of explicit names
+     * within the KeyInfo object, never by extracting names out of physical credentials
+     * found within it.
      */
     class XMLTOOL_API KeyInfoResolver {
         MAKE_NONCOPYABLE(KeyInfoResolver);
     protected:
-        KeyInfoResolver() {}
+        KeyInfoResolver();
     public:
-        virtual ~KeyInfoResolver() {}
+        virtual ~KeyInfoResolver();
         
         /**
          * Returns a credential based on the supplied KeyInfo information.
@@ -53,7 +60,7 @@ namespace xmltooling {
          * 
          * @param keyInfo   the key information
          * @param types     types of credentials to resolve, or 0 for any/all
-         * @return  the resolved credential, or NULL
+         * @return  the resolved credential, or nullptr
          */
         virtual Credential* resolve(const xmlsignature::KeyInfo* keyInfo, int types=0) const=0;
 
@@ -63,17 +70,29 @@ namespace xmltooling {
          * 
          * @param keyInfo   the key information
          * @param types     types of credentials to resolve, or 0 for any/all
-         * @return  the resolved credential, or NULL
+         * @return  the resolved credential, or nullptr
          */
         virtual Credential* resolve(DSIGKeyInfoList* keyInfo, int types=0) const=0;
 
         /**
+         * Returns a credential based on the KeyInfo information in the supplied
+         * context. The caller must release the credential when done with it.
+         *
+         * <p>The context object will be owned by the Credential and freed with it.
+         * 
+         * @param context   context containing the key information
+         * @param types types of credentials to resolve, or 0 for any/all
+         * @return  the resolved credential, or nullptr
+         */
+        virtual Credential* resolve(KeyInfoCredentialContext* context, int types=0) const=0;
+
+        /**
          * Returns a credential based on the supplied KeyInfo information.
          * The caller must release the credential when done with it.
          * 
          * @param sig   signature containing the key information
          * @param types types of credentials to resolve, or 0 for any/all
-         * @return  the resolved credential, or NULL
+         * @return  the resolved credential, or nullptr
          */
         Credential* resolve(const xmlsignature::Signature* sig, int types=0) const;
 
@@ -83,7 +102,7 @@ namespace xmltooling {
          * 
          * @param criteria   criteria containing the key information
          * @param types types of credentials to resolve, or 0 for any/all
-         * @return  the resolved credential, or NULL
+         * @return  the resolved credential, or nullptr
          */
         Credential* resolve(const CredentialCriteria& criteria, int types=0) const;
     };