2 * Copyright 2001-2009 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 "AbstractComplexElement.h"
26 #include "AbstractSimpleElement.h"
27 #include "exceptions.h"
28 #include "encryption/Encryption.h"
29 #include "io/AbstractXMLObjectMarshaller.h"
30 #include "io/AbstractXMLObjectUnmarshaller.h"
31 #include "signature/KeyInfo.h"
32 #include "util/XMLHelper.h"
34 #include <xercesc/util/XMLUniDefs.hpp>
36 using namespace xmlencryption;
37 using namespace xmltooling;
38 using namespace xercesc;
40 using xmlconstants::XMLENC_NS;
41 using xmlconstants::XMLSIG_NS;
43 #if defined (_MSC_VER)
44 #pragma warning( push )
45 #pragma warning( disable : 4250 4251 )
48 namespace xmlencryption {
50 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CarriedKeyName);
51 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,CipherValue);
52 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,KeySize);
53 DECL_XMLOBJECTIMPL_SIMPLE(XMLTOOL_DLLLOCAL,OAEPparams);
55 class XMLTOOL_DLLLOCAL EncryptionMethodImpl : public virtual EncryptionMethod,
56 public AbstractComplexElement,
57 public AbstractDOMCachingXMLObject,
58 public AbstractXMLObjectMarshaller,
59 public AbstractXMLObjectUnmarshaller
65 m_children.push_back(NULL);
66 m_children.push_back(NULL);
67 m_pos_KeySize=m_children.begin();
68 m_pos_OAEPparams=m_pos_KeySize;
72 virtual ~EncryptionMethodImpl() {
73 XMLString::release(&m_Algorithm);
76 EncryptionMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
77 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
81 EncryptionMethodImpl(const EncryptionMethodImpl& src)
82 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
84 setAlgorithm(src.getAlgorithm());
86 setKeySize(src.getKeySize()->cloneKeySize());
87 if (src.getOAEPparams())
88 setOAEPparams(src.getOAEPparams()->cloneOAEPparams());
89 VectorOf(XMLObject) v=getUnknownXMLObjects();
90 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
91 v.push_back((*i)->clone());
94 IMPL_XMLOBJECT_CLONE(EncryptionMethod);
95 IMPL_STRING_ATTRIB(Algorithm);
96 IMPL_TYPED_CHILD(KeySize);
97 IMPL_TYPED_CHILD(OAEPparams);
98 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
101 void marshallAttributes(DOMElement* domElement) const {
102 MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
105 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
106 PROC_TYPED_CHILD(KeySize,XMLENC_NS,false);
107 PROC_TYPED_CHILD(OAEPparams,XMLENC_NS,false);
110 const XMLCh* nsURI=root->getNamespaceURI();
111 if (!XMLString::equals(nsURI,XMLENC_NS) && nsURI && *nsURI) {
112 getUnknownXMLObjects().push_back(childXMLObject);
116 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
119 void processAttribute(const DOMAttr* attribute) {
120 PROC_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
121 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
125 class XMLTOOL_DLLLOCAL TransformsImpl : public virtual Transforms,
126 public AbstractComplexElement,
127 public AbstractDOMCachingXMLObject,
128 public AbstractXMLObjectMarshaller,
129 public AbstractXMLObjectUnmarshaller
132 virtual ~TransformsImpl() {}
134 TransformsImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
135 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
138 TransformsImpl(const TransformsImpl& src)
139 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(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,XMLSIG_NS,false);
154 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
158 class XMLTOOL_DLLLOCAL CipherReferenceImpl : public virtual CipherReference,
159 public AbstractComplexElement,
160 public AbstractDOMCachingXMLObject,
161 public AbstractXMLObjectMarshaller,
162 public AbstractXMLObjectUnmarshaller
167 m_children.push_back(NULL);
168 m_pos_Transforms=m_children.begin();
171 virtual ~CipherReferenceImpl() {
172 XMLString::release(&m_URI);
175 CipherReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
176 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
180 CipherReferenceImpl(const CipherReferenceImpl& src)
181 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
183 setURI(src.getURI());
184 if (src.getTransforms())
185 setTransforms(src.getTransforms()->cloneTransforms());
188 IMPL_XMLOBJECT_CLONE(CipherReference);
189 IMPL_STRING_ATTRIB(URI);
190 IMPL_TYPED_CHILD(Transforms);
193 void marshallAttributes(DOMElement* domElement) const {
194 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
197 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
198 PROC_TYPED_CHILD(Transforms,XMLENC_NS,false);
199 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
202 void processAttribute(const DOMAttr* attribute) {
203 PROC_STRING_ATTRIB(URI,URI,NULL);
204 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
208 class XMLTOOL_DLLLOCAL CipherDataImpl : public virtual CipherData,
209 public AbstractComplexElement,
210 public AbstractDOMCachingXMLObject,
211 public AbstractXMLObjectMarshaller,
212 public AbstractXMLObjectUnmarshaller
216 m_CipherReference=NULL;
217 m_children.push_back(NULL);
218 m_children.push_back(NULL);
219 m_pos_CipherValue=m_children.begin();
220 m_pos_CipherReference=m_pos_CipherValue;
221 ++m_pos_CipherReference;
224 virtual ~CipherDataImpl() {}
226 CipherDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
227 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
231 CipherDataImpl(const CipherDataImpl& src)
232 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
234 if (src.getCipherValue())
235 setCipherValue(src.getCipherValue()->cloneCipherValue());
236 if (src.getCipherReference())
237 setCipherReference(src.getCipherReference()->cloneCipherReference());
240 IMPL_XMLOBJECT_CLONE(CipherData);
241 IMPL_TYPED_CHILD(CipherValue);
242 IMPL_TYPED_CHILD(CipherReference);
245 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
246 PROC_TYPED_CHILD(CipherValue,XMLENC_NS,false);
247 PROC_TYPED_CHILD(CipherReference,XMLENC_NS,false);
248 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
252 class XMLTOOL_DLLLOCAL EncryptionPropertyImpl : public virtual EncryptionProperty,
253 public AbstractAttributeExtensibleXMLObject,
254 public AbstractComplexElement,
255 public AbstractDOMCachingXMLObject,
256 public AbstractXMLObjectMarshaller,
257 public AbstractXMLObjectUnmarshaller
263 virtual ~EncryptionPropertyImpl() {
264 XMLString::release(&m_Id);
265 XMLString::release(&m_Target);
268 EncryptionPropertyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
269 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
273 EncryptionPropertyImpl(const EncryptionPropertyImpl& src)
274 : AbstractXMLObject(src),
275 AbstractAttributeExtensibleXMLObject(src),
276 AbstractComplexElement(src),
277 AbstractDOMCachingXMLObject(src) {
280 setTarget(src.getTarget());
281 VectorOf(XMLObject) v=getUnknownXMLObjects();
282 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
283 v.push_back((*i)->clone());
286 IMPL_XMLOBJECT_CLONE(EncryptionProperty);
287 IMPL_ID_ATTRIB_EX(Id,ID,NULL);
288 IMPL_STRING_ATTRIB(Target);
289 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
291 void setAttribute(const xmltooling::QName& qualifiedName, const XMLCh* value, bool ID=false) {
292 if (!qualifiedName.hasNamespaceURI()) {
293 if (XMLString::equals(qualifiedName.getLocalPart(),ID_ATTRIB_NAME)) {
297 else if (XMLString::equals(qualifiedName.getLocalPart(),TARGET_ATTRIB_NAME)) {
302 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
306 void marshallAttributes(DOMElement* domElement) const {
307 MARSHALL_ID_ATTRIB(Id,ID,NULL);
308 MARSHALL_STRING_ATTRIB(Target,TARGET,NULL);
309 marshallExtensionAttributes(domElement);
312 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
313 getUnknownXMLObjects().push_back(childXMLObject);
316 void processAttribute(const DOMAttr* attribute) {
317 PROC_ID_ATTRIB(Id,ID,NULL);
318 unmarshallExtensionAttribute(attribute);
322 class XMLTOOL_DLLLOCAL EncryptionPropertiesImpl : public virtual EncryptionProperties,
323 public AbstractComplexElement,
324 public AbstractDOMCachingXMLObject,
325 public AbstractXMLObjectMarshaller,
326 public AbstractXMLObjectUnmarshaller
332 virtual ~EncryptionPropertiesImpl() {
333 XMLString::release(&m_Id);
336 EncryptionPropertiesImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
337 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
341 EncryptionPropertiesImpl(const EncryptionPropertiesImpl& src)
342 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
345 VectorOf(EncryptionProperty) v=getEncryptionPropertys();
346 for (vector<EncryptionProperty*>::const_iterator i=src.m_EncryptionPropertys.begin(); i!=src.m_EncryptionPropertys.end(); i++) {
348 v.push_back((*i)->cloneEncryptionProperty());
353 IMPL_XMLOBJECT_CLONE(EncryptionProperties);
354 IMPL_ID_ATTRIB_EX(Id,ID,NULL);
355 IMPL_TYPED_CHILDREN(EncryptionProperty,m_children.end());
358 void marshallAttributes(DOMElement* domElement) const {
359 MARSHALL_ID_ATTRIB(Id,ID,NULL);
362 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
363 PROC_TYPED_CHILDREN(EncryptionProperty,XMLENC_NS,false);
364 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
367 void processAttribute(const DOMAttr* attribute) {
368 PROC_ID_ATTRIB(Id,ID,NULL);
369 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
373 class XMLTOOL_DLLLOCAL ReferenceTypeImpl : public virtual ReferenceType,
374 public AbstractComplexElement,
375 public AbstractDOMCachingXMLObject,
376 public AbstractXMLObjectMarshaller,
377 public AbstractXMLObjectUnmarshaller
384 ReferenceTypeImpl() {
389 virtual ~ReferenceTypeImpl() {
390 XMLString::release(&m_URI);
393 ReferenceTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
394 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
398 ReferenceTypeImpl(const ReferenceTypeImpl& src)
399 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
401 setURI(src.getURI());
402 VectorOf(XMLObject) v=getUnknownXMLObjects();
403 for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
404 v.push_back((*i)->clone());
407 IMPL_XMLOBJECT_CLONE(ReferenceType);
408 IMPL_STRING_ATTRIB(URI);
409 IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
412 void marshallAttributes(DOMElement* domElement) const {
413 MARSHALL_STRING_ATTRIB(URI,URI,NULL);
416 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
417 getUnknownXMLObjects().push_back(childXMLObject);
420 void processAttribute(const DOMAttr* attribute) {
421 PROC_STRING_ATTRIB(URI,URI,NULL);
422 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
426 class XMLTOOL_DLLLOCAL DataReferenceImpl : public virtual DataReference, public ReferenceTypeImpl
429 virtual ~DataReferenceImpl() {}
431 DataReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
432 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
434 DataReferenceImpl(const DataReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
436 IMPL_XMLOBJECT_CLONE(DataReference);
437 ReferenceType* cloneReferenceType() const {
438 return new DataReferenceImpl(*this);
442 class XMLTOOL_DLLLOCAL KeyReferenceImpl : public virtual KeyReference, public ReferenceTypeImpl
445 virtual ~KeyReferenceImpl() {}
447 KeyReferenceImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
448 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
450 KeyReferenceImpl(const KeyReferenceImpl& src) : AbstractXMLObject(src), ReferenceTypeImpl(src) {}
452 IMPL_XMLOBJECT_CLONE(KeyReference);
453 ReferenceType* cloneReferenceType() const {
454 return new KeyReferenceImpl(*this);
458 class XMLTOOL_DLLLOCAL ReferenceListImpl : public virtual ReferenceList,
459 public AbstractComplexElement,
460 public AbstractDOMCachingXMLObject,
461 public AbstractXMLObjectMarshaller,
462 public AbstractXMLObjectUnmarshaller
465 virtual ~ReferenceListImpl() {}
467 ReferenceListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
468 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
471 ReferenceListImpl(const ReferenceListImpl& src)
472 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
473 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
475 DataReference* data=dynamic_cast<DataReference*>(*i);
477 getDataReferences().push_back(data->cloneDataReference());
481 KeyReference* key=dynamic_cast<KeyReference*>(*i);
483 getKeyReferences().push_back(key->cloneKeyReference());
490 IMPL_XMLOBJECT_CLONE(ReferenceList);
491 IMPL_TYPED_CHILDREN(DataReference,m_children.end());
492 IMPL_TYPED_CHILDREN(KeyReference,m_children.end());
495 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
496 PROC_TYPED_CHILDREN(DataReference,XMLENC_NS,false);
497 PROC_TYPED_CHILDREN(KeyReference,XMLENC_NS,false);
498 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
502 class XMLTOOL_DLLLOCAL EncryptedTypeImpl : public virtual EncryptedType,
503 public AbstractComplexElement,
504 public AbstractDOMCachingXMLObject,
505 public AbstractXMLObjectMarshaller,
506 public AbstractXMLObjectUnmarshaller
509 m_Id=m_Type=m_MimeType=m_Encoding=NULL;
510 m_EncryptionMethod=NULL;
513 m_EncryptionProperties=NULL;
514 m_children.push_back(NULL);
515 m_children.push_back(NULL);
516 m_children.push_back(NULL);
517 m_children.push_back(NULL);
518 m_pos_EncryptionMethod=m_children.begin();
519 m_pos_KeyInfo=m_pos_EncryptionMethod;
521 m_pos_CipherData=m_pos_KeyInfo;
523 m_pos_EncryptionProperties=m_pos_CipherData;
524 ++m_pos_EncryptionProperties;
527 EncryptedTypeImpl() {
532 virtual ~EncryptedTypeImpl() {
533 XMLString::release(&m_Id);
534 XMLString::release(&m_Type);
535 XMLString::release(&m_MimeType);
536 XMLString::release(&m_Encoding);
539 EncryptedTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
540 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
544 EncryptedTypeImpl(const EncryptedTypeImpl& src)
545 : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
548 setType(src.getType());
549 setMimeType(src.getMimeType());
550 setEncoding(src.getEncoding());
551 if (src.getEncryptionMethod())
552 setEncryptionMethod(src.getEncryptionMethod()->cloneEncryptionMethod());
553 if (src.getKeyInfo())
554 setKeyInfo(src.getKeyInfo()->cloneKeyInfo());
555 if (src.getCipherData())
556 setCipherData(src.getCipherData()->cloneCipherData());
557 if (src.getEncryptionProperties())
558 setEncryptionProperties(src.getEncryptionProperties()->cloneEncryptionProperties());
561 IMPL_XMLOBJECT_CLONE(EncryptedType);
562 IMPL_ID_ATTRIB_EX(Id,ID,NULL);
563 IMPL_STRING_ATTRIB(Type);
564 IMPL_STRING_ATTRIB(MimeType);
565 IMPL_STRING_ATTRIB(Encoding);
566 IMPL_TYPED_CHILD(EncryptionMethod);
567 IMPL_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature);
568 IMPL_TYPED_CHILD(CipherData);
569 IMPL_TYPED_CHILD(EncryptionProperties);
572 void marshallAttributes(DOMElement* domElement) const {
573 MARSHALL_ID_ATTRIB(Id,ID,NULL);
574 MARSHALL_STRING_ATTRIB(Type,TYPE,NULL);
575 MARSHALL_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
576 MARSHALL_STRING_ATTRIB(Encoding,ENCODING,NULL);
579 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
580 PROC_TYPED_CHILD(EncryptionMethod,XMLENC_NS,false);
581 PROC_TYPED_FOREIGN_CHILD(KeyInfo,xmlsignature,XMLSIG_NS,false);
582 PROC_TYPED_CHILD(CipherData,XMLENC_NS,false);
583 PROC_TYPED_CHILD(EncryptionProperties,XMLENC_NS,false);
584 AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
587 void processAttribute(const DOMAttr* attribute) {
588 PROC_ID_ATTRIB(Id,ID,NULL);
589 PROC_STRING_ATTRIB(Type,TYPE,NULL);
590 PROC_STRING_ATTRIB(MimeType,MIMETYPE,NULL);
591 PROC_STRING_ATTRIB(Encoding,ENCODING,NULL);
592 AbstractXMLObjectUnmarshaller::processAttribute(attribute);
596 class XMLTOOL_DLLLOCAL EncryptedDataImpl : public virtual EncryptedData, public EncryptedTypeImpl
599 virtual ~EncryptedDataImpl() {}
601 EncryptedDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
602 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
604 EncryptedDataImpl(const EncryptedDataImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {}
606 IMPL_XMLOBJECT_CLONE(EncryptedData);
607 EncryptedType* cloneEncryptedType() const {
608 return new EncryptedDataImpl(*this);
612 class XMLTOOL_DLLLOCAL EncryptedKeyImpl : public virtual EncryptedKey, public EncryptedTypeImpl
616 m_ReferenceList=NULL;
617 m_CarriedKeyName=NULL;
618 m_children.push_back(NULL);
619 m_children.push_back(NULL);
620 m_pos_ReferenceList=m_pos_EncryptionProperties;
621 ++m_pos_ReferenceList;
622 m_pos_CarriedKeyName=m_pos_ReferenceList;
623 ++m_pos_CarriedKeyName;
627 virtual ~EncryptedKeyImpl() {
628 XMLString::release(&m_Recipient);
631 EncryptedKeyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
632 : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
636 EncryptedKeyImpl(const EncryptedKeyImpl& src) : AbstractXMLObject(src), EncryptedTypeImpl(src) {
640 IMPL_XMLOBJECT_CLONE(EncryptedKey);
641 EncryptedType* cloneEncryptedType() const {
642 return new EncryptedKeyImpl(*this);
644 IMPL_STRING_ATTRIB(Recipient);
645 IMPL_TYPED_CHILD(ReferenceList);
646 IMPL_TYPED_CHILD(CarriedKeyName);
649 void marshallAttributes(DOMElement* domElement) const {
650 MARSHALL_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
651 EncryptedTypeImpl::marshallAttributes(domElement);
654 void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
655 PROC_TYPED_CHILD(ReferenceList,XMLENC_NS,false);
656 PROC_TYPED_CHILD(CarriedKeyName,XMLENC_NS,false);
657 EncryptedTypeImpl::processChildElement(childXMLObject,root);
660 void processAttribute(const DOMAttr* attribute) {
661 PROC_STRING_ATTRIB(Recipient,RECIPIENT,NULL);
662 EncryptedTypeImpl::processAttribute(attribute);
668 #if defined (_MSC_VER)
669 #pragma warning( pop )
672 // Builder Implementations
674 IMPL_XMLOBJECTBUILDER(CarriedKeyName);
675 IMPL_XMLOBJECTBUILDER(CipherData);
676 IMPL_XMLOBJECTBUILDER(CipherReference);
677 IMPL_XMLOBJECTBUILDER(CipherValue);
678 IMPL_XMLOBJECTBUILDER(DataReference);
679 IMPL_XMLOBJECTBUILDER(EncryptedData);
680 IMPL_XMLOBJECTBUILDER(EncryptedKey);
681 IMPL_XMLOBJECTBUILDER(EncryptionMethod);
682 IMPL_XMLOBJECTBUILDER(EncryptionProperties);
683 IMPL_XMLOBJECTBUILDER(EncryptionProperty);
684 IMPL_XMLOBJECTBUILDER(KeyReference);
685 IMPL_XMLOBJECTBUILDER(KeySize);
686 IMPL_XMLOBJECTBUILDER(OAEPparams);
687 IMPL_XMLOBJECTBUILDER(ReferenceList);
688 IMPL_XMLOBJECTBUILDER(Transforms);
692 const XMLCh CarriedKeyName::LOCAL_NAME[] = UNICODE_LITERAL_14(C,a,r,r,i,e,d,K,e,y,N,a,m,e);
693 const XMLCh CipherData::LOCAL_NAME[] = UNICODE_LITERAL_10(C,i,p,h,e,r,D,a,t,a);
694 const XMLCh CipherData::TYPE_NAME[] = UNICODE_LITERAL_14(C,i,p,h,e,r,D,a,t,a,T,y,p,e);
695 const XMLCh CipherReference::LOCAL_NAME[] = UNICODE_LITERAL_15(C,i,p,h,e,r,R,e,f,e,r,e,n,c,e);
696 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);
697 const XMLCh CipherReference::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
698 const XMLCh CipherValue::LOCAL_NAME[] = UNICODE_LITERAL_11(C,i,p,h,e,r,V,a,l,u,e);
699 const XMLCh DataReference::LOCAL_NAME[] = UNICODE_LITERAL_13(D,a,t,a,R,e,f,e,r,e,n,c,e);
700 const XMLCh EncryptedData::LOCAL_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,D,a,t,a);
701 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);
702 const XMLCh EncryptedKey::LOCAL_NAME[] = UNICODE_LITERAL_12(E,n,c,r,y,p,t,e,d,K,e,y);
703 const XMLCh EncryptedKey::TYPE_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,e,d,K,e,y,T,y,p,e);
704 const XMLCh EncryptedKey::RECIPIENT_ATTRIB_NAME[] = UNICODE_LITERAL_9(R,e,c,i,p,i,e,n,t);
705 const XMLCh EncryptedType::LOCAL_NAME[] = {chNull};
706 const XMLCh EncryptedType::TYPE_NAME[] = UNICODE_LITERAL_13(E,n,c,r,y,p,t,e,d,T,y,p,e);
707 const XMLCh EncryptedType::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
708 const XMLCh EncryptedType::TYPE_ATTRIB_NAME[] = UNICODE_LITERAL_4(T,y,p,e);
709 const XMLCh EncryptedType::MIMETYPE_ATTRIB_NAME[] = UNICODE_LITERAL_8(M,i,m,e,T,y,p,e);
710 const XMLCh EncryptedType::ENCODING_ATTRIB_NAME[] = UNICODE_LITERAL_8(E,n,c,o,d,i,n,g);
711 const XMLCh EncryptionMethod::LOCAL_NAME[] = UNICODE_LITERAL_16(E,n,c,r,y,p,t,i,o,n,M,e,t,h,o,d);
712 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);
713 const XMLCh EncryptionMethod::ALGORITHM_ATTRIB_NAME[] = UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);
714 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);
715 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);
716 const XMLCh EncryptionProperties::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
717 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);
718 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);
719 const XMLCh EncryptionProperty::ID_ATTRIB_NAME[] = UNICODE_LITERAL_2(I,d);
720 const XMLCh EncryptionProperty::TARGET_ATTRIB_NAME[] = UNICODE_LITERAL_6(T,a,r,g,e,t);
721 const XMLCh KeyReference::LOCAL_NAME[] = UNICODE_LITERAL_12(K,e,y,R,e,f,e,r,e,n,c,e);
722 const XMLCh KeySize::LOCAL_NAME[] = UNICODE_LITERAL_7(K,e,y,S,i,z,e);
723 const XMLCh OAEPparams::LOCAL_NAME[] = UNICODE_LITERAL_10(O,A,E,P,p,a,r,a,m,s);
724 const XMLCh ReferenceList::LOCAL_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,L,i,s,t);
725 const XMLCh ReferenceType::LOCAL_NAME[] = {chNull};
726 const XMLCh ReferenceType::TYPE_NAME[] = UNICODE_LITERAL_13(R,e,f,e,r,e,n,c,e,T,y,p,e);
727 const XMLCh ReferenceType::URI_ATTRIB_NAME[] = UNICODE_LITERAL_3(U,R,I);
728 const XMLCh Transforms::LOCAL_NAME[] = UNICODE_LITERAL_10(T,r,a,n,s,f,o,r,m,s);
729 const XMLCh Transforms::TYPE_NAME[] = UNICODE_LITERAL_14(T,r,a,n,s,f,o,r,m,s,T,y,p,e);