Refactor extraction of certificate details.
[shibboleth/xmltooling.git] / xmltooling / signature / impl / KeyInfoImpl.cpp
index 4643bf7..1f59137 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include "internal.h"
-#include "AbstractChildlessElement.h"
 #include "AbstractComplexElement.h"
-#include "AbstractElementProxy.h"
 #include "AbstractSimpleElement.h"
 #include "exceptions.h"
 #include "io/AbstractXMLObjectMarshaller.h"
 #include "io/AbstractXMLObjectUnmarshaller.h"
 #include "signature/KeyInfo.h"
 #include "util/XMLHelper.h"
-#include "validation/AbstractValidatingXMLObject.h"
 
 #include <xercesc/util/XMLUniDefs.hpp>
 
 using namespace xmlsignature;
 using namespace xmltooling;
 using namespace std;
+using xmlconstants::XMLSIG_NS;
 
 #if defined (_MSC_VER)
     #pragma warning( push )
@@ -48,7 +46,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL DSAKeyValueImpl : public virtual DSAKeyValue,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -61,7 +58,7 @@ namespace xmlsignature {
         }
             
         DSAKeyValueImpl(const DSAKeyValueImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getP())
                 setP(src.getP()->cloneP());
@@ -120,13 +117,13 @@ namespace xmlsignature {
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(P,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(Q,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(G,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(Y,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(J,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(Seed,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(PgenCounter,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(P,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Q,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(G,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Y,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(J,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Seed,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(PgenCounter,XMLSIG_NS,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
@@ -134,7 +131,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL RSAKeyValueImpl : public virtual RSAKeyValue,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -147,7 +143,7 @@ namespace xmlsignature {
         }
             
         RSAKeyValueImpl(const RSAKeyValueImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getModulus())
                 setModulus(src.getModulus()->cloneModulus());
@@ -171,17 +167,15 @@ namespace xmlsignature {
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(Modulus,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(Exponent,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Modulus,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Exponent,XMLSIG_NS,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
 
     class XMLTOOL_DLLLOCAL KeyValueImpl : public virtual KeyValue,
-        public AbstractSimpleElement,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -194,55 +188,54 @@ namespace xmlsignature {
         }
             
         KeyValueImpl(const KeyValueImpl& src)
-                : AbstractXMLObject(src), AbstractSimpleElement(src),
-                    AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getDSAKeyValue())
                 setDSAKeyValue(src.getDSAKeyValue()->cloneDSAKeyValue());
             if (src.getRSAKeyValue())
                 setRSAKeyValue(src.getRSAKeyValue()->cloneRSAKeyValue());
-            if (src.getOtherKeyValue())
-                setOtherKeyValue(src.getOtherKeyValue()->clone());
+            if (src.getUnknownXMLObject())
+                setUnknownXMLObject(src.getUnknownXMLObject()->clone());
         }
         
         void init() {
             m_DSAKeyValue=NULL;
             m_RSAKeyValue=NULL;
-            m_OtherKeyValue=NULL;
+            m_UnknownXMLObject=NULL;
             m_children.push_back(NULL);
             m_children.push_back(NULL);
             m_children.push_back(NULL);
             m_pos_DSAKeyValue=m_children.begin();
             m_pos_RSAKeyValue=m_pos_DSAKeyValue;
             ++m_pos_RSAKeyValue;
-            m_pos_OtherKeyValue=m_pos_RSAKeyValue;
-            ++m_pos_OtherKeyValue;
+            m_pos_UnknownXMLObject=m_pos_RSAKeyValue;
+            ++m_pos_UnknownXMLObject;
         }
         
         IMPL_XMLOBJECT_CLONE(KeyValue);
         IMPL_TYPED_CHILD(DSAKeyValue);
         IMPL_TYPED_CHILD(RSAKeyValue);
-        IMPL_XMLOBJECT_CHILD(OtherKeyValue);
-        IMPL_XMLOBJECT_CONTENT;
+        IMPL_XMLOBJECT_CHILD(UnknownXMLObject);
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(DSAKeyValue,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(RSAKeyValue,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(DSAKeyValue,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(RSAKeyValue,XMLSIG_NS,false);
             
             // Unknown child.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI)
-                setOtherKeyValue(childXMLObject);
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
+                setUnknownXMLObject(childXMLObject);
+                return;
+            }
             
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
 
     class XMLTOOL_DLLLOCAL TransformImpl : public virtual Transform,
+        public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractElementProxy,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -256,8 +249,8 @@ namespace xmlsignature {
         }
             
         TransformImpl(const TransformImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractElementProxy(src),
-                    AbstractValidatingXMLObject(src), m_Algorithm(XMLString::replicate(src.m_Algorithm)) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src),
+                    m_Algorithm(XMLString::replicate(src.m_Algorithm)) {
             for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
                 if (*i) {
                     XPath* x=dynamic_cast<XPath*>(*i);
@@ -265,7 +258,7 @@ namespace xmlsignature {
                         getXPaths().push_back(x->cloneXPath());
                         continue;
                     }
-                    getXMLObjects().push_back((*i)->clone());
+                    getUnknownXMLObjects().push_back((*i)->clone());
                 }
             }
         }
@@ -273,7 +266,7 @@ namespace xmlsignature {
         IMPL_XMLOBJECT_CLONE(Transform);
         IMPL_STRING_ATTRIB(Algorithm);
         IMPL_TYPED_CHILDREN(XPath,m_children.end());
-        IMPL_XMLOBJECT_CONTENT;
+        IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
 
     protected:
         void marshallAttributes(DOMElement* domElement) const {
@@ -281,25 +274,27 @@ namespace xmlsignature {
         }
 
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILDREN(XPath,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(XPath,XMLSIG_NS,false);
             
             // Unknown child.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI)
-                getXMLObjects().push_back(childXMLObject);
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
+                getUnknownXMLObjects().push_back(childXMLObject);
+                return;
+            }
             
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
 
         void processAttribute(const DOMAttr* attribute) {
             PROC_STRING_ATTRIB(Algorithm,ALGORITHM,NULL);
+            AbstractXMLObjectUnmarshaller::processAttribute(attribute);
         }
     };
 
     class XMLTOOL_DLLLOCAL TransformsImpl : public virtual Transforms,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -311,7 +306,7 @@ namespace xmlsignature {
         }
             
         TransformsImpl(const TransformsImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             VectorOf(Transform) v=getTransforms();
             for (vector<Transform*>::const_iterator i=src.m_Transforms.begin(); i!=src.m_Transforms.end(); i++) {
                 if (*i) {
@@ -325,7 +320,7 @@ namespace xmlsignature {
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILDREN(Transform,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(Transform,XMLSIG_NS,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
@@ -333,7 +328,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL RetrievalMethodImpl : public virtual RetrievalMethod,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -349,7 +343,7 @@ namespace xmlsignature {
         }
             
         RetrievalMethodImpl(const RetrievalMethodImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             setURI(getURI());
             setType(getType());
@@ -376,20 +370,20 @@ namespace xmlsignature {
         }
 
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(Transforms,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(Transforms,XMLSIG_NS,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
 
         void processAttribute(const DOMAttr* attribute) {
             PROC_STRING_ATTRIB(URI,URI,NULL);
             PROC_STRING_ATTRIB(Type,TYPE,NULL);
+            AbstractXMLObjectUnmarshaller::processAttribute(attribute);
         }
     };
 
     class XMLTOOL_DLLLOCAL X509IssuerSerialImpl : public virtual X509IssuerSerial,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -402,7 +396,7 @@ namespace xmlsignature {
         }
             
         X509IssuerSerialImpl(const X509IssuerSerialImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getX509IssuerName())
                 setX509IssuerName(src.getX509IssuerName()->cloneX509IssuerName());
@@ -426,8 +420,8 @@ namespace xmlsignature {
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(X509IssuerName,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(X509SerialNumber,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(X509IssuerName,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(X509SerialNumber,XMLSIG_NS,false);
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
     };
@@ -435,7 +429,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL X509DataImpl : public virtual X509Data,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -447,7 +440,7 @@ namespace xmlsignature {
         }
             
         X509DataImpl(const X509DataImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
                 if (*i) {
                     X509Certificate* xcert=dynamic_cast<X509Certificate*>(*i);
@@ -480,7 +473,7 @@ namespace xmlsignature {
                         continue;
                     }
 
-                    getOtherX509Datas().push_back((*i)->clone());
+                    getUnknownXMLObjects().push_back((*i)->clone());
                 }
             }
         }
@@ -491,20 +484,22 @@ namespace xmlsignature {
         IMPL_TYPED_CHILDREN(X509SubjectName,m_children.end());
         IMPL_TYPED_CHILDREN(X509Certificate,m_children.end());
         IMPL_TYPED_CHILDREN(X509CRL,m_children.end());
-        IMPL_XMLOBJECT_CHILDREN(OtherX509Data,m_children.end());
+        IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILDREN(X509IssuerSerial,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(X509SKI,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(X509SubjectName,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(X509Certificate,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(X509CRL,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509IssuerSerial,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509SKI,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509SubjectName,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509Certificate,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509CRL,XMLSIG_NS,false);
             
             // Unknown child.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI)
-                getOtherX509Datas().push_back(childXMLObject);
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
+                getUnknownXMLObjects().push_back(childXMLObject);
+                return;
+            }
             
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
@@ -513,7 +508,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL SPKIDataImpl : public virtual SPKIData,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -525,7 +519,7 @@ namespace xmlsignature {
         }
             
         SPKIDataImpl(const SPKIDataImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             VectorOfPairs(SPKISexp,XMLObject) v=getSPKISexps();
             for (vector< pair<SPKISexp*,XMLObject*> >::const_iterator i=src.m_SPKISexps.begin(); i!=src.m_SPKISexps.end(); i++) {
                 if (i->first) {
@@ -550,7 +544,7 @@ namespace xmlsignature {
         
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            if (XMLHelper::isNodeNamed(root,XMLConstants::XMLSIG_NS,SPKISexp::LOCAL_NAME)) {
+            if (XMLHelper::isNodeNamed(root,XMLSIG_NS,SPKISexp::LOCAL_NAME)) {
                 SPKISexp* typesafe=dynamic_cast<SPKISexp*>(childXMLObject);
                 if (typesafe) {
                     getSPKISexps().push_back(make_pair(typesafe,(XMLObject*)NULL));
@@ -560,7 +554,7 @@ namespace xmlsignature {
 
             // Unknown child (has to be paired with the last SPKISexp processed.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI) {
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
                 // Update second half of pair in vector, and in master list.
                 if (!m_SPKISexps.empty() && m_SPKISexps.back().second==NULL) {
                     m_SPKISexps.back().second=childXMLObject;
@@ -578,7 +572,6 @@ namespace xmlsignature {
     class XMLTOOL_DLLLOCAL PGPDataImpl : public virtual PGPData,
         public AbstractComplexElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -591,18 +584,15 @@ namespace xmlsignature {
         }
             
         PGPDataImpl(const PGPDataImpl& src)
-                : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractValidatingXMLObject(src) {
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) {
             init();
             if (src.getPGPKeyID())
                 setPGPKeyID(src.getPGPKeyID()->clonePGPKeyID());
             if (src.getPGPKeyPacket())
                 setPGPKeyPacket(src.getPGPKeyPacket()->clonePGPKeyPacket());
-            VectorOf(XMLObject) v=getPGPDataExtensions();
-            for (vector<XMLObject*>::const_iterator i=src.m_PGPDataExtensions.begin(); i!=src.m_PGPDataExtensions.end(); i++) {
-                if (*i) {
-                    v.push_back((*i)->clone());
-                }
-            }
+            VectorOf(XMLObject) v=getUnknownXMLObjects();
+            for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
+                v.push_back((*i)->clone());
         }
         
         void init() {
@@ -618,17 +608,19 @@ namespace xmlsignature {
         IMPL_XMLOBJECT_CLONE(PGPData);
         IMPL_TYPED_CHILD(PGPKeyID);
         IMPL_TYPED_CHILD(PGPKeyPacket);
-        IMPL_XMLOBJECT_CHILDREN(PGPDataExtension,m_children.end());
+        IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
 
     protected:
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILD(PGPKeyID,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILD(PGPKeyPacket,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILD(PGPKeyID,XMLSIG_NS,false);
+            PROC_TYPED_CHILD(PGPKeyPacket,XMLSIG_NS,false);
 
             // Unknown child.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI)
-                getPGPDataExtensions().push_back(childXMLObject);
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
+                getUnknownXMLObjects().push_back(childXMLObject);
+                return;
+            }
 
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
@@ -636,9 +628,7 @@ namespace xmlsignature {
 
     class XMLTOOL_DLLLOCAL KeyInfoImpl : public virtual KeyInfo,
         public AbstractComplexElement,
-        public AbstractSimpleElement,
         public AbstractDOMCachingXMLObject,
-        public AbstractValidatingXMLObject,
         public AbstractXMLObjectMarshaller,
         public AbstractXMLObjectUnmarshaller
     {
@@ -652,10 +642,7 @@ namespace xmlsignature {
         }
             
         KeyInfoImpl(const KeyInfoImpl& src)
-                : AbstractXMLObject(src),
-                    AbstractSimpleElement(src),
-                    AbstractDOMCachingXMLObject(src),
-                    AbstractValidatingXMLObject(src),
+                : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src),
                     m_Id(XMLString::replicate(src.m_Id)) {
 
             for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
@@ -702,13 +689,13 @@ namespace xmlsignature {
                         continue;
                     }
 
-                    getOthers().push_back((*i)->clone());
+                    getUnknownXMLObjects().push_back((*i)->clone());
                 }
             }
         }
         
         IMPL_XMLOBJECT_CLONE(KeyInfo);
-        IMPL_STRING_ATTRIB(Id);
+        IMPL_ID_ATTRIB(Id);
         IMPL_TYPED_CHILDREN(KeyName,m_children.end());
         IMPL_TYPED_CHILDREN(KeyValue,m_children.end());
         IMPL_TYPED_CHILDREN(RetrievalMethod,m_children.end());
@@ -716,8 +703,7 @@ namespace xmlsignature {
         IMPL_TYPED_CHILDREN(MgmtData,m_children.end());
         IMPL_TYPED_CHILDREN(SPKIData,m_children.end());
         IMPL_TYPED_CHILDREN(PGPData,m_children.end());
-        IMPL_XMLOBJECT_CHILDREN(Other,m_children.end());
-        IMPL_XMLOBJECT_CONTENT;
+        IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end());
 
     protected:
         void marshallAttributes(DOMElement* domElement) const {
@@ -725,24 +711,27 @@ namespace xmlsignature {
         }
 
         void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
-            PROC_TYPED_CHILDREN(X509Data,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(KeyName,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(KeyValue,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(RetrievalMethod,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(MgmtData,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(SPKIData,XMLConstants::XMLSIG_NS,false);
-            PROC_TYPED_CHILDREN(PGPData,XMLConstants::XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(X509Data,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(KeyName,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(KeyValue,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(RetrievalMethod,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(MgmtData,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(SPKIData,XMLSIG_NS,false);
+            PROC_TYPED_CHILDREN(PGPData,XMLSIG_NS,false);
             
             // Unknown child.
             const XMLCh* nsURI=root->getNamespaceURI();
-            if (!XMLString::equals(nsURI,XMLConstants::XMLSIG_NS) && nsURI && *nsURI)
-                getOthers().push_back(childXMLObject);
+            if (!XMLString::equals(nsURI,XMLSIG_NS) && nsURI && *nsURI) {
+                getUnknownXMLObjects().push_back(childXMLObject);
+                return;
+            }
             
             AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
         }
 
         void processAttribute(const DOMAttr* attribute) {
             PROC_ID_ATTRIB(Id,ID,NULL);
+            AbstractXMLObjectUnmarshaller::processAttribute(attribute);
         }
     };
     
@@ -884,3 +873,27 @@ const XMLCh X509Certificate::LOCAL_NAME[] = {
     };
 const XMLCh X509CRL::LOCAL_NAME[] = { XCH(X), XNUM(5), XNUM(0), XNUM(9), XCH(C), XCH(R), XCH(L), chNull };
 
+const XMLCh RetrievalMethod::TYPE_DSAKEYVALUE[] = {
+    chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,
+    chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
+    chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash, chDigit_0, chDigit_9, chForwardSlash,
+    chLatin_x, chLatin_m, chLatin_l, chLatin_d, chLatin_s, chLatin_i, chLatin_g, chPound,
+    chLatin_D, chLatin_S, chLatin_A, chLatin_K, chLatin_e, chLatin_y, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull
+    };
+
+const XMLCh RetrievalMethod::TYPE_RSAKEYVALUE[] = {
+    chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,
+    chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
+    chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash, chDigit_0, chDigit_9, chForwardSlash,
+    chLatin_x, chLatin_m, chLatin_l, chLatin_d, chLatin_s, chLatin_i, chLatin_g, chPound,
+    chLatin_R, chLatin_S, chLatin_A, chLatin_K, chLatin_e, chLatin_y, chLatin_V, chLatin_a, chLatin_l, chLatin_u, chLatin_e, chNull
+    };
+
+const XMLCh RetrievalMethod::TYPE_X509DATA[] = {
+    chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, chForwardSlash,
+    chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
+    chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash, chDigit_0, chDigit_9, chForwardSlash,
+    chLatin_x, chLatin_m, chLatin_l, chLatin_d, chLatin_s, chLatin_i, chLatin_g, chPound,
+    chLatin_X, chDigit_5, chDigit_0, chDigit_9, chLatin_D, chLatin_a, chLatin_t, chLatin_a, chNull
+    };
+