2 * Copyright 2001-2006 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file saml/security/ChainingTrustEngine.h
20 * X509TrustEngine that uses multiple engines in sequence.
23 #ifndef __saml_chaintrust_h__
24 #define __saml_chaintrust_h__
26 #include <saml/security/X509TrustEngine.h>
31 * X509TrustEngine that uses multiple engines in sequence.
33 class SAML_API ChainingTrustEngine : public X509TrustEngine {
38 * If a DOM is supplied, the following XML content is supported:
41 * <li><TrustEngine> elements with a type attribute
44 * XML namespaces are ignored in the processing of this content.
46 * @param e DOM to supply configuration for provider
48 ChainingTrustEngine(const DOMElement* e=NULL);
51 * Destructor will delete any embedded engines.
53 virtual ~ChainingTrustEngine();
56 * Adds a trust engine for future calls.
58 * @param newEngine trust engine to add
60 void addTrustEngine(X509TrustEngine* newEngine) {
61 m_engines.push_back(newEngine);
65 * Removes a trust engine. The caller must delete the engine if necessary.
67 * @param oldEngine trust engine to remove
68 * @return the old engine
70 X509TrustEngine* removeTrustEngine(X509TrustEngine* oldEngine) {
71 for (std::vector<X509TrustEngine*>::iterator i=m_engines.begin(); i!=m_engines.end(); i++) {
72 if (oldEngine==(*i)) {
80 virtual bool validate(
81 xmlsignature::Signature& sig,
82 const saml2md::RoleDescriptor& role,
83 const xmlsignature::KeyResolver* keyResolver=NULL
85 virtual bool validate(
86 const XMLCh* sigAlgorithm,
88 xmlsignature::KeyInfo* keyInfo,
91 const saml2md::RoleDescriptor& role,
92 const xmlsignature::KeyResolver* keyResolver=NULL
94 virtual bool validate(
95 XSECCryptoX509* certEE,
96 const std::vector<XSECCryptoX509*>& certChain,
97 const saml2md::RoleDescriptor& role,
99 const xmlsignature::KeyResolver* keyResolver=NULL
103 std::vector<X509TrustEngine*> m_engines;
108 #endif /* __saml_chaintrust_h__ */