2 * Copyright 2001-2006 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.
20 * XMLObjects representing XML Digital Signature, version 20020212, KeyInfo element
21 * and related content.
24 #ifndef __xmltooling_keyinfo_h__
25 #define __xmltooling_keyinfo_h__
27 #include <xmltooling/ElementProxy.h>
28 #include <xmltooling/exceptions.h>
29 #include <xmltooling/XMLObjectBuilder.h>
30 #include <xmltooling/util/XMLConstants.h>
31 #include <xmltooling/validation/ValidatingXMLObject.h>
35 #define DECL_XMLSIGOBJECTBUILDER(cname) \
36 DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmltooling::XMLConstants::XMLSIG_NS,xmltooling::XMLConstants::XMLSIG_PREFIX)
38 namespace xmlsignature {
40 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,KeyName,Name,XML Digital Signature version 20020212 KeyName element);
41 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,MgmtData,Data,XML Digital Signature version 20020212 MgmtData element);
42 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Modulus,Value,XML Digital Signature version 20020212 Modulus element);
43 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Exponent,Value,XML Digital Signature version 20020212 Exponent element);
44 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Seed,Value,XML Digital Signature version 20020212 Seed element);
45 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,PgenCounter,Value,XML Digital Signature version 20020212 PgenCounter element);
46 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,P,Value,XML Digital Signature version 20020212 P element);
47 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Q,Value,XML Digital Signature version 20020212 Q element);
48 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,G,Value,XML Digital Signature version 20020212 G element);
49 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,Y,Value,XML Digital Signature version 20020212 Y element);
50 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,J,Value,XML Digital Signature version 20020212 J element);
51 DECL_XMLOBJECT_SIMPLE(XMLTOOL_API,XPath,Expression,XML Digital Signature version 20020212 XPath element);
53 BEGIN_XMLOBJECT(XMLTOOL_API,DSAKeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 DSAKeyValue element);
54 DECL_XMLOBJECT_CHILD(P);
55 DECL_XMLOBJECT_CHILD(Q);
56 DECL_XMLOBJECT_CHILD(G);
57 DECL_XMLOBJECT_CHILD(Y);
58 DECL_XMLOBJECT_CHILD(J);
59 DECL_XMLOBJECT_CHILD(Seed);
60 DECL_XMLOBJECT_CHILD(PgenCounter);
61 /** DSAKeyValueType local name */
62 static const XMLCh TYPE_NAME[];
65 BEGIN_XMLOBJECT(XMLTOOL_API,RSAKeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 RSAKeyValue element);
66 DECL_XMLOBJECT_CHILD(Modulus);
67 DECL_XMLOBJECT_CHILD(Exponent);
68 /** RSAKeyValueType local name */
69 static const XMLCh TYPE_NAME[];
72 BEGIN_XMLOBJECT(XMLTOOL_API,KeyValue,xmltooling::XMLObject,XML Digital Signature version 20020212 KeyValue element);
73 DECL_XMLOBJECT_CHILD(DSAKeyValue);
74 DECL_XMLOBJECT_CHILD(RSAKeyValue);
75 DECL_XMLOBJECT_CHILD(XMLObject);
76 DECL_XMLOBJECT_CONTENT(TextContent);
77 /** KeyValueType local name */
78 static const XMLCh TYPE_NAME[];
81 BEGIN_XMLOBJECT(XMLTOOL_API,Transform,xmltooling::ElementProxy,XML Digital Signature version 20020212 Transform element);
82 DECL_XMLOBJECT_ATTRIB(Algorithm,ALGORITHM);
83 DECL_XMLOBJECT_CHILDREN(XPath);
84 /** TransformType local name */
85 static const XMLCh TYPE_NAME[];
88 BEGIN_XMLOBJECT(XMLTOOL_API,Transforms,xmltooling::XMLObject,XML Digital Signature version 20020212 Transforms element);
89 DECL_XMLOBJECT_CHILDREN(Transform);
90 /** TransformsType local name */
91 static const XMLCh TYPE_NAME[];
94 BEGIN_XMLOBJECT(XMLTOOL_API,KeyInfo,xmltooling::ElementProxy,XML Digital Signature version 20020212 KeyInfo element);
95 DECL_XMLOBJECT_ATTRIB(Id,ID);
96 DECL_XMLOBJECT_CHILDREN(KeyName);
97 DECL_XMLOBJECT_CHILDREN(MgmtData);
98 /** KeyInfoType local name */
99 static const XMLCh TYPE_NAME[];
102 DECL_XMLSIGOBJECTBUILDER(XPath);
103 DECL_XMLSIGOBJECTBUILDER(Transform);
104 DECL_XMLSIGOBJECTBUILDER(Transforms);
105 DECL_XMLSIGOBJECTBUILDER(KeyName);
106 DECL_XMLSIGOBJECTBUILDER(MgmtData);
107 DECL_XMLSIGOBJECTBUILDER(Modulus);
108 DECL_XMLSIGOBJECTBUILDER(Exponent);
109 DECL_XMLSIGOBJECTBUILDER(Seed);
110 DECL_XMLSIGOBJECTBUILDER(PgenCounter);
111 DECL_XMLSIGOBJECTBUILDER(P);
112 DECL_XMLSIGOBJECTBUILDER(Q);
113 DECL_XMLSIGOBJECTBUILDER(G);
114 DECL_XMLSIGOBJECTBUILDER(Y);
115 DECL_XMLSIGOBJECTBUILDER(J);
116 DECL_XMLSIGOBJECTBUILDER(DSAKeyValue);
117 DECL_XMLSIGOBJECTBUILDER(RSAKeyValue);
118 DECL_XMLSIGOBJECTBUILDER(KeyValue);
119 DECL_XMLSIGOBJECTBUILDER(KeyInfo);
121 #ifdef XMLTOOLING_DECLARE_VALIDATORS
122 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeyName,Name);
123 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData,Data);
124 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Modulus,Value);
125 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Exponent,Value);
126 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Seed,Value);
127 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter,Value);
128 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,P,Value);
129 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Q,Value);
130 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,G,Value);
131 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Y,Value);
132 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,J,Value);
133 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,XPath,Expression);
135 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RSAKeyValue);
136 XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Modulus);
137 XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Exponent);
138 END_XMLOBJECTVALIDATOR;
140 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,DSAKeyValue);
141 XMLOBJECTVALIDATOR_REQUIRE(DSAKeyValue,Y);
142 XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,P,Q);
143 XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,Seed,PgenCounter);
144 END_XMLOBJECTVALIDATOR;
146 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyValue);
147 XMLOBJECTVALIDATOR_ONEOF3(KeyValue,DSAKeyValue,RSAKeyValue,XMLObject);
148 END_XMLOBJECTVALIDATOR;
150 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transform);
151 XMLOBJECTVALIDATOR_REQUIRE(Transform,Algorithm);
152 END_XMLOBJECTVALIDATOR;
154 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transforms);
155 XMLOBJECTVALIDATOR_NONEMPTY(Transforms,Transform);
156 END_XMLOBJECTVALIDATOR;
158 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyInfo);
159 XMLOBJECTVALIDATOR_NONEMPTY(KeyInfo,XMLObject);
160 END_XMLOBJECTVALIDATOR;
161 #endif /* XMLTOOLING_DECLARE_VALIDATORS */
165 #endif /* __xmltooling_keyinfo_h__ */