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/signature/CredentialResolver.h
20 * Resolves keys and certificates "owned" by an entity
23 #if !defined(__xmltooling_credres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_credres_h__
26 #include <xmltooling/Lockable.h>
29 #include <xsec/enc/XSECCryptoKey.hpp>
30 #include <xsec/enc/XSECCryptoX509.hpp>
32 namespace xmlsignature {
33 class XMLTOOL_API KeyInfo;
36 namespace xmltooling {
39 * An API for resolving local/owned keys and certificates
41 class XMLTOOL_API CredentialResolver : public Lockable
43 MAKE_NONCOPYABLE(CredentialResolver);
45 CredentialResolver() {}
48 virtual ~CredentialResolver() {}
51 * Returns a secret or private key to use for signing or decryption operations.
52 * The caller is responsible for deleting the key when finished with it.
54 * @param keyInfo optional material identifying a decryption key
55 * @return a secret or private key
57 virtual XSECCryptoKey* getKey(const xmlsignature::KeyInfo* keyInfo=NULL) const=0;
60 * Returns a set of certificates to publish during signing operations.
61 * The certificates must be cloned if kept beyond the scope of a lock.
63 * @return a set of certificates
65 virtual const std::vector<XSECCryptoX509*>& getCertificates() const=0;
69 * Registers CredentialResolver classes into the runtime.
71 void XMLTOOL_API registerCredentialResolvers();
73 /** CredentialResolver based on local files */
74 #define FILESYSTEM_CREDENTIAL_RESOLVER "File"
77 #endif /* __xmltooling_credres_h__ */