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/KeyInfoSource.h
20 * Interface for objects that can supply KeyInfo objects to a TrustEngine
21 * via the KeyInfoIterator interface.
24 #if !defined(__xmltooling_keysource_h__) && !defined(XMLTOOLING_NO_XMLSEC)
25 #define __xmltooling_keysource_h__
27 #include <xmltooling/base.h>
30 namespace xmlsignature {
31 class XMLTOOL_API KeyInfo;
34 namespace xmltooling {
37 * Callback interface to supply KeyInfo objects to a TrustEngine.
38 * Applications can adapt TrustEngines to their environment by supplying
39 * implementations of this interface.
41 class XMLTOOL_API KeyInfoIterator {
42 MAKE_NONCOPYABLE(KeyInfoIterator);
46 virtual ~KeyInfoIterator() {}
49 * Indicates whether additional KeyInfo objects are available.
51 * @return true iff another KeyInfo object can be fetched
53 virtual bool hasNext() const=0;
56 * Returns the next KeyInfo object available.
58 * @return the next KeyInfo object, or NULL if none are left
60 virtual const xmlsignature::KeyInfo* next()=0;
64 * Interface for objects that can supply KeyInfo objects to a TrustEngine
65 * via the KeyInfoIterator interface.
67 class XMLTOOL_API KeyInfoSource {
71 virtual ~KeyInfoSource() {}
74 * Returns the name of this source of keys, for example a peer entity name
75 * or a principal's name.
77 * @return name of key source, or empty string
79 virtual std::string getName() const=0;
82 * Provides access to the KeyInfo information associated with the source.
83 * The caller must free the returned interface when finished with it.
85 * @return interface for obtaining KeyInfo data
87 virtual KeyInfoIterator* getKeyInfoIterator() const=0;
92 #endif /* __xmltooling_keysource_h__ */