2 * Copyright 2001-2007 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 xmltooling/security/OpenSSLTrustEngine.h
20 * Extended TrustEngine interface that adds validation of X.509 credentials
21 * using OpenSSL data types directly for efficiency.
24 #if !defined(__xmltooling_openssltrust_h__) && !defined(XMLTOOLING_NO_XMLSEC)
25 #define __xmltooling_openssltrust_h__
27 #include <xmltooling/security/X509TrustEngine.h>
29 #include <openssl/x509.h>
31 namespace xmltooling {
34 * Extended TrustEngine interface that adds validation of X.509 credentials
35 * using OpenSSL data types directly for efficiency.
37 class XMLTOOL_API OpenSSLTrustEngine : public X509TrustEngine {
42 * If a DOM is supplied, the following XML content is supported:
45 * <li><KeyInfoResolver> elements with a type attribute
48 * XML namespaces are ignored in the processing of this content.
50 * @param e DOM to supply configuration for provider
52 OpenSSLTrustEngine(const xercesc::DOMElement* e=NULL) : X509TrustEngine(e) {}
55 virtual ~OpenSSLTrustEngine() {}
57 virtual bool validate(
58 xmlsignature::Signature& sig,
59 const CredentialResolver& credResolver,
60 CredentialCriteria* criteria=NULL
63 virtual bool validate(
64 const XMLCh* sigAlgorithm,
66 xmlsignature::KeyInfo* keyInfo,
69 const CredentialResolver& credResolver,
70 CredentialCriteria* criteria=NULL
73 virtual bool validate(
74 XSECCryptoX509* certEE,
75 const std::vector<XSECCryptoX509*>& certChain,
76 const CredentialResolver& credResolver,
77 CredentialCriteria* criteria=NULL
81 * Determines whether an X.509 credential is valid with respect to the
82 * source of credentials supplied.
84 * <p>It is the responsibility of the application to ensure that the credentials
85 * supplied are in fact associated with the peer who presented the credential.
87 * <p>If criteria with a peer name are supplied, the "name" of the EE certificate
88 * may also be checked to ensure that it identifies the intended peer.
89 * The peer name itself or implementation-specific rules based on the content of the
90 * peer credentials may be applied. Implementations may omit this check if they
91 * deem it unnecessary.
93 * @param certEE end-entity certificate to validate
94 * @param certChain the complete set of certificates presented for validation (includes certEE)
95 * @param credResolver a locked resolver to supply trusted peer credentials to the TrustEngine
96 * @param criteria criteria for selecting peer credentials
98 virtual bool validate(
99 X509* certEE, STACK_OF(X509)* certChain,
100 const CredentialResolver& credResolver,
101 CredentialCriteria* criteria=NULL
107 #endif /* __xmltooling_openssltrust_h__ */