Partial addition of 1.1 KeyInfo extensions.
[shibboleth/cpp-xmltooling.git] / xmltooling / signature / KeyInfo.h
1 /*
2  *  Copyright 2001-2007 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/signature/KeyInfo.h
19  * 
20  * XMLObjects representing XML Digital Signature, version 20020212, KeyInfo element
21  * and related content.
22  */
23
24 #if !defined(__xmltooling_keyinfo_h__) && !defined(XMLTOOLING_NO_XMLSEC)
25 #define __xmltooling_keyinfo_h__
26
27 #include <xmltooling/ConcreteXMLObjectBuilder.h>
28 #include <xmltooling/ElementProxy.h>
29 #include <xmltooling/util/XMLConstants.h>
30
31 /**
32  * Macro for declaring signature builders.
33  * 
34  * @param cname name of class being built
35  */
36 #define DECL_XMLSIGOBJECTBUILDER(cname) \
37     DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmlconstants::XMLSIG_NS,xmlconstants::XMLSIG_PREFIX)
38
39 namespace xmlsignature {
40
41     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,KeyName,Name,XML Digital Signature version 20020212 KeyName element);
42     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,MgmtData,Data,XML Digital Signature version 20020212 MgmtData element);
43     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Modulus,Value,XML Digital Signature version 20020212 Modulus element);
44     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Exponent,Value,XML Digital Signature version 20020212 Exponent element);
45     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Seed,Value,XML Digital Signature version 20020212 Seed element);
46     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,PgenCounter,Value,XML Digital Signature version 20020212 PgenCounter element);
47     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,P,Value,XML Digital Signature version 20020212 P element);
48     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Q,Value,XML Digital Signature version 20020212 Q element);
49     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,G,Value,XML Digital Signature version 20020212 G element);
50     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Y,Value,XML Digital Signature version 20020212 Y element);
51     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,J,Value,XML Digital Signature version 20020212 J element);
52     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,XPath,Expression,XML Digital Signature version 20020212 XPath element);
53     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509IssuerName,Name,XML Digital Signature version 20020212 X509IssuerName element);
54     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509SerialNumber,SerialNumber,XML Digital Signature version 20020212 X509SerialNumber element);
55     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509SKI,Value,XML Digital Signature version 20020212 X509SKI element);
56     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509SubjectName,Name,XML Digital Signature version 20020212 X509SubjectName element);
57     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509Certificate,Value,XML Digital Signature version 20020212 X509Certificate element);
58     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,X509CRL,Value,XML Digital Signature version 20020212 X509CRL element);
59     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,OCSPResponse,Response,XML Digital Signature version 1.1 OCSPResponse element);
60     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,SPKISexp,Value,XML Digital Signature version 20020212 SPKISexp element);
61     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,PGPKeyID,ID,XML Digital Signature version 20020212 PGPKeyID element);
62     DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,PGPKeyPacket,Packet,XML Digital Signature version 20020212 PGPKeyPacket element);
63
64     BEGIN_XMLOBJECT(XMLTOOL_API,DSAKeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 DSAKeyValue element);
65         DECL_TYPED_CHILD(P);
66         DECL_TYPED_CHILD(Q);
67         DECL_TYPED_CHILD(G);
68         DECL_TYPED_CHILD(Y);
69         DECL_TYPED_CHILD(J);
70         DECL_TYPED_CHILD(Seed);
71         DECL_TYPED_CHILD(PgenCounter);
72         /** DSAKeyValueType local name */
73         static const XMLCh TYPE_NAME[];
74     END_XMLOBJECT;
75
76     BEGIN_XMLOBJECT(XMLTOOL_API,RSAKeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 RSAKeyValue element);
77         DECL_TYPED_CHILD(Modulus);
78         DECL_TYPED_CHILD(Exponent);
79         /** RSAKeyValueType local name */
80         static const XMLCh TYPE_NAME[];
81     END_XMLOBJECT;
82
83     BEGIN_XMLOBJECT(XMLTOOL_API,KeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 KeyValue element);
84         DECL_TYPED_CHILD(DSAKeyValue);
85         DECL_TYPED_CHILD(RSAKeyValue);
86         DECL_XMLOBJECT_CHILD(UnknownXMLObject);
87         /** KeyValueType local name */
88         static const XMLCh TYPE_NAME[];
89     END_XMLOBJECT;
90
91     BEGIN_XMLOBJECT(XMLTOOL_API,DEREncodedKeyValue,xmltooling::XMLObject,XML Digital Signature version 1.1 DEREncodedKeyValue element);
92         DECL_STRING_ATTRIB(Id,ID);
93         DECL_SIMPLE_CONTENT(Value);
94         /** DEREncodedKeyValueType local name */
95         static const XMLCh TYPE_NAME[];
96     END_XMLOBJECT;
97
98     BEGIN_XMLOBJECT(XMLTOOL_API,Transform,xmltooling::ElementExtensibleXMLObject,XML Digital Signature version 20020212 Transform element);
99         DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
100         DECL_TYPED_CHILDREN(XPath);
101         /** TransformType local name */
102         static const XMLCh TYPE_NAME[];
103     END_XMLOBJECT;
104
105     BEGIN_XMLOBJECT(XMLTOOL_API,Transforms,xmltooling::XMLObject,XML Digital Signature version 20020212 Transforms element);
106         DECL_TYPED_CHILDREN(Transform);
107         /** TransformsType local name */
108         static const XMLCh TYPE_NAME[];
109     END_XMLOBJECT;
110
111     BEGIN_XMLOBJECT(XMLTOOL_API,RetrievalMethod,xmltooling::XMLObject,XML Digital Signature version 20020212 RetrievalMethod element);
112         DECL_STRING_ATTRIB(URI,URI);
113         DECL_STRING_ATTRIB(Type,TYPE);
114         DECL_TYPED_CHILD(Transforms);
115         /** RetrievalMethodType local name */
116         static const XMLCh TYPE_NAME[];
117         /** DSAKeyValue RetrievalMethod Type */
118         static const XMLCh TYPE_DSAKEYVALUE[];
119         /** RSAKeyValue RetrievalMethod Type */
120         static const XMLCh TYPE_RSAKEYVALUE[];
121         /** X509Data RetrievalMethod Type */
122         static const XMLCh TYPE_X509DATA[];
123     END_XMLOBJECT;
124
125     BEGIN_XMLOBJECT(XMLTOOL_API,X509IssuerSerial,xmltooling::XMLObject,XML Digital Signature version 20020212 X509IssuerSerial element);
126         DECL_TYPED_CHILD(X509IssuerName);
127         DECL_TYPED_CHILD(X509SerialNumber);
128         /** X509IssuerSerialType local name */
129         static const XMLCh TYPE_NAME[];
130     END_XMLOBJECT;
131
132     BEGIN_XMLOBJECT(XMLTOOL_API,X509Data,xmltooling::ElementExtensibleXMLObject,XML Digital Signature version 20020212 X509Data element);
133         DECL_TYPED_CHILDREN(X509IssuerSerial);
134         DECL_TYPED_CHILDREN(X509SKI);
135         DECL_TYPED_CHILDREN(X509SubjectName);
136         DECL_TYPED_CHILDREN(X509Certificate);
137         DECL_TYPED_CHILDREN(X509CRL);
138         /** X509DataType local name */
139         static const XMLCh TYPE_NAME[];
140     END_XMLOBJECT;
141
142     BEGIN_XMLOBJECT(XMLTOOL_API,SPKIData,xmltooling::XMLObject,XML Digital Signature version 20020212 SPKIData element);
143         /** SPKIDataType local name */
144         static const XMLCh TYPE_NAME[];
145         
146         /** Returns modifiable collection of SPKIsexp/XMLObject pairs. */
147         virtual VectorOfPairs(SPKISexp,xmltooling::XMLObject) getSPKISexps()=0;
148         
149         /** Returns reference to immutable collection of SPKIsexp/XMLObject pairs. */
150         virtual const std::vector< std::pair<SPKISexp*,xmltooling::XMLObject*> >& getSPKISexps() const=0;
151     END_XMLOBJECT;
152
153     BEGIN_XMLOBJECT(XMLTOOL_API,PGPData,xmltooling::ElementExtensibleXMLObject,XML Digital Signature version 20020212 PGPData element);
154         DECL_TYPED_CHILD(PGPKeyID);
155         DECL_TYPED_CHILD(PGPKeyPacket);
156         /** PGPDataType local name */
157         static const XMLCh TYPE_NAME[];
158     END_XMLOBJECT;
159
160     BEGIN_XMLOBJECT(XMLTOOL_API,KeyInfo,xmltooling::ElementExtensibleXMLObject,XML Digital Signature version 20020212 KeyInfo element);
161         DECL_STRING_ATTRIB(Id,ID);
162         DECL_TYPED_CHILDREN(X509Data);
163         DECL_TYPED_CHILDREN(KeyName);
164         DECL_TYPED_CHILDREN(KeyValue);
165         DECL_TYPED_CHILDREN(RetrievalMethod);
166         DECL_TYPED_CHILDREN(MgmtData);
167         DECL_TYPED_CHILDREN(PGPData);
168         DECL_TYPED_CHILDREN(SPKIData);
169         /** KeyInfoType local name */
170         static const XMLCh TYPE_NAME[];
171     END_XMLOBJECT;
172
173     BEGIN_XMLOBJECT(XMLTOOL_API,KeyInfoReference,xmltooling::XMLObject,XML Digital Signature version 1.1 KeyInfoReference element);
174         DECL_STRING_ATTRIB(Id,ID);
175         DECL_STRING_ATTRIB(URI,URI);
176         /** KeyInfoReferenceType local name */
177         static const XMLCh TYPE_NAME[];
178     END_XMLOBJECT;
179
180     DECL_XMLSIGOBJECTBUILDER(PGPData);
181     DECL_XMLSIGOBJECTBUILDER(PGPKeyID);
182     DECL_XMLSIGOBJECTBUILDER(PGPKeyPacket);
183     DECL_XMLSIGOBJECTBUILDER(SPKIData);
184     DECL_XMLSIGOBJECTBUILDER(SPKISexp);
185     DECL_XMLSIGOBJECTBUILDER(OCSPResponse);
186     DECL_XMLSIGOBJECTBUILDER(X509IssuerSerial);
187     DECL_XMLSIGOBJECTBUILDER(X509IssuerName);
188     DECL_XMLSIGOBJECTBUILDER(X509SerialNumber);
189     DECL_XMLSIGOBJECTBUILDER(X509SKI);
190     DECL_XMLSIGOBJECTBUILDER(X509SubjectName);
191     DECL_XMLSIGOBJECTBUILDER(X509Certificate);
192     DECL_XMLSIGOBJECTBUILDER(X509CRL);
193     DECL_XMLSIGOBJECTBUILDER(X509Data);
194     DECL_XMLSIGOBJECTBUILDER(XPath);
195     DECL_XMLSIGOBJECTBUILDER(Transform);
196     DECL_XMLSIGOBJECTBUILDER(Transforms);
197     DECL_XMLSIGOBJECTBUILDER(RetrievalMethod);
198     DECL_XMLSIGOBJECTBUILDER(KeyName);
199     DECL_XMLSIGOBJECTBUILDER(MgmtData);
200     DECL_XMLSIGOBJECTBUILDER(Modulus);
201     DECL_XMLSIGOBJECTBUILDER(Exponent);
202     DECL_XMLSIGOBJECTBUILDER(Seed);
203     DECL_XMLSIGOBJECTBUILDER(PgenCounter);
204     DECL_XMLSIGOBJECTBUILDER(P);
205     DECL_XMLSIGOBJECTBUILDER(Q);
206     DECL_XMLSIGOBJECTBUILDER(G);
207     DECL_XMLSIGOBJECTBUILDER(Y);
208     DECL_XMLSIGOBJECTBUILDER(J);
209     DECL_XMLSIGOBJECTBUILDER(DSAKeyValue);
210     DECL_XMLSIGOBJECTBUILDER(RSAKeyValue);
211     DECL_XMLSIGOBJECTBUILDER(KeyValue);
212     DECL_XMLSIGOBJECTBUILDER(DEREncodedKeyValue);
213     DECL_XMLSIGOBJECTBUILDER(KeyInfo);
214     DECL_XMLSIGOBJECTBUILDER(KeyInfoReference);
215
216     /**
217      * Registers builders and validators for KeyInfo classes into the runtime.
218      */
219     void XMLTOOL_API registerKeyInfoClasses();
220
221 };
222
223 #endif /* __xmltooling_keyinfo_h__ */