Lines 68-75
Link Here
|
68 |
throws XMLSecurityException { |
68 |
throws XMLSecurityException { |
69 |
|
69 |
|
70 |
super(element, BaseURI); |
70 |
super(element, BaseURI); |
71 |
|
|
|
72 |
boolean noElements=true; |
73 |
Node sibling=this._constructionElement.getFirstChild(); |
71 |
Node sibling=this._constructionElement.getFirstChild(); |
74 |
while (sibling!=null) { |
72 |
while (sibling!=null) { |
75 |
if (sibling.getNodeType()!=Node.ELEMENT_NODE) { |
73 |
if (sibling.getNodeType()!=Node.ELEMENT_NODE) { |
Lines 76-127
Link Here
|
76 |
sibling=sibling.getNextSibling(); |
74 |
sibling=sibling.getNextSibling(); |
77 |
continue; |
75 |
continue; |
78 |
} |
76 |
} |
79 |
noElements=false; |
77 |
return; |
80 |
Element currentElem = (Element) sibling; |
|
|
81 |
sibling=sibling.getNextSibling(); |
82 |
String localname = currentElem.getLocalName(); |
83 |
|
84 |
if (currentElem.getNamespaceURI().equals(Constants.SignatureSpecNS)) { |
85 |
if (localname.equals(Constants._TAG_X509ISSUERSERIAL)) { |
86 |
XMLX509IssuerSerial is = new XMLX509IssuerSerial(currentElem, |
87 |
BaseURI); |
88 |
|
89 |
this.add(is); |
90 |
} else if (localname.equals(Constants._TAG_X509SKI)) { |
91 |
XMLX509SKI ski = new XMLX509SKI(currentElem, BaseURI); |
92 |
|
93 |
this.add(ski); |
94 |
} else if (localname.equals(Constants._TAG_X509SUBJECTNAME)) { |
95 |
XMLX509SubjectName sn = new XMLX509SubjectName(currentElem, |
96 |
BaseURI); |
97 |
|
98 |
this.add(sn); |
99 |
} else if (localname.equals(Constants._TAG_X509CERTIFICATE)) { |
100 |
XMLX509Certificate cert = new XMLX509Certificate(currentElem, |
101 |
BaseURI); |
102 |
|
103 |
this.add(cert); |
104 |
} else if (localname.equals(Constants._TAG_X509CRL)) { |
105 |
XMLX509CRL crl = new XMLX509CRL(currentElem, BaseURI); |
106 |
|
107 |
this.add(crl); |
108 |
} else { |
109 |
log.warn("Found a " + currentElem.getTagName() + " element in " |
110 |
+ Constants._TAG_X509DATA); |
111 |
this.addUnknownElement(currentElem); |
112 |
} |
113 |
} else { |
114 |
log.warn("Found a " + currentElem.getTagName() + " element in " |
115 |
+ Constants._TAG_X509DATA); |
116 |
this.addUnknownElement(currentElem); |
117 |
} |
118 |
} |
78 |
} |
119 |
if (noElements) { |
79 |
/* No Elements found */ |
120 |
Object exArgs[] = { "Elements", Constants._TAG_X509DATA }; |
80 |
Object exArgs[] = { "Elements", Constants._TAG_X509DATA }; |
121 |
|
81 |
throw new XMLSecurityException("xml.WrongContent", exArgs); |
122 |
throw new XMLSecurityException("xml.WrongContent", exArgs); |
|
|
123 |
} |
124 |
|
125 |
} |
82 |
} |
126 |
|
83 |
|
127 |
/** |
84 |
/** |
Lines 165-175
Link Here
|
165 |
*/ |
122 |
*/ |
166 |
public void add(XMLX509IssuerSerial xmlX509IssuerSerial) { |
123 |
public void add(XMLX509IssuerSerial xmlX509IssuerSerial) { |
167 |
|
124 |
|
168 |
if (this._state == MODE_SIGN) { |
|
|
169 |
this._constructionElement |
125 |
this._constructionElement |
170 |
.appendChild(xmlX509IssuerSerial.getElement()); |
126 |
.appendChild(xmlX509IssuerSerial.getElement()); |
171 |
XMLUtils.addReturnToElement(this._constructionElement); |
127 |
XMLUtils.addReturnToElement(this._constructionElement); |
172 |
} |
|
|
173 |
} |
128 |
} |
174 |
|
129 |
|
175 |
/** |
130 |
/** |
Lines 198-208
Link Here
|
198 |
* @param xmlX509SKI |
153 |
* @param xmlX509SKI |
199 |
*/ |
154 |
*/ |
200 |
public void add(XMLX509SKI xmlX509SKI) { |
155 |
public void add(XMLX509SKI xmlX509SKI) { |
201 |
|
|
|
202 |
if (this._state == MODE_SIGN) { |
203 |
this._constructionElement.appendChild(xmlX509SKI.getElement()); |
156 |
this._constructionElement.appendChild(xmlX509SKI.getElement()); |
204 |
XMLUtils.addReturnToElement(this._constructionElement); |
157 |
XMLUtils.addReturnToElement(this._constructionElement); |
205 |
} |
|
|
206 |
} |
158 |
} |
207 |
|
159 |
|
208 |
/** |
160 |
/** |
Lines 229-239
Link Here
|
229 |
* @param xmlX509SubjectName |
181 |
* @param xmlX509SubjectName |
230 |
*/ |
182 |
*/ |
231 |
public void add(XMLX509SubjectName xmlX509SubjectName) { |
183 |
public void add(XMLX509SubjectName xmlX509SubjectName) { |
232 |
|
|
|
233 |
if (this._state == MODE_SIGN) { |
234 |
this._constructionElement.appendChild(xmlX509SubjectName.getElement()); |
184 |
this._constructionElement.appendChild(xmlX509SubjectName.getElement()); |
235 |
XMLUtils.addReturnToElement(this._constructionElement); |
185 |
XMLUtils.addReturnToElement(this._constructionElement); |
236 |
} |
|
|
237 |
} |
186 |
} |
238 |
|
187 |
|
239 |
/** |
188 |
/** |
Lines 262-272
Link Here
|
262 |
* @param xmlX509Certificate |
211 |
* @param xmlX509Certificate |
263 |
*/ |
212 |
*/ |
264 |
public void add(XMLX509Certificate xmlX509Certificate) { |
213 |
public void add(XMLX509Certificate xmlX509Certificate) { |
265 |
|
|
|
266 |
if (this._state == MODE_SIGN) { |
267 |
this._constructionElement.appendChild(xmlX509Certificate.getElement()); |
214 |
this._constructionElement.appendChild(xmlX509Certificate.getElement()); |
268 |
XMLUtils.addReturnToElement(this._constructionElement); |
215 |
XMLUtils.addReturnToElement(this._constructionElement); |
269 |
} |
|
|
270 |
} |
216 |
} |
271 |
|
217 |
|
272 |
/** |
218 |
/** |
Lines 284-294
Link Here
|
284 |
* @param xmlX509CRL |
230 |
* @param xmlX509CRL |
285 |
*/ |
231 |
*/ |
286 |
public void add(XMLX509CRL xmlX509CRL) { |
232 |
public void add(XMLX509CRL xmlX509CRL) { |
287 |
|
|
|
288 |
if (this._state == MODE_SIGN) { |
289 |
this._constructionElement.appendChild(xmlX509CRL.getElement()); |
233 |
this._constructionElement.appendChild(xmlX509CRL.getElement()); |
290 |
XMLUtils.addReturnToElement(this._constructionElement); |
234 |
XMLUtils.addReturnToElement(this._constructionElement); |
291 |
} |
|
|
292 |
} |
235 |
} |
293 |
|
236 |
|
294 |
/** |
237 |
/** |
Lines 297-307
Link Here
|
297 |
* @param element |
240 |
* @param element |
298 |
*/ |
241 |
*/ |
299 |
public void addUnknownElement(Element element) { |
242 |
public void addUnknownElement(Element element) { |
300 |
|
|
|
301 |
if (this._state == MODE_SIGN) { |
302 |
this._constructionElement.appendChild(element); |
243 |
this._constructionElement.appendChild(element); |
303 |
XMLUtils.addReturnToElement(this._constructionElement); |
244 |
XMLUtils.addReturnToElement(this._constructionElement); |
304 |
} |
|
|
305 |
} |
245 |
} |
306 |
|
246 |
|
307 |
/** |
247 |
/** |