File: DSIGSignature_8hpp-source.html

package info (click to toggle)
xml-security-c 1.2.1-3%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 24,472 kB
  • ctags: 6,673
  • sloc: cpp: 36,830; xml: 23,415; sh: 2,365; makefile: 340; perl: 221
file content (268 lines) | stat: -rw-r--r-- 19,201 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XML-Security-C: DSIGSignature.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">src</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">dsig</a></div>
<h1>DSIGSignature.hpp</h1><a href="DSIGSignature_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * Copyright 2002-2005 The Apache Software Foundation.</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00006 <span class="comment"> * You may obtain a copy of the License at</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
00014 <span class="comment"> * limitations under the License.</span>
00015 <span class="comment"> */</span>
00016 
00017 <span class="comment">/*</span>
00018 <span class="comment"> * XSEC</span>
00019 <span class="comment"> *</span>
00020 <span class="comment"> * DSIGSignature := Class for checking and setting up signature nodes in a DSIG signature</span>
00021 <span class="comment"> *</span>
00022 <span class="comment"> * Author(s): Berin Lautenbach</span>
00023 <span class="comment"> *</span>
00024 <span class="comment"> * $Id: DSIGSignature.hpp,v 1.26 2005/06/04 11:30:25 blautenb Exp $</span>
00025 <span class="comment"> *</span>
00026 <span class="comment"> */</span>
00027 
00028 <span class="preprocessor">#ifndef DSIGSIGNATURE_INCLUDE</span>
00029 <span class="preprocessor"></span><span class="preprocessor">#define DSIGSIGNATURE_INCLUDE</span>
00030 <span class="preprocessor"></span>
00031 <span class="comment">// XSEC Includes</span>
00032 <span class="preprocessor">#include &lt;xsec/utils/XSECSafeBufferFormatter.hpp&gt;</span>
00033 <span class="preprocessor">#include &lt;xsec/dsig/DSIGTransform.hpp&gt;</span>
00034 <span class="preprocessor">#include &lt;xsec/dsig/DSIGKeyInfoList.hpp&gt;</span>
00035 <span class="preprocessor">#include &lt;xsec/dsig/DSIGConstants.hpp&gt;</span>
00036 <span class="preprocessor">#include &lt;xsec/dsig/DSIGSignedInfo.hpp&gt;</span>
00037 
00038 <span class="comment">// Xerces Includes</span>
00039 
00040 <span class="preprocessor">#include &lt;xercesc/dom/DOM.hpp&gt;</span>
00041 
00042 <span class="keyword">class </span><a class="code" href="classXSECEnv.html">XSECEnv</a>;
00043 <span class="keyword">class </span><a class="code" href="classXSECBinTXFMInputStream.html">XSECBinTXFMInputStream</a>;
00044 <span class="keyword">class </span><a class="code" href="classXSECURIResolver.html">XSECURIResolver</a>;
00045 <span class="keyword">class </span><a class="code" href="classXSECKeyInfoResolver.html">XSECKeyInfoResolver</a>;
00046 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoValue.html">DSIGKeyInfoValue</a>;
00047 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoX509.html">DSIGKeyInfoX509</a>;
00048 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoName.html">DSIGKeyInfoName</a>;
00049 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoPGPData.html">DSIGKeyInfoPGPData</a>;
00050 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoSPKIData.html">DSIGKeyInfoSPKIData</a>;
00051 <span class="keyword">class </span><a class="code" href="classDSIGKeyInfoMgmtData.html">DSIGKeyInfoMgmtData</a>;
00052 <span class="keyword">class </span><a class="code" href="classDSIGObject.html">DSIGObject</a>;
00053 
00057 <span class="comment">/*\@{*/</span>
00058 
<a name="l00068"></a><a class="code" href="classDSIGSignature.html">00068</a> <span class="keyword">class </span><a class="code" href="XSECDefs_8hpp.html#a9">DSIG_EXPORT</a> <a class="code" href="classDSIGSignature.html">DSIGSignature</a> {
00069 
00070 <span class="keyword">protected</span>:
00071 
00074     
00091     <a class="code" href="classDSIGSignature.html">DSIGSignature</a>(<a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMDocument *doc, 
00092                   <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMNode *sigNode);
00093 
00094     ~<a class="code" href="classDSIGSignature.html">DSIGSignature</a>();
00096     
00097 <span class="keyword">public</span>:
00098 
00101 
00111     <span class="keywordtype">void</span> load(<span class="keywordtype">void</span>);
00112 
00126     <span class="keywordtype">void</span> setSigningKey(<a class="code" href="classXSECCryptoKey.html">XSECCryptoKey</a> *k);
00127 
00129 
00132 
00157     <span class="keywordtype">bool</span> verify(<span class="keywordtype">void</span>);
00158 
00169     <span class="keywordtype">bool</span> verifySignatureOnly(<span class="keywordtype">void</span>);
00170 
00196     <span class="keywordtype">void</span> sign(<span class="keywordtype">void</span>);
00198 
00201     
00222     <span class="keywordtype">void</span> setDSIGNSPrefix(<span class="keyword">const</span> XMLCh * prefix);
00223 
00240     <span class="keywordtype">void</span> setECNSPrefix(<span class="keyword">const</span> XMLCh * prefix);
00241 
00258     <span class="keywordtype">void</span> setXPFNSPrefix(<span class="keyword">const</span> XMLCh * prefix);
00259 
00271     <span class="keywordtype">void</span> setPrettyPrint(<span class="keywordtype">bool</span> flag);
00272 
00279     <span class="keywordtype">bool</span> getPrettyPrint(<span class="keywordtype">void</span>);
00280 
00304     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMElement *createBlankSignature(
00305         <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMDocument *doc,
00306         <a class="code" href="DSIGConstants_8hpp.html#a102">canonicalizationMethod</a> cm = <a class="code" href="DSIGConstants_8hpp.html#a102a60">CANON_C14N_NOC</a>,
00307         <a class="code" href="DSIGConstants_8hpp.html#a103">signatureMethod</a> sm = <a class="code" href="DSIGConstants_8hpp.html#a103a65">SIGNATURE_DSA</a>,
00308         <a class="code" href="DSIGConstants_8hpp.html#a104">hashMethod</a> hm = <a class="code" href="DSIGConstants_8hpp.html#a104a69">HASH_SHA1</a>
00309     );
00310 
00331     <a class="code" href="classDSIGReference.html">DSIGReference</a> * createReference(
00332         <span class="keyword">const</span> XMLCh * URI,
00333         <a class="code" href="DSIGConstants_8hpp.html#a104">hashMethod</a> hm = <a class="code" href="DSIGConstants_8hpp.html#a104a69">HASH_SHA1</a>, 
00334         <span class="keywordtype">char</span> * type = NULL
00335     );
00336 
00338 
00341 
00355     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> calculateSignedInfoAndReferenceHash(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * hashBuf, 
00356                                                     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hashBufLen);
00357 
00371     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> calculateSignedInfoHash(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * hashBuf, 
00372                                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hashBufLen);
00373 
00383     <a class="code" href="classDSIGReferenceList.html">DSIGReferenceList</a> * getReferenceList(<span class="keywordtype">void</span>);
00384 
00398     <a class="code" href="classXSECBinTXFMInputStream.html">XSECBinTXFMInputStream</a> * makeBinInputStream(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
00399 
00400 
00414     <span class="keyword">const</span> XMLCh * getErrMsgs(<span class="keywordtype">void</span>);
00415 
00424     <span class="keyword">const</span> XMLCh * getDSIGNSPrefix();
00425 
00433     <span class="keyword">const</span> XMLCh * getECNSPrefix();
00434 
00442     <span class="keyword">const</span> XMLCh * getXPFNSPrefix();
00443 
<a name="l00454"></a><a class="code" href="classDSIGSignature.html#z46_8">00454</a>     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMDocument * getParentDocument() 
00455         {<span class="keywordflow">return</span> mp_doc;}
00456 
<a name="l00466"></a><a class="code" href="classDSIGSignature.html#z46_9">00466</a>     <a class="code" href="DSIGConstants_8hpp.html#a102">canonicalizationMethod</a> getCanonicalizationMethod(<span class="keywordtype">void</span>) 
00467     {<span class="keywordflow">return</span> (mp_signedInfo != NULL ? 
00468              mp_signedInfo-&gt;getCanonicalizationMethod() : <a class="code" href="DSIGConstants_8hpp.html#a102a59">CANON_NONE</a>);}
00469 
00470 
<a name="l00480"></a><a class="code" href="classDSIGSignature.html#z46_10">00480</a>     <a class="code" href="DSIGConstants_8hpp.html#a104">hashMethod</a> getHashMethod(<span class="keywordtype">void</span>)
00481     {<span class="keywordflow">return</span> (mp_signedInfo != NULL ? 
00482              mp_signedInfo-&gt;getHashMethod() : <a class="code" href="DSIGConstants_8hpp.html#a104a68">HASH_NONE</a>);}
00483 
<a name="l00493"></a><a class="code" href="classDSIGSignature.html#z46_11">00493</a>     <a class="code" href="DSIGConstants_8hpp.html#a103">signatureMethod</a> getSignatureMethod(<span class="keywordtype">void</span>)
00494     {<span class="keywordflow">return</span> (mp_signedInfo != NULL ? 
00495              mp_signedInfo-&gt;getSignatureMethod() : <a class="code" href="DSIGConstants_8hpp.html#a103a64">SIGNATURE_NONE</a>);}
00496 
00505     <span class="keyword">const</span> XMLCh * getSignatureValue(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
00506          
<a name="l00514"></a><a class="code" href="classDSIGSignature.html#z46_13">00514</a>     <a class="code" href="classXSECSafeBufferFormatter.html">XSECSafeBufferFormatter</a> * getSBFormatter(<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> mp_formatter;}
00515 
00517 
00520 
00529     <span class="keywordtype">void</span> setURIResolver(<a class="code" href="classXSECURIResolver.html">XSECURIResolver</a> * resolver);
00530 
00537     <a class="code" href="classXSECURIResolver.html">XSECURIResolver</a> * getURIResolver(<span class="keywordtype">void</span>);
00538 
00547     <span class="keywordtype">void</span> setKeyInfoResolver(<a class="code" href="classXSECKeyInfoResolver.html">XSECKeyInfoResolver</a> * resolver);
00548 
00555     <a class="code" href="classXSECKeyInfoResolver.html">XSECKeyInfoResolver</a> * getKeyInfoResolver(<span class="keywordtype">void</span>);
00556 
00558 
00562 
<a name="l00578"></a><a class="code" href="classDSIGSignature.html#z48_0">00578</a>     <a class="code" href="classDSIGKeyInfoList.html">DSIGKeyInfoList</a> * getKeyInfoList() {<span class="keywordflow">return</span> &amp;m_keyInfoList;}
00579 
00588     <span class="keywordtype">void</span> clearKeyInfo(<span class="keywordtype">void</span>);
00589 
00602     <a class="code" href="classDSIGKeyInfoValue.html">DSIGKeyInfoValue</a> * appendDSAKeyValue(<span class="keyword">const</span> XMLCh * P, 
00603                            <span class="keyword">const</span> XMLCh * Q, 
00604                            <span class="keyword">const</span> XMLCh * G, 
00605                            <span class="keyword">const</span> XMLCh * Y);
00606 
00617     <a class="code" href="classDSIGKeyInfoValue.html">DSIGKeyInfoValue</a> * appendRSAKeyValue(<span class="keyword">const</span> XMLCh * modulus, 
00618                            <span class="keyword">const</span> XMLCh * exponent);
00619 
00631     <a class="code" href="classDSIGKeyInfoX509.html">DSIGKeyInfoX509</a> * appendX509Data(<span class="keywordtype">void</span>);
00632 
00643     <a class="code" href="classDSIGKeyInfoName.html">DSIGKeyInfoName</a> * appendKeyName(<span class="keyword">const</span> XMLCh * name, <span class="keywordtype">bool</span> isDName = <span class="keyword">false</span>);
00644 
00656     <a class="code" href="classDSIGKeyInfoPGPData.html">DSIGKeyInfoPGPData</a> * appendPGPData(<span class="keyword">const</span> XMLCh * <span class="keywordtype">id</span>, <span class="keyword">const</span> XMLCh * packet);
00657 
00667     <a class="code" href="classDSIGKeyInfoSPKIData.html">DSIGKeyInfoSPKIData</a> * appendSPKIData(<span class="keyword">const</span> XMLCh * sexp);
00668 
00678     <a class="code" href="classDSIGKeyInfoMgmtData.html">DSIGKeyInfoMgmtData</a> * appendMgmtData(<span class="keyword">const</span> XMLCh * data);
00679 
00681 
00684 
00695     <a class="code" href="classDSIGObject.html">DSIGObject</a> * appendObject(<span class="keywordtype">void</span>);
00696 
00703     <span class="keywordtype">int</span> getObjectLength(<span class="keywordtype">void</span>);
00704 
00712     <a class="code" href="classDSIGObject.html">DSIGObject</a> * getObjectItem(<span class="keywordtype">int</span> i);
00713 
00715 
00719 
00744     <span class="keywordtype">void</span> setIdByAttributeName(<span class="keywordtype">bool</span> flag);
00745 
00755     <span class="keywordtype">bool</span> getIdByAttributeName(<span class="keywordtype">void</span>);
00756 
00769     <span class="keywordtype">void</span> registerIdAttributeName(<span class="keyword">const</span> XMLCh * name);
00770 
00781     <span class="keywordtype">bool</span> deregisterIdAttributeName(<span class="keyword">const</span> XMLCh * name);
00782 
00797     <span class="keywordtype">void</span> registerIdAttributeNameNS(<span class="keyword">const</span> XMLCh * ns, <span class="keyword">const</span> XMLCh * name);
00798 
00810     <span class="keywordtype">bool</span> deregisterIdAttributeNameNS(<span class="keyword">const</span> XMLCh * ns, <span class="keyword">const</span> XMLCh * name);
00811 
00813 
<a name="l00814"></a><a class="code" href="classDSIGSignature.html#n0">00814</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classXSECProvider.html">XSECProvider</a>;
00815 
00816 <span class="keyword">private</span>:
00817 
00818     <span class="comment">// For holding DSIGObject nodes</span>
00819 <span class="preprocessor">#if defined(XSEC_NO_NAMESPACES)</span>
00820 <span class="preprocessor"></span>    <span class="keyword">typedef</span> vector&lt;DSIGObject *&gt;            ObjectVectorType;
00821 <span class="preprocessor">#else</span>
00822 <span class="preprocessor"></span>    <span class="keyword">typedef</span> std::vector&lt;DSIGObject *&gt;       ObjectVectorType;
00823 <span class="preprocessor">#endif</span>
00824 <span class="preprocessor"></span>
00825 
00826     <span class="comment">// Internal functions</span>
00827     <span class="keywordtype">void</span> createKeyInfoElement(<span class="keywordtype">void</span>);
00828     <span class="keywordtype">bool</span> verifySignatureOnlyInternal(<span class="keywordtype">void</span>);
00829 
00830     <a class="code" href="classXSECSafeBufferFormatter.html">XSECSafeBufferFormatter</a>     * mp_formatter;
00831     <span class="keywordtype">bool</span>                        m_loaded;               <span class="comment">// Have we already loaded?</span>
00832     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMDocument                  
00833                                 * mp_doc;
00834     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMNode                      
00835                                 * mp_sigNode;
00836     <a class="code" href="classDSIGSignedInfo.html">DSIGSignedInfo</a>              * mp_signedInfo;
00837     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMNode                      
00838                                 * mp_signatureValueNode;
00839     <a class="code" href="classsafeBuffer.html">safeBuffer</a>                  m_signatureValueSB;
00840     <a class="code" href="classDSIGKeyInfoList.html">DSIGKeyInfoList</a>             m_keyInfoList;
00841     <a class="code" href="XSECDefs_8hpp.html#a0">XERCES_CPP_NAMESPACE_QUALIFIER</a> DOMNode                      
00842                                 * mp_KeyInfoNode;
00843     <a class="code" href="classsafeBuffer.html">safeBuffer</a>                  m_errStr;
00844 
00845     <span class="comment">// Environment</span>
00846     <a class="code" href="classXSECEnv.html">XSECEnv</a>                     * mp_env;
00847     
00848     <span class="comment">// The signing/verifying key</span>
00849     <a class="code" href="classXSECCryptoKey.html">XSECCryptoKey</a>               * mp_signingKey;
00850 
00851     <span class="comment">// Resolvers</span>
00852     <a class="code" href="classXSECKeyInfoResolver.html">XSECKeyInfoResolver</a>         * mp_KeyInfoResolver;
00853 
00854     <span class="comment">// Objects</span>
00855 
00856     ObjectVectorType            m_objects;
00857 
00858     <span class="comment">// Not implemented constructors</span>
00859 
00860     <a class="code" href="classDSIGSignature.html">DSIGSignature</a>();
00861 
00862     <span class="comment">/*\@}*/</span>
00863 };
00864 
00865 <span class="preprocessor">#endif </span><span class="comment">/* DSIGSIGNATURE_INCLUDE */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Jul 3 17:37:25 2005 for XML-Security-C by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>