6f020cd77a83609c7f48832a2643f4ed51d640f5
[shibboleth/cpp-xmltooling.git] / xmltooling / security / X509TrustEngine.h
1 /*
2  *  Copyright 2001-2010 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file xmltooling/security/X509TrustEngine.h
19  * 
20  * TrustEngine interface that adds validation of X.509 credentials.
21  */
22
23 #if !defined(__xmltooling_x509trust_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_x509trust_h__
25
26 #include <xmltooling/security/TrustEngine.h>
27
28 #include <vector>
29
30 class XSECCryptoX509;
31
32 namespace xmltooling {
33
34     class XMLTOOL_API CredentialCriteria;
35     class XMLTOOL_API CredentialResolver;
36
37     /**
38      * TrustEngine interface that adds validation of X.509 credentials.
39      */
40     class XMLTOOL_API X509TrustEngine : public virtual TrustEngine {
41     protected:
42         /**
43          * Constructor.
44          * 
45          * @param e DOM to supply configuration for provider
46          */
47         X509TrustEngine(const xercesc::DOMElement* e=nullptr);
48         
49     public:
50         virtual ~X509TrustEngine();
51
52         /**
53          * Determines whether an X.509 credential is valid with respect to the
54          * source of credentials supplied.
55          * 
56          * <p>It is the responsibility of the application to ensure that the credentials
57          * supplied are in fact associated with the peer who presented the credential.
58          * 
59          * <p>If criteria with a peer name are supplied, the "name" of the EE certificate
60          * may also be checked to ensure that it identifies the intended peer.
61          * The peer name itself or implementation-specific rules based on the content of the
62          * peer credentials may be applied. Implementations may omit this check if they
63          * deem it unnecessary.
64          * 
65          * @param certEE        end-entity certificate to validate
66          * @param certChain     the complete set of certificates presented for validation (includes certEE)
67          * @param credResolver  a locked resolver to supply trusted peer credentials to the TrustEngine
68          * @param criteria      criteria for selecting peer credentials
69          */
70         virtual bool validate(
71             XSECCryptoX509* certEE,
72             const std::vector<XSECCryptoX509*>& certChain,
73             const CredentialResolver& credResolver,
74             CredentialCriteria* criteria=nullptr
75             ) const=0;
76     };
77     
78 };
79
80 #endif /* __xmltooling_x509trust_h__ */