2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * @file CredentialResolver.h
\r
20 * Provides access to keys and certificates.
\r
23 #if !defined(__xmltooling_credres_h__) && !defined(XMLTOOLING_NO_XMLSEC)
\r
24 #define __xmltooling_credres_h__
\r
26 #include <xmltooling/Lockable.h>
\r
29 #include <xsec/enc/XSECCryptoKey.hpp>
\r
30 #include <xsec/enc/XSECCryptoX509.hpp>
\r
32 namespace xmltooling {
\r
35 * An abstract interface to credential formats like files, keystores, hardware tokens, etc.
\r
36 * All non-const methods require that the interface be locked.
\r
38 class XMLTOOL_API CredentialResolver : public virtual Lockable
\r
40 MAKE_NONCOPYABLE(CredentialResolver);
\r
42 virtual ~CredentialResolver() {}
\r
45 * Returns an identifier for the credential.
\r
47 * @return the identifier
\r
49 virtual const char* getId() const=0;
\r
52 * Gets the public key associated with the credential.
\r
53 * The caller <strong>MUST NOT</strong> modify the object.
\r
55 * @return the public key, or NULL
\r
57 virtual XSECCryptoKey* getPublicKey()=0;
\r
60 * Gets the private key associated with the credential.
\r
61 * The caller <strong>MUST NOT</strong> modify the object.
\r
63 * @return the private key, or NULL
\r
65 virtual XSECCryptoKey* getPrivateKey()=0;
\r
68 * Gets the certificate chain associated with the credential.
\r
69 * The caller <strong>MUST NOT</strong> modify the objects.
\r
70 * The EE certificate <strong>MUST</strong> be first.
\r
72 * @return a chain of certificates, or NULL
\r
74 virtual const std::vector<XSECCryptoX509*>* getX509Certificates()=0;
\r
77 CredentialResolver() {}
\r
82 #endif /* __xmltooling_credres_h__ */
\r