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/KeyInfoResolver.h
20 * Resolves credentials from KeyInfo information.
23 #if !defined(__xmltooling_keyres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_keyres_h__
26 #include <xsec/dsig/DSIGKeyInfoList.hpp>
28 namespace xmlsignature {
29 class XMLTOOL_API KeyInfo;
30 class XMLTOOL_API Signature;
33 namespace xmltooling {
35 class XMLTOOL_API Credential;
36 class XMLTOOL_API CredentialCriteria;
39 * Resolves credentials from KeyInfo information.
41 * <p>Credential-specific bitmasks can be provided to control what to resolve.
43 class XMLTOOL_API KeyInfoResolver {
44 MAKE_NONCOPYABLE(KeyInfoResolver);
48 virtual ~KeyInfoResolver() {}
51 * Returns a credential based on the supplied KeyInfo information.
52 * The caller must release the credential when done with it.
54 * @param keyInfo the key information
55 * @param types types of credentials to resolve, or 0 for any/all
56 * @return the resolved credential, or NULL
58 virtual Credential* resolve(const xmlsignature::KeyInfo* keyInfo, int types=0) const=0;
61 * Returns a credential based on the supplied KeyInfo information.
62 * The caller must release the credential when done with it.
64 * @param keyInfo the key information
65 * @param types types of credentials to resolve, or 0 for any/all
66 * @return the resolved credential, or NULL
68 virtual Credential* resolve(DSIGKeyInfoList* keyInfo, int types=0) const=0;
71 * Returns a credential based on the supplied KeyInfo information.
72 * The caller must release the credential when done with it.
74 * @param sig signature containing the key information
75 * @param types types of credentials to resolve, or 0 for any/all
76 * @return the resolved credential, or NULL
78 Credential* resolve(const xmlsignature::Signature* sig, int types=0) const;
81 * Returns a credential based on the KeyInfo information in the supplied
82 * criteria. The caller must release the credential when done with it.
84 * @param criteria criteria containing the key information
85 * @param types types of credentials to resolve, or 0 for any/all
86 * @return the resolved credential, or NULL
88 Credential* resolve(const CredentialCriteria& criteria, int types=0) const;
92 * Registers KeyInfoResolver classes into the runtime.
94 void XMLTOOL_API registerKeyInfoResolvers();
96 /** KeyInfoResolver based on extracting by value directly out of a KeyInfo */
97 #define INLINE_KEYINFO_RESOLVER "Inline"
100 #endif /* __xmltooling_keyres_h__ */