2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
24 * Implementation classes for XML Encryption schema.
28 #include "AbstractAttributeExtensibleXMLObject.h"
29 #include "AbstractComplexElement.h"
30 #include "AbstractSimpleElement.h"
31 #include "exceptions.h"
32 #include "encryption/Encryption.h"
33 #include "io/AbstractXMLObjectMarshaller.h"
34 #include "io/AbstractXMLObjectUnmarshaller.h"
35 #include "signature/KeyInfo.h"
36 #include "util/XMLHelper.h"
38 #include <xercesc/util/XMLUniDefs.hpp>
40 using namespace xmlencryption;
41 using namespace xmltooling;
42 using namespace xercesc;
44 using xmlconstants::XMLENC_NS;
45 using xmlconstants::XMLSIG_NS;
47 #if defined (_MSC_VER)
48 #pragma warning( push )
49 #pragma warning( disable : 4250 4251 )
52 namespace xmlencryption {
54 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CarriedKeyName);
55 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CipherValue);
56 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,KeySize);
57 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,OAEPparams);
59 class XMLTOOL_DLLLOCAL EncryptionMethodImpl : public virtual EncryptionMethod,
60 public AbstractComplexElement,
61 public AbstractDOMCachingXMLObject,
62 public AbstractXMLObjectMarshaller,
63 public AbstractXMLObjectUnmarshaller
69 m_children.push_back(nullptr);
70 m_children.push_back(nullptr);
71 m_pos_KeySize=m_children.begin();
72 m_pos_OAEPparams=m_pos_KeySize;
77 virtual ~EncryptionMethodImpl() {
78 XMLString::release(&m_Algorithm);
81 EncryptionMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
82 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
86 EncryptionMethodImpl(const EncryptionMethodImpl& src)
87 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
89 setAlgorithm(src.getAlgorithm());
91 setKeySize(src.getKeySize()->cloneKeySize());
92 if (src.getOAEPparams())
93 setOAEPparams(src.getOAEPparams()->cloneOAEPparams());
94 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
96 getUnknownXMLObjects().push_back((*i)->clone());
101 IMPL_XMLOBJECT_CLONE(EncryptionMethod);
102 IMPL_STRING_ATTRIB(Algorithm);
103 IMPL_TYPED_CHILD(KeySize);
104 IMPL_TYPED_CHILD(OAEPparams);
105 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
108 void marshallAttributes(DOMElement* domElement) const {
109 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
112 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
113 PROC_TYPED_CHILD(KeySize,XMLENC_NS,false);
114 PROC_TYPED_CHILD(OAEPparams,XMLENC_NS,false);
117 const XMLCh* nsURI=root->getNamespaceURI();
118 if (!XMLString::equals(nsURI,XMLENC_NS) && nsURI && *nsURI) {
119 getUnknownXMLObjects().push_back(childXMLObject);
123 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
126 void processAttribute(const DOMAttr* attribute) {
127 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
128 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
132 class XMLTOOL_DLLLOCAL TransformsImpl : public virtual Transforms,
133 public AbstractComplexElement,
134 public AbstractDOMCachingXMLObject,
135 public AbstractXMLObjectMarshaller,
136 public AbstractXMLObjectUnmarshaller
139 virtual ~TransformsImpl() {}
141 TransformsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
142 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
145 TransformsImpl(const TransformsImpl& src)
146 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
147 for (vector<xmlsignature::Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
149 getTransforms().push_back((*i)->cloneTransform());
154 IMPL_XMLOBJECT_CLONE(Transforms);
155 IMPL_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,m_children.end());
158 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
159 PROC_TYPED_FOREIGN_CHILDREN(Transform,xmlsignature,XMLSIG_NS,false);
160 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
164 class XMLTOOL_DLLLOCAL CipherReferenceImpl : public virtual CipherReference,
165 public AbstractComplexElement,
166 public AbstractDOMCachingXMLObject,
167 public AbstractXMLObjectMarshaller,
168 public AbstractXMLObjectUnmarshaller
172 m_Transforms=nullptr;
173 m_children.push_back(nullptr);
174 m_pos_Transforms=m_children.begin();
178 virtual ~CipherReferenceImpl() {
179 XMLString::release(&m_URI);
182 CipherReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
183 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
187 CipherReferenceImpl(const CipherReferenceImpl& src)
188 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
190 setURI(src.getURI());
191 if (src.getTransforms())
192 setTransforms(src.getTransforms()->cloneTransforms());
195 IMPL_XMLOBJECT_CLONE(CipherReference);
196 IMPL_STRING_ATTRIB(URI);
197 IMPL_TYPED_CHILD(Transforms);
200 void marshallAttributes(DOMElement* domElement) const {
201 MARSHALL_STRING_ATTRIB(URI,URI,nullptr);
204 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
205 PROC_TYPED_CHILD(Transforms,XMLENC_NS,false);
206 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
209 void processAttribute(const DOMAttr* attribute) {
210 PROC_STRING_ATTRIB(URI,URI,nullptr);
211 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
215 class XMLTOOL_DLLLOCAL CipherDataImpl : public virtual CipherData,
216 public AbstractComplexElement,
217 public AbstractDOMCachingXMLObject,
218 public AbstractXMLObjectMarshaller,
219 public AbstractXMLObjectUnmarshaller
222 m_CipherValue=nullptr;
223 m_CipherReference=nullptr;
224 m_children.push_back(nullptr);
225 m_children.push_back(nullptr);
226 m_pos_CipherValue=m_children.begin();
227 m_pos_CipherReference=m_pos_CipherValue;
228 ++m_pos_CipherReference;
232 virtual ~CipherDataImpl() {}
234 CipherDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
235 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
239 CipherDataImpl(const CipherDataImpl& src)
240 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
242 if (src.getCipherValue())
243 setCipherValue(src.getCipherValue()->cloneCipherValue());
244 if (src.getCipherReference())
245 setCipherReference(src.getCipherReference()->cloneCipherReference());
248 IMPL_XMLOBJECT_CLONE(CipherData);
249 IMPL_TYPED_CHILD(CipherValue);
250 IMPL_TYPED_CHILD(CipherReference);
253 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
254 PROC_TYPED_CHILD(CipherValue,XMLENC_NS,false);
255 PROC_TYPED_CHILD(CipherReference,XMLENC_NS,false);
256 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
260 class XMLTOOL_DLLLOCAL EncryptionPropertyImpl : public virtual EncryptionProperty,
261 public AbstractAttributeExtensibleXMLObject,
262 public AbstractComplexElement,
263 public AbstractDOMCachingXMLObject,
264 public AbstractXMLObjectMarshaller,
265 public AbstractXMLObjectUnmarshaller
268 m_Id=m_Target=nullptr;
272 virtual ~EncryptionPropertyImpl() {
273 XMLString::release(&m_Id);
274 XMLString::release(&m_Target);
277 EncryptionPropertyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
278 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
282 EncryptionPropertyImpl(const EncryptionPropertyImpl& src)
283 : AbstractXMLObject(src),
284 AbstractAttributeExtensibleXMLObject(src),
285 AbstractComplexElement(src),
286 AbstractDOMCachingXMLObject(src) {
289 setTarget(src.getTarget());
290 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
292 getUnknownXMLObjects().push_back((*i)->clone());
297 IMPL_XMLOBJECT_CLONE(EncryptionProperty);
298 IMPL_ID_ATTRIB_EX(Id,ID,nullptr);
299 IMPL_STRING_ATTRIB(Target);
300 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
302 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
303 if (!qualifiedName.hasNamespaceURI()) {
304 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
308 else if (XMLString::equals(qualifiedName.getLocalPart(),TARGET_ATTRIB_NAME)) {
313 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
317 void marshallAttributes(DOMElement* domElement) const {
318 MARSHALL_ID_ATTRIB(Id,ID,nullptr);
319 MARSHALL_STRING_ATTRIB(Target,TARGET,nullptr);
320 marshallExtensionAttributes(domElement);
323 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
324 getUnknownXMLObjects().push_back(childXMLObject);
327 void processAttribute(const DOMAttr* attribute) {
328 PROC_ID_ATTRIB(Id,ID,nullptr);
329 unmarshallExtensionAttribute(attribute);
333 class XMLTOOL_DLLLOCAL EncryptionPropertiesImpl : public virtual EncryptionProperties,
334 public AbstractComplexElement,
335 public AbstractDOMCachingXMLObject,
336 public AbstractXMLObjectMarshaller,
337 public AbstractXMLObjectUnmarshaller
344 virtual ~EncryptionPropertiesImpl() {
345 XMLString::release(&m_Id);
348 EncryptionPropertiesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
349 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
353 EncryptionPropertiesImpl(const EncryptionPropertiesImpl& src)
354 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
357 for (vector<EncryptionProperty*>::const_iterator i=src.m_EncryptionPropertys.begin(); i!=src.m_EncryptionPropertys.end(); i++) {
359 getEncryptionPropertys().push_back((*i)->cloneEncryptionProperty());
364 IMPL_XMLOBJECT_CLONE(EncryptionProperties);
365 IMPL_ID_ATTRIB_EX(Id,ID,nullptr);
366 IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end());
369 void marshallAttributes(DOMElement* domElement) const {
370 MARSHALL_ID_ATTRIB(Id,ID,nullptr);
373 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
374 PROC_TYPED_CHILDREN(EncryptionProperty,XMLENC_NS,false);
375 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
378 void processAttribute(const DOMAttr* attribute) {
379 PROC_ID_ATTRIB(Id,ID,nullptr);
380 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
384 class XMLTOOL_DLLLOCAL ReferenceTypeImpl : public virtual ReferenceType,
385 public AbstractComplexElement,
386 public AbstractDOMCachingXMLObject,
387 public AbstractXMLObjectMarshaller,
388 public AbstractXMLObjectUnmarshaller
391 ReferenceTypeImpl() {
396 virtual ~ReferenceTypeImpl() {
397 XMLString::release(&m_URI);
400 ReferenceTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
401 : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_URI(nullptr) {
404 ReferenceTypeImpl(const ReferenceTypeImpl& src)
405 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_URI(nullptr) {
408 void _clone(const ReferenceTypeImpl& src) {
409 setURI(src.getURI());
410 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) {
412 getUnknownXMLObjects().push_back((*i)->clone());
417 IMPL_XMLOBJECT_CLONE_EX(ReferenceType);
418 IMPL_STRING_ATTRIB(URI);
419 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
422 void marshallAttributes(DOMElement* domElement) const {
423 MARSHALL_STRING_ATTRIB(URI,URI,nullptr);
426 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
427 getUnknownXMLObjects().push_back(childXMLObject);
430 void processAttribute(const DOMAttr* attribute) {
431 PROC_STRING_ATTRIB(URI,URI,nullptr);
432 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
436 class XMLTOOL_DLLLOCAL DataReferenceImpl : public virtual DataReference, public ReferenceTypeImpl
439 virtual ~DataReferenceImpl() {}
441 DataReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
442 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
444 DataReferenceImpl(const DataReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
446 IMPL_XMLOBJECT_CLONE_EX(DataReference);
449 class XMLTOOL_DLLLOCAL KeyReferenceImpl : public virtual KeyReference, public ReferenceTypeImpl
452 virtual ~KeyReferenceImpl() {}
454 KeyReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
455 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
457 KeyReferenceImpl(const KeyReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
459 IMPL_XMLOBJECT_CLONE_EX(KeyReference);
462 class XMLTOOL_DLLLOCAL ReferenceListImpl : public virtual ReferenceList,
463 public AbstractComplexElement,
464 public AbstractDOMCachingXMLObject,
465 public AbstractXMLObjectMarshaller,
466 public AbstractXMLObjectUnmarshaller
469 virtual ~ReferenceListImpl() {}
471 ReferenceListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
472 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
475 ReferenceListImpl(const ReferenceListImpl& src)
476 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
477 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
479 DataReference* data=dynamic_cast<DataReference*>(*i);
481 getDataReferences().push_back(data->cloneDataReference());
485 KeyReference* key=dynamic_cast<KeyReference*>(*i);
487 getKeyReferences().push_back(key->cloneKeyReference());
494 IMPL_XMLOBJECT_CLONE(ReferenceList);
495 IMPL_TYPED_CHILDREN(DataReference,m_children.end());
496 IMPL_TYPED_CHILDREN(KeyReference,m_children.end());
499 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
500 PROC_TYPED_CHILDREN(DataReference,XMLENC_NS,false);
501 PROC_TYPED_CHILDREN(KeyReference,XMLENC_NS,false);
502 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
506 class XMLTOOL_DLLLOCAL EncryptedTypeImpl : public virtual EncryptedType,
507 public AbstractComplexElement,
508 public AbstractDOMCachingXMLObject,
509 public AbstractXMLObjectMarshaller,
510 public AbstractXMLObjectUnmarshaller
513 m_Id=m_Type=m_MimeType=m_Encoding=nullptr;
514 m_EncryptionMethod=nullptr;
516 m_CipherData=nullptr;
517 m_EncryptionProperties=nullptr;
518 m_children.push_back(nullptr);
519 m_children.push_back(nullptr);
520 m_children.push_back(nullptr);
521 m_children.push_back(nullptr);
522 m_pos_EncryptionMethod=m_children.begin();
523 m_pos_KeyInfo=m_pos_EncryptionMethod;
525 m_pos_CipherData=m_pos_KeyInfo;
527 m_pos_EncryptionProperties=m_pos_CipherData;
528 ++m_pos_EncryptionProperties;
532 EncryptedTypeImpl() {
537 virtual ~EncryptedTypeImpl() {
538 XMLString::release(&m_Id);
539 XMLString::release(&m_Type);
540 XMLString::release(&m_MimeType);
541 XMLString::release(&m_Encoding);
544 EncryptedTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
545 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
549 EncryptedTypeImpl(const EncryptedTypeImpl& src)
550 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
554 void _clone(const EncryptedTypeImpl& src) {
556 setType(src.getType());
557 setMimeType(src.getMimeType());
558 setEncoding(src.getEncoding());
559 if (src.getEncryptionMethod())
560 setEncryptionMethod(src.getEncryptionMethod()->cloneEncryptionMethod());
561 if (src.getKeyInfo())
562 setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
563 if (src.getCipherData())
564 setCipherData(src.getCipherData()->cloneCipherData());
565 if (src.getEncryptionProperties())
566 setEncryptionProperties(src.getEncryptionProperties()->cloneEncryptionProperties());
569 IMPL_XMLOBJECT_CLONE_EX(EncryptedType);
570 IMPL_ID_ATTRIB_EX(Id,ID,nullptr);
571 IMPL_STRING_ATTRIB(Type);
572 IMPL_STRING_ATTRIB(MimeType);
573 IMPL_STRING_ATTRIB(Encoding);
574 IMPL_TYPED_CHILD(EncryptionMethod);
575 IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
576 IMPL_TYPED_CHILD(CipherData);
577 IMPL_TYPED_CHILD(EncryptionProperties);
580 void marshallAttributes(DOMElement* domElement) const {
581 MARSHALL_ID_ATTRIB(Id,ID,nullptr);
582 MARSHALL_STRING_ATTRIB(Type,TYPE,nullptr);
583 MARSHALL_STRING_ATTRIB(MimeType,MIMETYPE,nullptr);
584 MARSHALL_STRING_ATTRIB(Encoding,ENCODING,nullptr);
587 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
588 PROC_TYPED_CHILD(EncryptionMethod,XMLENC_NS,false);
589 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
590 PROC_TYPED_CHILD(CipherData,XMLENC_NS,false);
591 PROC_TYPED_CHILD(EncryptionProperties,XMLENC_NS,false);
592 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
595 void processAttribute(const DOMAttr* attribute) {
596 PROC_ID_ATTRIB(Id,ID,nullptr);
597 PROC_STRING_ATTRIB(Type,TYPE,nullptr);
598 PROC_STRING_ATTRIB(MimeType,MIMETYPE,nullptr);
599 PROC_STRING_ATTRIB(Encoding,ENCODING,nullptr);
600 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
604 class XMLTOOL_DLLLOCAL EncryptedDataImpl : public virtual EncryptedData, public EncryptedTypeImpl
607 virtual ~EncryptedDataImpl() {}
609 EncryptedDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
610 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
612 EncryptedDataImpl(const EncryptedDataImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {}
614 IMPL_XMLOBJECT_CLONE_EX(EncryptedData);
617 class XMLTOOL_DLLLOCAL EncryptedKeyImpl : public virtual EncryptedKey, public EncryptedTypeImpl
621 m_ReferenceList=nullptr;
622 m_CarriedKeyName=nullptr;
623 m_children.push_back(nullptr);
624 m_children.push_back(nullptr);
625 m_pos_ReferenceList=m_pos_EncryptionProperties;
626 ++m_pos_ReferenceList;
627 m_pos_CarriedKeyName=m_pos_ReferenceList;
628 ++m_pos_CarriedKeyName;
632 virtual ~EncryptedKeyImpl() {
633 XMLString::release(&m_Recipient);
636 EncryptedKeyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
637 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
641 EncryptedKeyImpl(const EncryptedKeyImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {
645 void _clone(const EncryptedKeyImpl& src) {
646 EncryptedTypeImpl::_clone(src);
647 setRecipient(src.getRecipient());
648 if (src.getReferenceList())
649 setReferenceList(src.getReferenceList()->cloneReferenceList());
650 if (src.getCarriedKeyName())
651 setCarriedKeyName(src.getCarriedKeyName()->cloneCarriedKeyName());
654 IMPL_XMLOBJECT_CLONE_EX(EncryptedKey);
655 IMPL_STRING_ATTRIB(Recipient);
656 IMPL_TYPED_CHILD(ReferenceList);
657 IMPL_TYPED_CHILD(CarriedKeyName);
660 void marshallAttributes(DOMElement* domElement) const {
661 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
662 EncryptedTypeImpl::marshallAttributes(domElement);
665 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
666 PROC_TYPED_CHILD(ReferenceList,XMLENC_NS,false);
667 PROC_TYPED_CHILD(CarriedKeyName,XMLENC_NS,false);
668 EncryptedTypeImpl::processChildElement(childXMLObject,root);
671 void processAttribute(const DOMAttr* attribute) {
672 PROC_STRING_ATTRIB(Recipient,RECIPIENT,nullptr);
673 EncryptedTypeImpl::processAttribute(attribute);
679 #if defined (_MSC_VER)
680 #pragma warning( pop )
683 // Builder Implementations
685 IMPL_XMLOBJECTBUILDER(CarriedKeyName);
686 IMPL_XMLOBJECTBUILDER(CipherData);
687 IMPL_XMLOBJECTBUILDER(CipherReference);
688 IMPL_XMLOBJECTBUILDER(CipherValue);
689 IMPL_XMLOBJECTBUILDER(DataReference);
690 IMPL_XMLOBJECTBUILDER(EncryptedData);
691 IMPL_XMLOBJECTBUILDER(EncryptedKey);
692 IMPL_XMLOBJECTBUILDER(EncryptionMethod);
693 IMPL_XMLOBJECTBUILDER(EncryptionProperties);
694 IMPL_XMLOBJECTBUILDER(EncryptionProperty);
695 IMPL_XMLOBJECTBUILDER(KeyReference);
696 IMPL_XMLOBJECTBUILDER(KeySize);
697 IMPL_XMLOBJECTBUILDER(OAEPparams);
698 IMPL_XMLOBJECTBUILDER(ReferenceList);
699 IMPL_XMLOBJECTBUILDER(Transforms);
703 const XMLCh CarriedKeyName::LOCAL_NAME[] = UNICODE_LITERAL_14(C,a,r,r,i,e,d,K,e,y,N,a,m,e);
704 const XMLCh CipherData::LOCAL_NAME[] = UNICODE_LITERAL_10(C,i,p,h,e,r,D,a,t,a);
705 const XMLCh CipherData::TYPE_NAME[] = UNICODE_LITERAL_14(C,i,p,h,e,r,D,a,t,a,T,y,p,e);
706 const XMLCh CipherReference::LOCAL_NAME[] = UNICODE_LITERAL_15(C,i,p,h,e,r,R,e,f,e,r,e,n,c,e);
707 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);
708 const XMLCh CipherReference::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
709 const XMLCh CipherValue::LOCAL_NAME[] = UNICODE_LITERAL_11(C,i,p,h,e,r,V,a,l,u,e);
710 const XMLCh DataReference::LOCAL_NAME[] = UNICODE_LITERAL_13(D,a,t,a,R,e,f,e,r,e,n,c,e);
711 const XMLCh EncryptedData::LOCAL_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,D,a,t,a);
712 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);
713 const XMLCh EncryptedKey::LOCAL_NAME[] = UNICODE_LITERAL_12(E,n,c,r,y,p,t,e,d,K,e,y);
714 const XMLCh EncryptedKey::TYPE_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,e,d,K,e,y,T,y,p,e);
715 const XMLCh EncryptedKey::RECIPIENT_ATTRIB_NAME[] = UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
716 const XMLCh EncryptedType::LOCAL_NAME[] = {chNull};
717 const XMLCh EncryptedType::TYPE_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,T,y,p,e);
718 const XMLCh EncryptedType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
719 const XMLCh EncryptedType::TYPE_ATTRIB_NAME[] = UNICODE_LITERAL_4(T,y,p,e);
720 const XMLCh EncryptedType::MIMETYPE_ATTRIB_NAME[] = UNICODE_LITERAL_8(M,i,m,e,T,y,p,e);
721 const XMLCh EncryptedType::ENCODING_ATTRIB_NAME[] = UNICODE_LITERAL_8(E,n,c,o,d,i,n,g);
722 const XMLCh EncryptionMethod::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,i,o,n,M,e,t,h,o,d);
723 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);
724 const XMLCh EncryptionMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
725 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);
726 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);
727 const XMLCh EncryptionProperties::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
728 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);
729 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);
730 const XMLCh EncryptionProperty::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
731 const XMLCh EncryptionProperty::TARGET_ATTRIB_NAME[] = UNICODE_LITERAL_6(T,a,r,g,e,t);
732 const XMLCh KeyReference::LOCAL_NAME[] = UNICODE_LITERAL_12(K,e,y,R,e,f,e,r,e,n,c,e);
733 const XMLCh KeySize::LOCAL_NAME[] = UNICODE_LITERAL_7(K,e,y,S,i,z,e);
734 const XMLCh OAEPparams::LOCAL_NAME[] = UNICODE_LITERAL_10(O,A,E,P,p,a,r,a,m,s);
735 const XMLCh ReferenceList::LOCAL_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,L,i,s,t);
736 const XMLCh ReferenceType::LOCAL_NAME[] = {chNull};
737 const XMLCh ReferenceType::TYPE_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,T,y,p,e);
738 const XMLCh ReferenceType::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
739 const XMLCh Transforms::LOCAL_NAME[] = UNICODE_LITERAL_10(T,r,a,n,s,f,o,r,m,s);
740 const XMLCh Transforms::TYPE_NAME[] = UNICODE_LITERAL_14(T,r,a,n,s,f,o,r,m,s,T,y,p,e);