2 * Copyright 2001-2006 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * EncryptionSchemaValidators.cpp
20 * Schema validators for XML Encryption schema
24 #include "exceptions.h"
25 #include "encryption/Encryption.h"
27 using namespace xmlencryption;
28 using namespace xmltooling;
31 namespace xmlencryption {
33 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,KeySize);
34 XMLOBJECTVALIDATOR_SIMPLE(XMLTOOL_DLLLOCAL,OAEPparams);
36 BEGIN_XMLOBJECTVALIDATOR(XMLTOOL_DLLLOCAL,EncryptionMethod);
37 XMLOBJECTVALIDATOR_REQUIRE(EncryptionMethod,Algorithm);
38 END_XMLOBJECTVALIDATOR;
42 #define REGISTER_ELEMENT(namespaceURI,cname) \
43 q=QName(namespaceURI,cname::LOCAL_NAME); \
44 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
45 Validator::registerValidator(q,new cname##SchemaValidator())
47 #define REGISTER_TYPE(namespaceURI,cname) \
48 q=QName(namespaceURI,cname::TYPE_NAME); \
49 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
50 Validator::registerValidator(q,new cname##SchemaValidator())
52 void xmlencryption::registerEncryptionClasses()
55 REGISTER_ELEMENT(XMLConstants::XMLENC_NS,KeySize);
56 REGISTER_ELEMENT(XMLConstants::XMLENC_NS,OAEPparams);
57 REGISTER_ELEMENT(XMLConstants::XMLENC_NS,EncryptionMethod);
58 REGISTER_TYPE(XMLConstants::XMLENC_NS,EncryptionMethod);