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);
117 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
120 void processAttribute(const DOMAttr* attribute) {
121 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
122 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
126 class XMLTOOL_DLLLOCAL TransformsImpl : public virtual Transforms,
127 public AbstractComplexElement,
128 public AbstractDOMCachingXMLObject,
129 public AbstractValidatingXMLObject,
130 public AbstractXMLObjectMarshaller,
131 public AbstractXMLObjectUnmarshaller
134 virtual ~TransformsImpl() {}
136 TransformsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
137 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
140 TransformsImpl(const TransformsImpl& src)
141 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
142 VectorOf(xmlsignature::Transform) v=getTransforms();
143 for (vector<xmlsignature::Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
145 v.push_back((*i)->cloneTransform());
150 IMPL_XMLOBJECT_CLONE(Transforms);
151 IMPL_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,m_children.end());
154 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
155 PROC_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,XMLConstants::XMLSIG_NS,false);
156 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
160 class XMLTOOL_DLLLOCAL CipherReferenceImpl : public virtual CipherReference,
161 public AbstractComplexElement,
162 public AbstractDOMCachingXMLObject,
163 public AbstractValidatingXMLObject,
164 public AbstractXMLObjectMarshaller,
165 public AbstractXMLObjectUnmarshaller
170 m_children.push_back(NULL);
171 m_pos_Transforms=m_children.begin();
174 virtual ~CipherReferenceImpl() {
175 XMLString::release(&m_URI);
178 CipherReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
179 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
183 CipherReferenceImpl(const CipherReferenceImpl& src)
184 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
186 setURI(src.getURI());
187 if (src.getTransforms())
188 setTransforms(src.getTransforms()->cloneTransforms());
191 IMPL_XMLOBJECT_CLONE(CipherReference);
192 IMPL_STRING_ATTRIB(URI);
193 IMPL_TYPED_CHILD(Transforms);
196 void marshallAttributes(DOMElement* domElement) const {
197 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
200 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
201 PROC_TYPED_CHILD(Transforms,XMLConstants::XMLENC_NS,false);
202 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
205 void processAttribute(const DOMAttr* attribute) {
206 PROC_STRING_ATTRIB(URI,URI,NULL);
207 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
211 class XMLTOOL_DLLLOCAL CipherDataImpl : public virtual CipherData,
212 public AbstractComplexElement,
213 public AbstractDOMCachingXMLObject,
214 public AbstractValidatingXMLObject,
215 public AbstractXMLObjectMarshaller,
216 public AbstractXMLObjectUnmarshaller
220 m_CipherReference=NULL;
221 m_children.push_back(NULL);
222 m_children.push_back(NULL);
223 m_pos_CipherValue=m_children.begin();
224 m_pos_CipherReference=m_pos_CipherValue;
225 ++m_pos_CipherReference;
228 virtual ~CipherDataImpl() {}
230 CipherDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
231 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
235 CipherDataImpl(const CipherDataImpl& src)
236 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
238 if (src.getCipherValue())
239 setCipherValue(src.getCipherValue()->cloneCipherValue());
240 if (src.getCipherReference())
241 setCipherReference(src.getCipherReference()->cloneCipherReference());
244 IMPL_XMLOBJECT_CLONE(CipherData);
245 IMPL_TYPED_CHILD(CipherValue);
246 IMPL_TYPED_CHILD(CipherReference);
249 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
250 PROC_TYPED_CHILD(CipherValue,XMLConstants::XMLENC_NS,false);
251 PROC_TYPED_CHILD(CipherReference,XMLConstants::XMLENC_NS,false);
252 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
256 class XMLTOOL_DLLLOCAL EncryptionPropertyImpl : public virtual EncryptionProperty,
257 public AbstractElementProxy,
258 public AbstractAttributeExtensibleXMLObject,
259 public AbstractDOMCachingXMLObject,
260 public AbstractValidatingXMLObject,
261 public AbstractXMLObjectMarshaller,
262 public AbstractXMLObjectUnmarshaller
268 virtual ~EncryptionPropertyImpl() {
269 XMLString::release(&m_Id);
270 XMLString::release(&m_Target);
273 EncryptionPropertyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
274 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
278 EncryptionPropertyImpl(const EncryptionPropertyImpl& src)
279 : AbstractXMLObject(src),
280 AbstractElementProxy(src),
281 AbstractAttributeExtensibleXMLObject(src),
282 AbstractDOMCachingXMLObject(src),
283 AbstractValidatingXMLObject(src) {
286 setTarget(src.getTarget());
287 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
289 getXMLObjects().push_back((*i)->clone());
294 IMPL_XMLOBJECT_CLONE(EncryptionProperty);
295 IMPL_STRING_ATTRIB(Id);
296 IMPL_STRING_ATTRIB(Target);
298 void setAttribute(QName& qualifiedName, const XMLCh* value) {
299 if (!qualifiedName.hasNamespaceURI()) {
300 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
304 else if (XMLString::equals(qualifiedName.getLocalPart(),TARGET_ATTRIB_NAME)) {
309 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
313 void marshallAttributes(DOMElement* domElement) const {
314 MARSHALL_ID_ATTRIB(Id,ID,NULL);
315 MARSHALL_STRING_ATTRIB(Target,TARGET,NULL);
317 // Take care of wildcard.
318 for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
319 DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
320 if (i->first.hasPrefix())
321 attr->setPrefix(i->first.getPrefix());
322 attr->setNodeValue(i->second);
323 domElement->setAttributeNode(attr);
327 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
328 getXMLObjects().push_back(childXMLObject);
331 void processAttribute(const DOMAttr* attribute) {
332 PROC_ID_ATTRIB(Id,ID,NULL);
333 QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
334 setAttribute(q,attribute->getNodeValue());
338 class XMLTOOL_DLLLOCAL EncryptionPropertiesImpl : public virtual EncryptionProperties,
339 public AbstractComplexElement,
340 public AbstractDOMCachingXMLObject,
341 public AbstractValidatingXMLObject,
342 public AbstractXMLObjectMarshaller,
343 public AbstractXMLObjectUnmarshaller
349 virtual ~EncryptionPropertiesImpl() {
350 XMLString::release(&m_Id);
353 EncryptionPropertiesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
354 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
358 EncryptionPropertiesImpl(const EncryptionPropertiesImpl& src)
359 : AbstractXMLObject(src),
360 AbstractDOMCachingXMLObject(src),
361 AbstractValidatingXMLObject(src) {
364 VectorOf(EncryptionProperty) v=getEncryptionPropertys();
365 for (vector<EncryptionProperty*>::const_iterator i=src.m_EncryptionPropertys.begin(); i!=src.m_EncryptionPropertys.end(); i++) {
367 v.push_back((*i)->cloneEncryptionProperty());
372 IMPL_XMLOBJECT_CLONE(EncryptionProperties);
373 IMPL_STRING_ATTRIB(Id);
374 IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end());
377 void marshallAttributes(DOMElement* domElement) const {
378 MARSHALL_ID_ATTRIB(Id,ID,NULL);
381 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
382 PROC_TYPED_CHILDREN(EncryptionProperty,XMLConstants::XMLENC_NS,false);
383 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
386 void processAttribute(const DOMAttr* attribute) {
387 PROC_ID_ATTRIB(Id,ID,NULL);
388 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
392 class XMLTOOL_DLLLOCAL ReferenceTypeImpl : public virtual ReferenceType,
393 public AbstractElementProxy,
394 public AbstractDOMCachingXMLObject,
395 public AbstractValidatingXMLObject,
396 public AbstractXMLObjectMarshaller,
397 public AbstractXMLObjectUnmarshaller
404 ReferenceTypeImpl() {
409 virtual ~ReferenceTypeImpl() {
410 XMLString::release(&m_URI);
413 ReferenceTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
414 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
418 ReferenceTypeImpl(const ReferenceTypeImpl& src)
419 : AbstractXMLObject(src),
420 AbstractElementProxy(src),
421 AbstractDOMCachingXMLObject(src),
422 AbstractValidatingXMLObject(src) {
424 setURI(src.getURI());
425 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
427 getXMLObjects().push_back((*i)->clone());
432 IMPL_XMLOBJECT_CLONE(ReferenceType);
433 IMPL_STRING_ATTRIB(URI);
436 void marshallAttributes(DOMElement* domElement) const {
437 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
440 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
441 getXMLObjects().push_back(childXMLObject);
444 void processAttribute(const DOMAttr* attribute) {
445 PROC_STRING_ATTRIB(URI,URI,NULL);
446 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
450 class XMLTOOL_DLLLOCAL DataReferenceImpl : public virtual DataReference, public ReferenceTypeImpl
453 virtual ~DataReferenceImpl() {}
455 DataReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
456 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
458 DataReferenceImpl(const DataReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
460 IMPL_XMLOBJECT_CLONE(DataReference);
461 ReferenceType* cloneReferenceType() const {
462 return new DataReferenceImpl(*this);
466 class XMLTOOL_DLLLOCAL KeyReferenceImpl : public virtual KeyReference, public ReferenceTypeImpl
469 virtual ~KeyReferenceImpl() {}
471 KeyReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
472 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
474 KeyReferenceImpl(const KeyReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
476 IMPL_XMLOBJECT_CLONE(KeyReference);
477 ReferenceType* cloneReferenceType() const {
478 return new KeyReferenceImpl(*this);
482 class XMLTOOL_DLLLOCAL ReferenceListImpl : public virtual ReferenceList,
483 public AbstractComplexElement,
484 public AbstractDOMCachingXMLObject,
485 public AbstractValidatingXMLObject,
486 public AbstractXMLObjectMarshaller,
487 public AbstractXMLObjectUnmarshaller
490 virtual ~ReferenceListImpl() {}
492 ReferenceListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
493 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
496 ReferenceListImpl(const ReferenceListImpl& src)
497 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
498 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
500 DataReference* data=dynamic_cast<DataReference*>(*i);
502 getDataReferences().push_back(data->cloneDataReference());
506 KeyReference* key=dynamic_cast<KeyReference*>(*i);
508 getKeyReferences().push_back(key->cloneKeyReference());
515 IMPL_XMLOBJECT_CLONE(ReferenceList);
516 IMPL_TYPED_CHILDREN(DataReference,m_children.end());
517 IMPL_TYPED_CHILDREN(KeyReference,m_children.end());
520 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
521 PROC_TYPED_CHILDREN(DataReference,XMLConstants::XMLENC_NS,false);
522 PROC_TYPED_CHILDREN(KeyReference,XMLConstants::XMLENC_NS,false);
523 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
527 class XMLTOOL_DLLLOCAL EncryptedTypeImpl : public virtual EncryptedType,
528 public AbstractComplexElement,
529 public AbstractDOMCachingXMLObject,
530 public AbstractValidatingXMLObject,
531 public AbstractXMLObjectMarshaller,
532 public AbstractXMLObjectUnmarshaller
535 m_Id=m_Type=m_MimeType=m_Encoding=NULL;
536 m_EncryptionMethod=NULL;
539 m_EncryptionProperties=NULL;
540 m_children.push_back(NULL);
541 m_children.push_back(NULL);
542 m_children.push_back(NULL);
543 m_children.push_back(NULL);
544 m_pos_EncryptionMethod=m_children.begin();
545 m_pos_KeyInfo=m_pos_EncryptionMethod;
547 m_pos_CipherData=m_pos_KeyInfo;
549 m_pos_EncryptionProperties=m_pos_CipherData;
550 ++m_pos_EncryptionProperties;
553 EncryptedTypeImpl() {
558 virtual ~EncryptedTypeImpl() {
559 XMLString::release(&m_Id);
560 XMLString::release(&m_Type);
561 XMLString::release(&m_MimeType);
562 XMLString::release(&m_Encoding);
565 EncryptedTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
566 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
570 EncryptedTypeImpl(const EncryptedTypeImpl& src)
571 : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
574 setType(src.getType());
575 setMimeType(src.getMimeType());
576 setEncoding(src.getEncoding());
577 if (src.getEncryptionMethod())
578 setEncryptionMethod(src.getEncryptionMethod()->cloneEncryptionMethod());
579 if (src.getKeyInfo())
580 setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
581 if (src.getCipherData())
582 setCipherData(src.getCipherData()->cloneCipherData());
583 if (src.getEncryptionProperties())
584 setEncryptionProperties(src.getEncryptionProperties()->cloneEncryptionProperties());
587 IMPL_XMLOBJECT_CLONE(EncryptedType);
588 IMPL_STRING_ATTRIB(Id);
589 IMPL_STRING_ATTRIB(Type);
590 IMPL_STRING_ATTRIB(MimeType);
591 IMPL_STRING_ATTRIB(Encoding);
592 IMPL_TYPED_CHILD(EncryptionMethod);
593 IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
594 IMPL_TYPED_CHILD(CipherData);
595 IMPL_TYPED_CHILD(EncryptionProperties);
598 void marshallAttributes(DOMElement* domElement) const {
599 MARSHALL_ID_ATTRIB(Id,ID,NULL);
600 MARSHALL_STRING_ATTRIB(Type,TYPE,NULL);
601 MARSHALL_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
602 MARSHALL_STRING_ATTRIB(Encoding,ENCODING,NULL);
605 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
606 PROC_TYPED_CHILD(EncryptionMethod,XMLConstants::XMLENC_NS,false);
607 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLConstants::XMLSIG_NS,false);
608 PROC_TYPED_CHILD(CipherData,XMLConstants::XMLENC_NS,false);
609 PROC_TYPED_CHILD(EncryptionProperties,XMLConstants::XMLENC_NS,false);
610 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
613 void processAttribute(const DOMAttr* attribute) {
614 PROC_ID_ATTRIB(Id,ID,NULL);
615 PROC_STRING_ATTRIB(Type,TYPE,NULL);
616 PROC_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
617 PROC_STRING_ATTRIB(Encoding,ENCODING,NULL);
618 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
622 class XMLTOOL_DLLLOCAL EncryptedDataImpl : public virtual EncryptedData, public EncryptedTypeImpl
625 virtual ~EncryptedDataImpl() {}
627 EncryptedDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
628 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
630 EncryptedDataImpl(const EncryptedDataImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {}
632 IMPL_XMLOBJECT_CLONE(EncryptedData);
633 EncryptedType* cloneEncryptedType() const {
634 return new EncryptedDataImpl(*this);
638 class XMLTOOL_DLLLOCAL EncryptedKeyImpl : public virtual EncryptedKey, public EncryptedTypeImpl
642 m_ReferenceList=NULL;
643 m_CarriedKeyName=NULL;
644 m_children.push_back(NULL);
645 m_children.push_back(NULL);
646 m_pos_ReferenceList=m_pos_EncryptionProperties;
647 ++m_pos_ReferenceList;
648 m_pos_CarriedKeyName=m_pos_ReferenceList;
649 ++m_pos_CarriedKeyName;
653 virtual ~EncryptedKeyImpl() {
654 XMLString::release(&m_Recipient);
657 EncryptedKeyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
658 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
662 EncryptedKeyImpl(const EncryptedKeyImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {
666 IMPL_XMLOBJECT_CLONE(EncryptedKey);
667 EncryptedType* cloneEncryptedType() const {
668 return new EncryptedKeyImpl(*this);
670 IMPL_STRING_ATTRIB(Recipient);
671 IMPL_TYPED_CHILD(ReferenceList);
672 IMPL_TYPED_CHILD(CarriedKeyName);
675 void marshallAttributes(DOMElement* domElement) const {
676 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
677 EncryptedTypeImpl::marshallAttributes(domElement);
680 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
681 PROC_TYPED_CHILD(ReferenceList,XMLConstants::XMLENC_NS,false);
682 PROC_TYPED_CHILD(CarriedKeyName,XMLConstants::XMLENC_NS,false);
683 EncryptedTypeImpl::processChildElement(childXMLObject,root);
686 void processAttribute(const DOMAttr* attribute) {
687 PROC_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
688 EncryptedTypeImpl::processAttribute(attribute);
694 #if defined (_MSC_VER)
695 #pragma warning( pop )
698 // Builder Implementations
700 IMPL_XMLOBJECTBUILDER(CarriedKeyName);
701 IMPL_XMLOBJECTBUILDER(CipherData);
702 IMPL_XMLOBJECTBUILDER(CipherReference);
703 IMPL_XMLOBJECTBUILDER(CipherValue);
704 IMPL_XMLOBJECTBUILDER(DataReference);
705 IMPL_XMLOBJECTBUILDER(EncryptedData);
706 IMPL_XMLOBJECTBUILDER(EncryptedKey);
707 IMPL_XMLOBJECTBUILDER(EncryptionMethod);
708 IMPL_XMLOBJECTBUILDER(EncryptionProperties);
709 IMPL_XMLOBJECTBUILDER(EncryptionProperty);
710 IMPL_XMLOBJECTBUILDER(KeyReference);
711 IMPL_XMLOBJECTBUILDER(KeySize);
712 IMPL_XMLOBJECTBUILDER(OAEPparams);
713 IMPL_XMLOBJECTBUILDER(ReferenceList);
714 IMPL_XMLOBJECTBUILDER(Transforms);
718 const XMLCh CarriedKeyName::LOCAL_NAME[] = UNICODE_LITERAL_14(C,a,r,r,i,e,d,K,e,y,N,a,m,e);
719 const XMLCh CipherData::LOCAL_NAME[] = UNICODE_LITERAL_10(C,i,p,h,e,r,D,a,t,a);
720 const XMLCh CipherData::TYPE_NAME[] = UNICODE_LITERAL_14(C,i,p,h,e,r,D,a,t,a,T,y,p,e);
721 const XMLCh CipherReference::LOCAL_NAME[] = UNICODE_LITERAL_15(C,i,p,h,e,r,R,e,f,e,r,e,n,c,e);
722 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);
723 const XMLCh CipherReference::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
724 const XMLCh CipherValue::LOCAL_NAME[] = UNICODE_LITERAL_11(C,i,p,h,e,r,V,a,l,u,e);
725 const XMLCh DataReference::LOCAL_NAME[] = UNICODE_LITERAL_13(D,a,t,a,R,e,f,e,r,e,n,c,e);
726 const XMLCh EncryptedData::LOCAL_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,D,a,t,a);
727 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);
728 const XMLCh EncryptedKey::LOCAL_NAME[] = UNICODE_LITERAL_12(E,n,c,r,y,p,t,e,d,K,e,y);
729 const XMLCh EncryptedKey::TYPE_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,e,d,K,e,y,T,y,p,e);
730 const XMLCh EncryptedKey::RECIPIENT_ATTRIB_NAME[] = UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
731 const XMLCh EncryptedType::LOCAL_NAME[] = {chNull};
732 const XMLCh EncryptedType::TYPE_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,T,y,p,e);
733 const XMLCh EncryptedType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
734 const XMLCh EncryptedType::TYPE_ATTRIB_NAME[] = UNICODE_LITERAL_4(T,y,p,e);
735 const XMLCh EncryptedType::MIMETYPE_ATTRIB_NAME[] = UNICODE_LITERAL_8(M,i,m,e,T,y,p,e);
736 const XMLCh EncryptedType::ENCODING_ATTRIB_NAME[] = UNICODE_LITERAL_8(E,n,c,o,d,i,n,g);
737 const XMLCh EncryptionMethod::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,i,o,n,M,e,t,h,o,d);
738 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);
739 const XMLCh EncryptionMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
740 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);
741 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);
742 const XMLCh EncryptionProperties::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
743 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);
744 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);
745 const XMLCh EncryptionProperty::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
746 const XMLCh EncryptionProperty::TARGET_ATTRIB_NAME[] = UNICODE_LITERAL_6(T,a,r,g,e,t);
747 const XMLCh KeyReference::LOCAL_NAME[] = UNICODE_LITERAL_12(K,e,y,R,e,f,e,r,e,n,c,e);
748 const XMLCh KeySize::LOCAL_NAME[] = UNICODE_LITERAL_7(K,e,y,S,i,z,e);
749 const XMLCh OAEPparams::LOCAL_NAME[] = UNICODE_LITERAL_10(O,A,E,P,p,a,r,a,m,s);
750 const XMLCh ReferenceList::LOCAL_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,L,i,s,t);
751 const XMLCh ReferenceType::LOCAL_NAME[] = {chNull};
752 const XMLCh ReferenceType::TYPE_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,T,y,p,e);
753 const XMLCh ReferenceType::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
754 const XMLCh Transforms::LOCAL_NAME[] = UNICODE_LITERAL_10(T,r,a,n,s,f,o,r,m,s);
755 const XMLCh Transforms::TYPE_NAME[] = UNICODE_LITERAL_14(T,r,a,n,s,f,o,r,m,s,T,y,p,e);