io/AbstractXMLObjectMarshaller.cpp \
io/AbstractXMLObjectUnmarshaller.cpp \
signature/impl/KeyInfoImpl.cpp \
+ signature/impl/KeyInfoSchemaValidators.cpp \
util/NDC.cpp \
util/ParserPool.cpp \
util/XMLConstants.cpp \
* Library configuration
*/
-#define XMLTOOLING_DECLARE_VALIDATORS
-
#include "internal.h"
#include "exceptions.h"
#include "XMLToolingConfig.h"
using namespace log4cpp;
using namespace std;
-#define REGISTER_ELEMENT(namespaceURI,cname) \
- q=QName(namespaceURI,cname::LOCAL_NAME); \
- XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
- Validator::registerValidator(q,new cname##SchemaValidator())
-
-#define REGISTER_TYPE(namespaceURI,cname) \
- q=QName(namespaceURI,cname::TYPE_NAME); \
- XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
- Validator::registerValidator(q,new cname##SchemaValidator())
-
-
DECL_EXCEPTION_FACTORY(XMLParserException,xmltooling);
DECL_EXCEPTION_FACTORY(XMLObjectException,xmltooling);
DECL_EXCEPTION_FACTORY(MarshallingException,xmltooling);
// default registrations
XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());
-
- QName q;
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyInfo);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyName);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyValue);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,MgmtData);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,DSAKeyValue);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,RSAKeyValue);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Exponent);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Modulus);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,P);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Q);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,G);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Y);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,J);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Seed);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PgenCounter);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,XPath);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Transform);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Transforms);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,RetrievalMethod);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509IssuerSerial);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509IssuerName);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SerialNumber);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SKI);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SubjectName);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509Certificate);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509CRL);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509Data);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,SPKISexp);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,SPKIData);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPKeyID);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPKeyPacket);
- REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPData);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,KeyInfo);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,KeyValue);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,DSAKeyValue);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,RSAKeyValue);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,Transform);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,Transforms);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,RetrievalMethod);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,X509IssuerSerial);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,X509Data);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,SPKIData);
- REGISTER_TYPE(XMLConstants::XMLSIG_NS,PGPData);
+ registerKeyInfoClasses();
+
REGISTER_EXCEPTION_FACTORY(XMLParserException,xmltooling);
REGISTER_EXCEPTION_FACTORY(XMLObjectException,xmltooling);
REGISTER_EXCEPTION_FACTORY(MarshallingException,xmltooling);
{chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, chNull}
+#define UNICODE_LITERAL_27(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chNull}
+#define UNICODE_LITERAL_28(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chNull}
+#define UNICODE_LITERAL_29(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chNull}
+#define UNICODE_LITERAL_30(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chNull}
+#define UNICODE_LITERAL_31(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chNull}
+#define UNICODE_LITERAL_32(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chNull}
#endif /* DOXYGEN_SKIP */
/**
+ * Begins the declaration of an XMLObject specialization for an abstract element/type.
+ * Basic boilerplate includes a protected constructor, empty virtual destructor,
+ * and Unicode constants for the default associated element's name and prefix.
+ *
+ * @param linkage linkage specifier for the class
+ * @param cname the name of the class to declare
+ * @param base the base class to derive from using public virtual inheritance
+ * @param desc documentation comment for class
+ */
+#define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
+ XMLTOOLING_DOXYGEN(desc) \
+ class linkage cname : public virtual base { \
+ protected: \
+ cname() {} \
+ public: \
+ virtual ~cname() {} \
+ XMLTOOLING_DOXYGEN(Element local name) \
+ static const XMLCh LOCAL_NAME[]; \
+ }
+
+/**
* Begins the declaration of an XMLObject specialization.
* Basic boilerplate includes a protected constructor, empty virtual destructor,
* and Unicode constants for the default associated element's name and prefix.
}
}
}
+
+void AbstractXMLObjectUnmarshaller::processChildElement(XMLObject* child, const DOMElement* childRoot)
+{
+ throw UnmarshallingException("Child elements are not permitted on this object.");
+}
* A thread-safe abstract unmarshaller.\r
*/\r
\r
-#if !defined(__xmltooling_xmlunmarshaller_h__)\r
+#ifndef __xmltooling_xmlunmarshaller_h__\r
#define __xmltooling_xmlunmarshaller_h__\r
\r
#include <xmltooling/AbstractDOMCachingXMLObject.h>\r
* \r
* @throws UnmarshallingException thrown if there is a problem adding the child to the parent\r
*/\r
- virtual void processChildElement(XMLObject* child, const DOMElement* childRoot) {}\r
+ virtual void processChildElement(XMLObject* child, const DOMElement* childRoot);\r
\r
/**\r
* Called after an attribute has been unmarshalled so that it can be added to the XMLObject.\r
#include <xmltooling/util/XMLConstants.h>
#include <xmltooling/validation/ValidatingXMLObject.h>
-#include <typeinfo>
-
#define DECL_XMLSIGOBJECTBUILDER(cname) \
DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmltooling::XMLConstants::XMLSIG_NS,xmltooling::XMLConstants::XMLSIG_PREFIX)
DECL_XMLSIGOBJECTBUILDER(KeyValue);
DECL_XMLSIGOBJECTBUILDER(KeyInfo);
-#ifdef XMLTOOLING_DECLARE_VALIDATORS
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeyName);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Modulus);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Exponent);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Seed);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,P);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Q);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,G);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Y);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,J);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,XPath);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID);
- XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket);
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RSAKeyValue);
- XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Modulus);
- XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Exponent);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,DSAKeyValue);
- XMLOBJECTVALIDATOR_REQUIRE(DSAKeyValue,Y);
- XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,P,Q);
- XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,Seed,PgenCounter);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyValue);
- XMLOBJECTVALIDATOR_ONEOF3(KeyValue,DSAKeyValue,RSAKeyValue,XMLObject);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transform);
- XMLOBJECTVALIDATOR_REQUIRE(Transform,Algorithm);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transforms);
- XMLOBJECTVALIDATOR_NONEMPTY(Transforms,Transform);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RetrievalMethod);
- XMLOBJECTVALIDATOR_REQUIRE(RetrievalMethod,URI);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,X509IssuerSerial);
- XMLOBJECTVALIDATOR_REQUIRE(X509IssuerSerial,X509IssuerName);
- XMLOBJECTVALIDATOR_REQUIRE(X509IssuerSerial,X509SerialNumber);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,X509Data);
- if (!ptr->hasChildren())
- throw xmltooling::ValidationException("X509Data must have at least one child element.");
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,SPKIData);
- XMLOBJECTVALIDATOR_NONEMPTY(SPKIData,SPKISexp);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,PGPData);
- XMLOBJECTVALIDATOR_ONEOF(PGPData,PGPKeyID,PGPKeyPacket);
- END_XMLOBJECTVALIDATOR;
-
- BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyInfo);
- if (!ptr->hasChildren())
- throw xmltooling::ValidationException("KeyInfo must have at least one child element.");
- END_XMLOBJECTVALIDATOR;
-#endif /* XMLTOOLING_DECLARE_VALIDATORS */
-
+ /**
+ * Registers builders and validators for KeyInfo classes into the runtime.
+ */
+ void XMLTOOL_API registerKeyInfoClasses();
};
#endif /* __xmltooling_keyinfo_h__ */
--- /dev/null
+/*
+* Copyright 2001-2006 Internet2
+ *
+* Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * KeyInfoSchemaValidators.cpp
+ *
+ * Schema validators for KeyInfo schema
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "signature/KeyInfo.h"
+
+using namespace xmlsignature;
+using namespace xmltooling;
+using namespace std;
+
+namespace xmlsignature {
+
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeyName);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,MgmtData);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Modulus);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Exponent);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Seed);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PgenCounter);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,P);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Q);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,G);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,Y);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,J);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,XPath);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509IssuerName);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SerialNumber);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SKI);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509SubjectName);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509Certificate);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,X509CRL);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,SPKISexp);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyID);
+ XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,PGPKeyPacket);
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RSAKeyValue);
+ XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Modulus);
+ XMLOBJECTVALIDATOR_REQUIRE(RSAKeyValue,Exponent);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,DSAKeyValue);
+ XMLOBJECTVALIDATOR_REQUIRE(DSAKeyValue,Y);
+ XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,P,Q);
+ XMLOBJECTVALIDATOR_NONEORBOTH(DSKeyValue,Seed,PgenCounter);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyValue);
+ XMLOBJECTVALIDATOR_ONEOF3(KeyValue,DSAKeyValue,RSAKeyValue,XMLObject);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transform);
+ XMLOBJECTVALIDATOR_REQUIRE(Transform,Algorithm);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,Transforms);
+ XMLOBJECTVALIDATOR_NONEMPTY(Transforms,Transform);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,RetrievalMethod);
+ XMLOBJECTVALIDATOR_REQUIRE(RetrievalMethod,URI);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,X509IssuerSerial);
+ XMLOBJECTVALIDATOR_REQUIRE(X509IssuerSerial,X509IssuerName);
+ XMLOBJECTVALIDATOR_REQUIRE(X509IssuerSerial,X509SerialNumber);
+ END_XMLOBJECTVALIDATOR;
+
+ class XMLTOOL_DLLLOCAL checkWildcardNS {
+ public:
+ void operator()(const XMLObject* xmlObject) const {
+ const XMLCh* ns=xmlObject->getElementQName().getNamespaceURI();
+ if (XMLString::equals(ns,XMLConstants::XMLSIG_NS) || !ns || !*ns) {
+ throw ValidationException(
+ "X509Data contains an illegal extension element ($1).",
+ params(1,xmlObject->getElementQName().toString().c_str())
+ );
+ }
+ }
+ };
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,X509Data);
+ if (!ptr->hasChildren())
+ throw ValidationException("X509Data must have at least one child element.");
+ vector<XMLObject*> anys=ptr->getXMLObjects();
+ for_each(anys.begin(),anys.end(),checkWildcardNS());
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,SPKIData);
+ XMLOBJECTVALIDATOR_NONEMPTY(SPKIData,SPKISexp);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,PGPData);
+ XMLOBJECTVALIDATOR_ONEOF(PGPData,PGPKeyID,PGPKeyPacket);
+ END_XMLOBJECTVALIDATOR;
+
+ BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,KeyInfo);
+ if (!ptr->hasChildren())
+ throw ValidationException("KeyInfo must have at least one child element.");
+ vector<XMLObject*> anys=ptr->getXMLObjects();
+ for_each(anys.begin(),anys.end(),checkWildcardNS());
+ END_XMLOBJECTVALIDATOR;
+
+};
+
+#define REGISTER_ELEMENT(namespaceURI,cname) \
+ q=QName(namespaceURI,cname::LOCAL_NAME); \
+ XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+ Validator::registerValidator(q,new cname##SchemaValidator())
+
+#define REGISTER_TYPE(namespaceURI,cname) \
+ q=QName(namespaceURI,cname::TYPE_NAME); \
+ XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
+ Validator::registerValidator(q,new cname##SchemaValidator())
+
+void xmlsignature::registerKeyInfoClasses()
+{
+ QName q;
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyInfo);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyName);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,KeyValue);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,MgmtData);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,DSAKeyValue);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,RSAKeyValue);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Exponent);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Modulus);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,P);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Q);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,G);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Y);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,J);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Seed);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PgenCounter);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,XPath);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Transform);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,Transforms);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,RetrievalMethod);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509IssuerSerial);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509IssuerName);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SerialNumber);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SKI);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509SubjectName);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509Certificate);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509CRL);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,X509Data);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,SPKISexp);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,SPKIData);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPKeyID);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPKeyPacket);
+ REGISTER_ELEMENT(XMLConstants::XMLSIG_NS,PGPData);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,KeyInfo);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,KeyValue);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,DSAKeyValue);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,RSAKeyValue);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,Transform);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,Transforms);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,RetrievalMethod);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,X509IssuerSerial);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,X509Data);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,SPKIData);
+ REGISTER_TYPE(XMLConstants::XMLSIG_NS,PGPData);
+}
>\r
</File>\r
<File\r
+ RelativePath=".\signature\impl\KeyInfoSchemaValidators.cpp"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\signature\impl\XMLSecSignatureImpl.cpp"\r
>\r
</File>\r