3f244a3a365b7b2df44f284bfc24e1bbe5c2c715
[shibboleth/cpp-xmltooling.git] / xmltooling / security / KeyInfoCredentialContext.h
1 /*
2  *  Copyright 2001-2010 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=nullptr);
48
49         /**
50          * Constructor
51          *
52          * @param keyInfo   surrounding native KeyInfo context object
53          */
54         KeyInfoCredentialContext(DSIGKeyInfoList* keyInfo);
55
56         virtual ~KeyInfoCredentialContext();
57
58         /**
59          * Gets the KeyInfo context.
60          * 
61          * @return the KeyInfo context
62          */
63         const xmlsignature::KeyInfo* getKeyInfo() const;
64
65         /**
66          * Gets the native KeyInfo context.
67          * 
68          * @return the native KeyInfo context
69          */
70         DSIGKeyInfoList* getNativeKeyInfo() const;
71
72     private:
73         const xmlsignature::KeyInfo* m_keyInfo;
74         DSIGKeyInfoList* m_nativeKeyInfo;
75     };
76 };
77
78 #endif /* __xmltooling_keyinfocredctx_h__ */