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 * Implementation classes for XML Encryption schema
24 #include "AbstractAttributeExtensibleXMLObject.h"
25 #include "AbstractChildlessElement.h"
26 #include "AbstractElementProxy.h"
27 #include "exceptions.h"
28 #include "encryption/Encryption.h"
29 #include "io/AbstractXMLObjectMarshaller.h"
30 #include "io/AbstractXMLObjectUnmarshaller.h"
31 #include "util/XMLHelper.h"
32 #include "validation/AbstractValidatingXMLObject.h"
34 #include <xercesc/util/XMLUniDefs.hpp>
36 using namespace xmlencryption;
37 using namespace xmltooling;
40 #if defined (_MSC_VER)
41 #pragma warning( push )
42 #pragma warning( disable : 4250 4251 )
45 namespace xmlencryption {
47 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CarriedKeyName);
48 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CipherValue);
49 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,KeySize);
50 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,OAEPparams);
52 class XMLTOOL_DLLLOCAL EncryptionMethodImpl : public virtual EncryptionMethod,
53 public AbstractComplexElement,
54 public AbstractDOMCachingXMLObject,
55 public AbstractValidatingXMLObject,
56 public AbstractXMLObjectMarshaller,
57 public AbstractXMLObjectUnmarshaller
63 m_children.push_back(NULL);
64 m_children.push_back(NULL);
65 m_pos_KeySize=m_children.begin();
66 m_pos_OAEPparams=m_pos_KeySize;
70 virtual ~EncryptionMethodImpl() {
71 XMLString::release(&m_Algorithm);
74 EncryptionMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
75 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
79 EncryptionMethodImpl(const EncryptionMethodImpl& src)
80 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
82 setAlgorithm(src.getAlgorithm());
84 setKeySize(src.getKeySize()->cloneKeySize());
85 if (src.getOAEPparams())
86 setOAEPparams(src.getOAEPparams()->cloneOAEPparams());
87 VectorOf(XMLObject) v=getOtherParameters();
88 for (vector<XMLObject*>::const_iterator i=src.m_OtherParameters.begin(); i!=src.m_OtherParameters.end(); i++) {
90 v.push_back((*i)->clone());
95 IMPL_XMLOBJECT_CLONE(EncryptionMethod);
96 IMPL_STRING_ATTRIB(Algorithm);
97 IMPL_TYPED_CHILD(KeySize);
98 IMPL_TYPED_CHILD(OAEPparams);
99 IMPL_XMLOBJECT_CHILDREN(OtherParameter,m_children.end());
102 void marshallAttributes(DOMElement* domElement) const {
103 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
106 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
107 PROC_TYPED_CHILD(KeySize,XMLConstants::XMLENC_NS,false);
108 PROC_TYPED_CHILD(OAEPparams,XMLConstants::XMLENC_NS,false);
111 const XMLCh* nsURI=root->getNamespaceURI();
112 if (!XMLString::equals(nsURI,XMLConstants::XMLENC_NS) && nsURI && *nsURI)
113 getOtherParameters().push_back(childXMLObject);
115 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
118 void processAttribute(const DOMAttr* attribute) {
119 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
120 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
124 class XMLTOOL_DLLLOCAL TransformsImpl : public virtual Transforms,
125 public AbstractComplexElement,
126 public AbstractDOMCachingXMLObject,
127 public AbstractValidatingXMLObject,
128 public AbstractXMLObjectMarshaller,
129 public AbstractXMLObjectUnmarshaller
132 virtual ~TransformsImpl() {}
134 TransformsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
135 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
138 TransformsImpl(const TransformsImpl& src)
139 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
140 VectorOf(xmlsignature::Transform) v=getTransforms();
141 for (vector<xmlsignature::Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
143 v.push_back((*i)->cloneTransform());
148 IMPL_XMLOBJECT_CLONE(Transforms);
149 IMPL_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,m_children.end());
152 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
153 PROC_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,XMLConstants::XMLSIG_NS,false);
154 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
158 class XMLTOOL_DLLLOCAL CipherReferenceImpl : public virtual CipherReference,
159 public AbstractComplexElement,
160 public AbstractDOMCachingXMLObject,
161 public AbstractValidatingXMLObject,
162 public AbstractXMLObjectMarshaller,
163 public AbstractXMLObjectUnmarshaller
168 m_children.push_back(NULL);
169 m_pos_Transforms=m_children.begin();
172 virtual ~CipherReferenceImpl() {
173 XMLString::release(&m_URI);
176 CipherReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
177 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
181 CipherReferenceImpl(const CipherReferenceImpl& src)
182 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
184 setURI(src.getURI());
185 if (src.getTransforms())
186 setTransforms(src.getTransforms()->cloneTransforms());
189 IMPL_XMLOBJECT_CLONE(CipherReference);
190 IMPL_STRING_ATTRIB(URI);
191 IMPL_TYPED_CHILD(Transforms);
194 void marshallAttributes(DOMElement* domElement) const {
195 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
198 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
199 PROC_TYPED_CHILD(Transforms,XMLConstants::XMLENC_NS,false);
200 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
203 void processAttribute(const DOMAttr* attribute) {
204 PROC_STRING_ATTRIB(URI,URI,NULL);
205 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
209 class XMLTOOL_DLLLOCAL CipherDataImpl : public virtual CipherData,
210 public AbstractComplexElement,
211 public AbstractDOMCachingXMLObject,
212 public AbstractValidatingXMLObject,
213 public AbstractXMLObjectMarshaller,
214 public AbstractXMLObjectUnmarshaller
218 m_CipherReference=NULL;
219 m_children.push_back(NULL);
220 m_children.push_back(NULL);
221 m_pos_CipherValue=m_children.begin();
222 m_pos_CipherReference=m_pos_CipherValue;
223 ++m_pos_CipherReference;
226 virtual ~CipherDataImpl() {}
228 CipherDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
229 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
233 CipherDataImpl(const CipherDataImpl& src)
234 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
236 if (src.getCipherValue())
237 setCipherValue(src.getCipherValue()->cloneCipherValue());
238 if (src.getCipherReference())
239 setCipherReference(src.getCipherReference()->cloneCipherReference());
242 IMPL_XMLOBJECT_CLONE(CipherData);
243 IMPL_TYPED_CHILD(CipherValue);
244 IMPL_TYPED_CHILD(CipherReference);
247 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
248 PROC_TYPED_CHILD(CipherValue,XMLConstants::XMLENC_NS,false);
249 PROC_TYPED_CHILD(CipherReference,XMLConstants::XMLENC_NS,false);
250 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
254 class XMLTOOL_DLLLOCAL EncryptionPropertyImpl : public virtual EncryptionProperty,
255 public AbstractElementProxy,
256 public AbstractAttributeExtensibleXMLObject,
257 public AbstractDOMCachingXMLObject,
258 public AbstractValidatingXMLObject,
259 public AbstractXMLObjectMarshaller,
260 public AbstractXMLObjectUnmarshaller
266 virtual ~EncryptionPropertyImpl() {
267 XMLString::release(&m_Id);
268 XMLString::release(&m_Target);
271 EncryptionPropertyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
272 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
276 EncryptionPropertyImpl(const EncryptionPropertyImpl& src)
277 : AbstractXMLObject(src),
278 AbstractElementProxy(src),
279 AbstractAttributeExtensibleXMLObject(src),
280 AbstractDOMCachingXMLObject(src),
281 AbstractValidatingXMLObject(src) {
284 setTarget(src.getTarget());
285 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
287 getXMLObjects().push_back((*i)->clone());
292 IMPL_XMLOBJECT_CLONE(EncryptionProperty);
293 IMPL_STRING_ATTRIB(Id);
294 IMPL_STRING_ATTRIB(Target);
296 void setAttribute(QName& qualifiedName, const XMLCh* value) {
297 if (!qualifiedName.hasNamespaceURI()) {
298 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME))
300 else if (XMLString::equals(qualifiedName.getLocalPart(),TARGET_ATTRIB_NAME))
303 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
307 void marshallAttributes(DOMElement* domElement) const {
308 MARSHALL_ID_ATTRIB(Id,ID,NULL);
309 MARSHALL_STRING_ATTRIB(Target,TARGET,NULL);
311 // Take care of wildcard.
312 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
313 DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
314 if (i->first.hasPrefix())
315 attr->setPrefix(i->first.getPrefix());
316 attr->setNodeValue(i->second);
317 domElement->setAttributeNode(attr);
321 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
322 getXMLObjects().push_back(childXMLObject);
325 void processAttribute(const DOMAttr* attribute) {
326 PROC_ID_ATTRIB(Id,ID,NULL);
327 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
328 setAttribute(q,attribute->getNodeValue());
332 class XMLTOOL_DLLLOCAL EncryptionPropertiesImpl : public virtual EncryptionProperties,
333 public AbstractComplexElement,
334 public AbstractDOMCachingXMLObject,
335 public AbstractValidatingXMLObject,
336 public AbstractXMLObjectMarshaller,
337 public AbstractXMLObjectUnmarshaller
343 virtual ~EncryptionPropertiesImpl() {
344 XMLString::release(&m_Id);
347 EncryptionPropertiesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
348 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
352 EncryptionPropertiesImpl(const EncryptionPropertiesImpl& src)
353 : AbstractXMLObject(src),
354 AbstractDOMCachingXMLObject(src),
355 AbstractValidatingXMLObject(src) {
358 VectorOf(EncryptionProperty) v=getEncryptionPropertys();
359 for (vector<EncryptionProperty*>::const_iterator i=src.m_EncryptionPropertys.begin(); i!=src.m_EncryptionPropertys.end(); i++) {
361 v.push_back((*i)->cloneEncryptionProperty());
366 IMPL_XMLOBJECT_CLONE(EncryptionProperties);
367 IMPL_STRING_ATTRIB(Id);
368 IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end());
371 void marshallAttributes(DOMElement* domElement) const {
372 MARSHALL_ID_ATTRIB(Id,ID,NULL);
375 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
376 PROC_TYPED_CHILDREN(EncryptionProperty,XMLConstants::XMLENC_NS,false);
377 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
380 void processAttribute(const DOMAttr* attribute) {
381 PROC_ID_ATTRIB(Id,ID,NULL);
382 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
386 class XMLTOOL_DLLLOCAL ReferenceTypeImpl : public virtual ReferenceType,
387 public AbstractElementProxy,
388 public AbstractDOMCachingXMLObject,
389 public AbstractValidatingXMLObject,
390 public AbstractXMLObjectMarshaller,
391 public AbstractXMLObjectUnmarshaller
398 ReferenceTypeImpl() {
403 virtual ~ReferenceTypeImpl() {
404 XMLString::release(&m_URI);
407 ReferenceTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
408 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
412 ReferenceTypeImpl(const ReferenceTypeImpl& src)
413 : AbstractXMLObject(src),
414 AbstractElementProxy(src),
415 AbstractDOMCachingXMLObject(src),
416 AbstractValidatingXMLObject(src) {
418 setURI(src.getURI());
419 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
421 getXMLObjects().push_back((*i)->clone());
426 IMPL_XMLOBJECT_CLONE(ReferenceType);
427 IMPL_STRING_ATTRIB(URI);
430 void marshallAttributes(DOMElement* domElement) const {
431 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
434 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
435 getXMLObjects().push_back(childXMLObject);
438 void processAttribute(const DOMAttr* attribute) {
439 PROC_STRING_ATTRIB(URI,URI,NULL);
440 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
444 class XMLTOOL_DLLLOCAL DataReferenceImpl : public virtual DataReference, public ReferenceTypeImpl
447 virtual ~DataReferenceImpl() {}
449 DataReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
450 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
452 DataReferenceImpl(const DataReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
454 IMPL_XMLOBJECT_CLONE(DataReference);
455 ReferenceType* cloneReferenceType() const {
456 return new DataReferenceImpl(*this);
460 class XMLTOOL_DLLLOCAL KeyReferenceImpl : public virtual KeyReference, public ReferenceTypeImpl
463 virtual ~KeyReferenceImpl() {}
465 KeyReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
466 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
468 KeyReferenceImpl(const KeyReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
470 IMPL_XMLOBJECT_CLONE(KeyReference);
471 ReferenceType* cloneReferenceType() const {
472 return new KeyReferenceImpl(*this);
476 class XMLTOOL_DLLLOCAL ReferenceListImpl : public virtual ReferenceList,
477 public AbstractComplexElement,
478 public AbstractDOMCachingXMLObject,
479 public AbstractValidatingXMLObject,
480 public AbstractXMLObjectMarshaller,
481 public AbstractXMLObjectUnmarshaller
484 virtual ~ReferenceListImpl() {}
486 ReferenceListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
487 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
490 ReferenceListImpl(const ReferenceListImpl& src)
491 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
492 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
494 DataReference* data=dynamic_cast<DataReference*>(*i);
496 getDataReferences().push_back(data->cloneDataReference());
500 KeyReference* key=dynamic_cast<KeyReference*>(*i);
502 getKeyReferences().push_back(key->cloneKeyReference());
509 IMPL_XMLOBJECT_CLONE(ReferenceList);
510 IMPL_TYPED_CHILDREN(DataReference,m_children.end());
511 IMPL_TYPED_CHILDREN(KeyReference,m_children.end());
514 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
515 PROC_TYPED_CHILDREN(DataReference,XMLConstants::XMLENC_NS,false);
516 PROC_TYPED_CHILDREN(KeyReference,XMLConstants::XMLENC_NS,false);
517 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
521 class XMLTOOL_DLLLOCAL EncryptedTypeImpl : public virtual EncryptedType,
522 public AbstractComplexElement,
523 public AbstractDOMCachingXMLObject,
524 public AbstractValidatingXMLObject,
525 public AbstractXMLObjectMarshaller,
526 public AbstractXMLObjectUnmarshaller
529 m_Id=m_Type=m_MimeType=m_Encoding=NULL;
530 m_EncryptionMethod=NULL;
533 m_EncryptionProperties=NULL;
534 m_children.push_back(NULL);
535 m_children.push_back(NULL);
536 m_children.push_back(NULL);
537 m_children.push_back(NULL);
538 m_pos_EncryptionMethod=m_children.begin();
539 m_pos_KeyInfo=m_pos_EncryptionMethod;
541 m_pos_CipherData=m_pos_KeyInfo;
543 m_pos_EncryptionProperties=m_pos_CipherData;
544 ++m_pos_EncryptionProperties;
547 EncryptedTypeImpl() {
552 virtual ~EncryptedTypeImpl() {
553 XMLString::release(&m_Id);
554 XMLString::release(&m_Type);
555 XMLString::release(&m_MimeType);
556 XMLString::release(&m_Encoding);
559 EncryptedTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
560 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
564 EncryptedTypeImpl(const EncryptedTypeImpl& src)
565 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
568 setType(src.getType());
569 setMimeType(src.getMimeType());
570 setEncoding(src.getEncoding());
571 if (src.getEncryptionMethod())
572 setEncryptionMethod(src.getEncryptionMethod()->cloneEncryptionMethod());
573 if (src.getKeyInfo())
574 setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
575 if (src.getCipherData())
576 setCipherData(src.getCipherData()->cloneCipherData());
577 if (src.getEncryptionProperties())
578 setEncryptionProperties(src.getEncryptionProperties()->cloneEncryptionProperties());
581 IMPL_XMLOBJECT_CLONE(EncryptedType);
582 IMPL_STRING_ATTRIB(Id);
583 IMPL_STRING_ATTRIB(Type);
584 IMPL_STRING_ATTRIB(MimeType);
585 IMPL_STRING_ATTRIB(Encoding);
586 IMPL_TYPED_CHILD(EncryptionMethod);
587 IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
588 IMPL_TYPED_CHILD(CipherData);
589 IMPL_TYPED_CHILD(EncryptionProperties);
592 void marshallAttributes(DOMElement* domElement) const {
593 MARSHALL_ID_ATTRIB(Id,ID,NULL);
594 MARSHALL_STRING_ATTRIB(Type,TYPE,NULL);
595 MARSHALL_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
596 MARSHALL_STRING_ATTRIB(Encoding,ENCODING,NULL);
599 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
600 PROC_TYPED_CHILD(EncryptionMethod,XMLConstants::XMLENC_NS,false);
601 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLConstants::XMLSIG_NS,false);
602 PROC_TYPED_CHILD(CipherData,XMLConstants::XMLENC_NS,false);
603 PROC_TYPED_CHILD(EncryptionProperties,XMLConstants::XMLENC_NS,false);
604 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
607 void processAttribute(const DOMAttr* attribute) {
608 PROC_ID_ATTRIB(Id,ID,NULL);
609 PROC_STRING_ATTRIB(Type,TYPE,NULL);
610 PROC_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
611 PROC_STRING_ATTRIB(Encoding,ENCODING,NULL);
612 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
616 class XMLTOOL_DLLLOCAL EncryptedDataImpl : public virtual EncryptedData, public EncryptedTypeImpl
619 virtual ~EncryptedDataImpl() {}
621 EncryptedDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
622 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
624 EncryptedDataImpl(const EncryptedDataImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {}
626 IMPL_XMLOBJECT_CLONE(EncryptedData);
627 EncryptedType* cloneEncryptedType() const {
628 return new EncryptedDataImpl(*this);
632 class XMLTOOL_DLLLOCAL EncryptedKeyImpl : public virtual EncryptedKey, public EncryptedTypeImpl
636 m_ReferenceList=NULL;
637 m_CarriedKeyName=NULL;
638 m_children.push_back(NULL);
639 m_children.push_back(NULL);
640 m_pos_ReferenceList=m_pos_EncryptionProperties;
641 ++m_pos_ReferenceList;
642 m_pos_CarriedKeyName=m_pos_ReferenceList;
643 ++m_pos_CarriedKeyName;
647 virtual ~EncryptedKeyImpl() {
648 XMLString::release(&m_Recipient);
651 EncryptedKeyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
652 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
656 EncryptedKeyImpl(const EncryptedKeyImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {
660 IMPL_XMLOBJECT_CLONE(EncryptedKey);
661 EncryptedType* cloneEncryptedType() const {
662 return new EncryptedKeyImpl(*this);
664 IMPL_STRING_ATTRIB(Recipient);
665 IMPL_TYPED_CHILD(ReferenceList);
666 IMPL_TYPED_CHILD(CarriedKeyName);
669 void marshallAttributes(DOMElement* domElement) const {
670 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
671 EncryptedTypeImpl::marshallAttributes(domElement);
674 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
675 PROC_TYPED_CHILD(ReferenceList,XMLConstants::XMLENC_NS,false);
676 PROC_TYPED_CHILD(CarriedKeyName,XMLConstants::XMLENC_NS,false);
677 EncryptedTypeImpl::processChildElement(childXMLObject,root);
680 void processAttribute(const DOMAttr* attribute) {
681 PROC_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
682 EncryptedTypeImpl::processAttribute(attribute);
688 #if defined (_MSC_VER)
689 #pragma warning( pop )
692 // Builder Implementations
694 IMPL_XMLOBJECTBUILDER(CarriedKeyName);
695 IMPL_XMLOBJECTBUILDER(CipherData);
696 IMPL_XMLOBJECTBUILDER(CipherReference);
697 IMPL_XMLOBJECTBUILDER(CipherValue);
698 IMPL_XMLOBJECTBUILDER(DataReference);
699 IMPL_XMLOBJECTBUILDER(EncryptedData);
700 IMPL_XMLOBJECTBUILDER(EncryptedKey);
701 IMPL_XMLOBJECTBUILDER(EncryptionMethod);
702 IMPL_XMLOBJECTBUILDER(EncryptionProperties);
703 IMPL_XMLOBJECTBUILDER(EncryptionProperty);
704 IMPL_XMLOBJECTBUILDER(KeyReference);
705 IMPL_XMLOBJECTBUILDER(KeySize);
706 IMPL_XMLOBJECTBUILDER(OAEPparams);
707 IMPL_XMLOBJECTBUILDER(ReferenceList);
708 IMPL_XMLOBJECTBUILDER(Transforms);
712 const XMLCh CarriedKeyName::LOCAL_NAME[] = UNICODE_LITERAL_14(C,a,r,r,i,e,d,K,e,y,N,a,m,e);
713 const XMLCh CipherData::LOCAL_NAME[] = UNICODE_LITERAL_10(C,i,p,h,e,r,D,a,t,a);
714 const XMLCh CipherData::TYPE_NAME[] = UNICODE_LITERAL_14(C,i,p,h,e,r,D,a,t,a,T,y,p,e);
715 const XMLCh CipherReference::LOCAL_NAME[] = UNICODE_LITERAL_15(C,i,p,h,e,r,R,e,f,e,r,e,n,c,e);
716 const XMLCh CipherReference::TYPE_NAME[] = UNICODE_LITERAL_19(C,i,p,h,e,r,R,e,f,e,r,e,n,c,e,T,y,p,e);
717 const XMLCh CipherReference::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
718 const XMLCh CipherValue::LOCAL_NAME[] = UNICODE_LITERAL_11(C,i,p,h,e,r,V,a,l,u,e);
719 const XMLCh DataReference::LOCAL_NAME[] = UNICODE_LITERAL_13(D,a,t,a,R,e,f,e,r,e,n,c,e);
720 const XMLCh EncryptedData::LOCAL_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,D,a,t,a);
721 const XMLCh EncryptedData::TYPE_NAME[] = UNICODE_LITERAL_17(E,n,c,r,y,p,t,e,d,D,a,t,a,T,y,p,e);
722 const XMLCh EncryptedKey::LOCAL_NAME[] = UNICODE_LITERAL_12(E,n,c,r,y,p,t,e,d,K,e,y);
723 const XMLCh EncryptedKey::TYPE_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,e,d,K,e,y,T,y,p,e);
724 const XMLCh EncryptedKey::RECIPIENT_ATTRIB_NAME[] = UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
725 const XMLCh EncryptedType::LOCAL_NAME[] = {chNull};
726 const XMLCh EncryptedType::TYPE_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,T,y,p,e);
727 const XMLCh EncryptedType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
728 const XMLCh EncryptedType::TYPE_ATTRIB_NAME[] = UNICODE_LITERAL_4(T,y,p,e);
729 const XMLCh EncryptedType::MIMETYPE_ATTRIB_NAME[] = UNICODE_LITERAL_8(M,i,m,e,T,y,p,e);
730 const XMLCh EncryptedType::ENCODING_ATTRIB_NAME[] = UNICODE_LITERAL_8(E,n,c,o,d,i,n,g);
731 const XMLCh EncryptionMethod::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,i,o,n,M,e,t,h,o,d);
732 const XMLCh EncryptionMethod::TYPE_NAME[] = UNICODE_LITERAL_20(E,n,c,r,y,p,t,i,o,n,M,e,t,h,o,d,T,y,p,e);
733 const XMLCh EncryptionMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
734 const XMLCh EncryptionProperties::LOCAL_NAME[] = UNICODE_LITERAL_20(E,n,c,r,y,p,t,i,o,n,P,r,o,p,e,r,t,i,e,s);
735 const XMLCh EncryptionProperties::TYPE_NAME[] = UNICODE_LITERAL_24(E,n,c,r,y,p,t,i,o,n,P,r,o,p,e,r,t,i,e,s,T,y,p,e);
736 const XMLCh EncryptionProperties::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
737 const XMLCh EncryptionProperty::LOCAL_NAME[] = UNICODE_LITERAL_18(E,n,c,r,y,p,t,i,o,n,P,r,o,p,e,r,t,y);
738 const XMLCh EncryptionProperty::TYPE_NAME[] = UNICODE_LITERAL_22(E,n,c,r,y,p,t,i,o,n,P,r,o,p,e,r,t,y,T,y,p,e);
739 const XMLCh EncryptionProperty::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
740 const XMLCh EncryptionProperty::TARGET_ATTRIB_NAME[] = UNICODE_LITERAL_6(T,a,r,g,e,t);
741 const XMLCh KeyReference::LOCAL_NAME[] = UNICODE_LITERAL_12(K,e,y,R,e,f,e,r,e,n,c,e);
742 const XMLCh KeySize::LOCAL_NAME[] = UNICODE_LITERAL_7(K,e,y,S,i,z,e);
743 const XMLCh OAEPparams::LOCAL_NAME[] = UNICODE_LITERAL_10(O,A,E,P,p,a,r,a,m,s);
744 const XMLCh ReferenceList::LOCAL_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,L,i,s,t);
745 const XMLCh ReferenceType::LOCAL_NAME[] = {chNull};
746 const XMLCh ReferenceType::TYPE_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,T,y,p,e);
747 const XMLCh ReferenceType::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
748 const XMLCh Transforms::LOCAL_NAME[] = UNICODE_LITERAL_10(T,r,a,n,s,f,o,r,m,s);
749 const XMLCh Transforms::TYPE_NAME[] = UNICODE_LITERAL_14(T,r,a,n,s,f,o,r,m,s,T,y,p,e);