Add XMLEnc 1.1 constants and MGF supporting code
[shibboleth/xmltooling.git] / xmltooling / encryption / Encryption.h
index f56a248..33c5e12 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2009 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
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * UCAID licenses this file to you 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
  *
- * 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.
+ * 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.
  */
 
 /**
@@ -28,6 +32,7 @@
 #include <xmltooling/util/XMLConstants.h>
 
 #include <cstdio>
+#include <boost/lexical_cast.hpp>
 
 namespace xmlsignature {
     class XMLTOOL_API KeyInfo;
@@ -43,6 +48,14 @@ namespace xmlsignature {
     DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmlconstants::XMLENC_NS,xmlconstants::XMLENC_PREFIX)
 
 /**
+ * Macro for declaring encryption 1.1 builders.
+ * 
+ * @param cname name of class being built
+ */
+#define DECL_XMLENC11OBJECTBUILDER(cname) \
+    DECL_XMLOBJECTBUILDER(XMLTOOL_API,cname,xmlconstants::XMLENC11_NS,xmlconstants::XMLENC11_PREFIX)
+
+/**
  * @namespace xmlencryption
  * Namespace for XML Encryption schema objects
  */
@@ -141,6 +154,12 @@ namespace xmlencryption {
         static const XMLCh TYPE_NAME[];
     END_XMLOBJECT;
 
+    BEGIN_XMLOBJECT(XMLTOOL_API,MGF,xmltooling::XMLObject,XML Encryption 1.1 MGF element);
+        DECL_STRING_ATTRIB(Algorithm,ALGORITHM);
+        /** MGFType local name */
+        static const XMLCh TYPE_NAME[];
+    END_XMLOBJECT;
+
     DECL_XMLENCOBJECTBUILDER(CarriedKeyName);
     DECL_XMLENCOBJECTBUILDER(CipherData);
     DECL_XMLENCOBJECTBUILDER(CipherReference);
@@ -157,6 +176,8 @@ namespace xmlencryption {
     DECL_XMLENCOBJECTBUILDER(ReferenceList);
     DECL_XMLENCOBJECTBUILDER(Transforms);
 
+    DECL_XMLENC11OBJECTBUILDER(MGF);
+
     /**
      * Registers builders and validators for XML Encryption classes into the runtime.
      */