2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file xmltooling/security/ChainingTrustEngine.h
24 * OpenSSLTrustEngine that uses multiple engines in sequence.
27 #if !defined(__xmltooling_chaintrust_h__) && !defined(XMLTOOLING_NO_XMLSEC)
28 #define __xmltooling_chaintrust_h__
30 #include <xmltooling/security/OpenSSLTrustEngine.h>
31 #include <xmltooling/security/SignatureTrustEngine.h>
33 #include <boost/ptr_container/ptr_vector.hpp>
35 namespace xmltooling {
38 * OpenSSLTrustEngine that uses multiple engines in sequence.
40 class XMLTOOL_API ChainingTrustEngine : public SignatureTrustEngine, public OpenSSLTrustEngine {
45 * If a DOM is supplied, the following XML content is supported:
48 * <li><TrustEngine> elements with a type attribute
51 * XML namespaces are ignored in the processing of this content.
53 * @param e DOM to supply configuration for provider
55 ChainingTrustEngine(const xercesc::DOMElement* e=nullptr);
58 * Destructor will delete any embedded engines.
60 virtual ~ChainingTrustEngine();
63 * Adds a trust engine for future calls.
65 * @param newEngine trust engine to add
67 void addTrustEngine(TrustEngine* newEngine);
70 * Removes a trust engine. The caller must delete the engine if necessary.
72 * @param oldEngine trust engine to remove
73 * @return the old engine
75 TrustEngine* removeTrustEngine(TrustEngine* oldEngine);
78 xmlsignature::Signature& sig,
79 const CredentialResolver& credResolver,
80 CredentialCriteria* criteria=nullptr
83 const XMLCh* sigAlgorithm,
85 xmlsignature::KeyInfo* keyInfo,
88 const CredentialResolver& credResolver,
89 CredentialCriteria* criteria=nullptr
92 XSECCryptoX509* certEE,
93 const std::vector<XSECCryptoX509*>& certChain,
94 const CredentialResolver& credResolver,
95 CredentialCriteria* criteria=nullptr
99 STACK_OF(X509)* certChain,
100 const CredentialResolver& credResolver,
101 CredentialCriteria* criteria=nullptr
104 boost::ptr_vector<TrustEngine> m_engines;
105 boost::ptr_vector<SignatureTrustEngine,boost::view_clone_allocator> m_sigEngines;
106 boost::ptr_vector<X509TrustEngine,boost::view_clone_allocator> m_x509Engines;
107 boost::ptr_vector<OpenSSLTrustEngine,boost::view_clone_allocator> m_osslEngines;
112 #endif /* __xmltooling_chaintrust_h__ */