[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling: encryption/Encryption.h encryption/impl/EncryptionImpl.cpp enc...

noreply at shibboleth.net noreply at shibboleth.net
Wed Aug 1 00:09:48 EDT 2012


Author: scantor
Date: Wed Aug  1 00:09:47 2012
New Revision: 991

URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=991&view=rev
Log:
Add XMLEnc 1.1 constants and MGF supporting code

Modified:
    branches/REL_1/xmltooling/encryption/Encryption.h
    branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp
    branches/REL_1/xmltooling/encryption/impl/EncryptionSchemaValidators.cpp
    branches/REL_1/xmltooling/util/XMLConstants.cpp
    branches/REL_1/xmltooling/util/XMLConstants.h

Modified: branches/REL_1/xmltooling/encryption/Encryption.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/encryption/Encryption.h?rev=991&r1=990&r2=991&view=diff
==============================================================================
--- branches/REL_1/xmltooling/encryption/Encryption.h (original)
+++ branches/REL_1/xmltooling/encryption/Encryption.h Wed Aug  1 00:09:47 2012
@@ -46,6 +46,14 @@
  */
 #define DECL_XMLENCOBJECTBUILDER(cname) \
     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
@@ -146,6 +154,12 @@
         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);
@@ -162,6 +176,8 @@
     DECL_XMLENCOBJECTBUILDER(ReferenceList);
     DECL_XMLENCOBJECTBUILDER(Transforms);
 
+    DECL_XMLENC11OBJECTBUILDER(MGF);
+
     /**
      * Registers builders and validators for XML Encryption classes into the runtime.
      */

Modified: branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp?rev=991&r1=990&r2=991&view=diff
==============================================================================
--- branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp (original)
+++ branches/REL_1/xmltooling/encryption/impl/EncryptionImpl.cpp Wed Aug  1 00:09:47 2012
@@ -636,6 +636,46 @@
         }
     };
 
+    class XMLTOOL_DLLLOCAL MGFImpl : public virtual MGF,
+        public AbstractSimpleElement,
+        public AbstractDOMCachingXMLObject,
+        public AbstractXMLObjectMarshaller,
+        public AbstractXMLObjectUnmarshaller
+    {
+        void init() {
+            m_Algorithm = nullptr;
+        }
+
+    public:
+        virtual ~MGFImpl() {
+            XMLString::release(&m_Algorithm);
+        }
+
+        MGFImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType)
+                : AbstractXMLObject(nsURI, localName, prefix, schemaType) {
+            init();
+        }
+            
+        MGFImpl(const MGFImpl& src)
+                : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) {
+            init();
+            IMPL_CLONE_ATTRIB(Algorithm);
+        }
+        
+        IMPL_XMLOBJECT_CLONE(MGF);
+        IMPL_STRING_ATTRIB(Algorithm);
+
+    protected:
+        void marshallAttributes(DOMElement* domElement) const {
+            MARSHALL_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+        }
+
+        void processAttribute(const DOMAttr* attribute) {
+            PROC_STRING_ATTRIB(Algorithm,ALGORITHM,nullptr);
+            AbstractXMLObjectUnmarshaller::processAttribute(attribute);
+        }
+    };
+
 };
 
 #if defined (_MSC_VER)
@@ -659,6 +699,8 @@
 IMPL_XMLOBJECTBUILDER(OAEPparams);
 IMPL_XMLOBJECTBUILDER(ReferenceList);
 IMPL_XMLOBJECTBUILDER(Transforms);
+
+IMPL_XMLOBJECTBUILDER(MGF);
 
 // Unicode literals
 
@@ -700,3 +742,7 @@
 const XMLCh ReferenceType::URI_ATTRIB_NAME[] =          UNICODE_LITERAL_3(U,R,I);
 const XMLCh Transforms::LOCAL_NAME[] =                  UNICODE_LITERAL_10(T,r,a,n,s,f,o,r,m,s);
 const XMLCh Transforms::TYPE_NAME[] =                   UNICODE_LITERAL_14(T,r,a,n,s,f,o,r,m,s,T,y,p,e);
+
+const XMLCh MGF::LOCAL_NAME[] =                         UNICODE_LITERAL_3(M,G,F);
+const XMLCh MGF::TYPE_NAME[] =                          UNICODE_LITERAL_7(M,G,F,T,y,p,e);
+const XMLCh MGF::ALGORITHM_ATTRIB_NAME[] =              UNICODE_LITERAL_9(A,l,g,o,r,i,t,h,m);

Modified: branches/REL_1/xmltooling/encryption/impl/EncryptionSchemaValidators.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/encryption/impl/EncryptionSchemaValidators.cpp?rev=991&r1=990&r2=991&view=diff
==============================================================================

[... 86 lines stripped ...]


More information about the commits mailing list