589d2cfb6d1016a056b5d667c0845f988c221e00
[shibboleth/cpp-xmltooling.git] / xmltooling / security / KeyInfoCredentialContext.h
1 /*
2  *  Copyright 2001-2009 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file xmltooling/security/KeyInfoCredentialContext.h
19  * 
20  * Context for credentials resolved out of a KeyInfo.
21  */
22
23 #if !defined(__xmltooling_keyinfocredctx_h__) && !defined(XMLTOOLING_NO_XMLSEC)
24 #define __xmltooling_keyinfocredctx_h__
25
26 #include <xmltooling/security/CredentialContext.h>
27
28 class DSIGKeyInfoList;
29
30 namespace xmlsignature {
31     class XMLTOOL_API KeyInfo;
32 }
33
34 namespace xmltooling {
35
36     /**
37      * Context for credentials resolved out of a KeyInfo.
38      */
39     class XMLTOOL_API KeyInfoCredentialContext : public CredentialContext
40     {
41     public:
42         /**
43          * Constructor
44          *
45          * @param keyInfo   surrounding KeyInfo context object
46          */
47         KeyInfoCredentialContext(const xmlsignature::KeyInfo* keyInfo=NULL) : m_keyInfo(keyInfo), m_nativeKeyInfo(NULL) {
48         }
49
50         /**
51          * Constructor
52          *
53          * @param keyInfo   surrounding native KeyInfo context object
54          */
55         KeyInfoCredentialContext(DSIGKeyInfoList* keyInfo) : m_keyInfo(NULL), m_nativeKeyInfo(keyInfo) {
56         }
57
58         virtual ~KeyInfoCredentialContext() {}
59
60         /**
61          * Gets the KeyInfo context.
62          * 
63          * @return the KeyInfo context
64          */
65         const xmlsignature::KeyInfo* getKeyInfo() const {
66             return m_keyInfo;
67         }
68
69         /**
70          * Gets the native KeyInfo context.
71          * 
72          * @return the native KeyInfo context
73          */
74         DSIGKeyInfoList* getNativeKeyInfo() const {
75             return m_nativeKeyInfo;
76         }
77
78     private:
79         const xmlsignature::KeyInfo* m_keyInfo;
80         DSIGKeyInfoList* m_nativeKeyInfo;
81     };
82 };
83
84 #endif /* __xmltooling_keyinfocredctx_h__ */