Moved DOM methods up the tree, add copy c'tors, KeyInfo sample
[shibboleth/xmltooling.git] / xmltooling / signature / Signature.h
index 9a8838a..bf886fc 100644 (file)
@@ -23,8 +23,9 @@
 #if !defined(__xmltooling_sig_h__) && !defined(XMLTOOLING_NO_XMLSEC)\r
 #define __xmltooling_sig_h__\r
 \r
-#include <xmltooling/XMLObject.h>\r
+#include <xmltooling/XMLObjectBuilder.h>\r
 #include <xmltooling/signature/SigningContext.h>\r
+#include <xmltooling/signature/VerifyingContext.h>\r
 \r
 namespace xmltooling {\r
 \r
@@ -45,29 +46,6 @@ namespace xmltooling {
         static const XMLCh LOCAL_NAME[];\r
 \r
         /**\r
-         * Gets the canonicalization method for the ds:SignedInfo element.\r
-         * \r
-         * @return the canonicalization method\r
-         */\r
-        virtual const XMLCh* getCanonicalizationMethod() const=0;\r
-        \r
-        /**\r
-         * Gets the signing algorithm for the signature.\r
-         * \r
-         * @return the signature algorithm\r
-         */\r
-        virtual const XMLCh* getSignatureAlgorithm() const=0;\r
-\r
-        /**\r
-         * Returns the ds:KeyInfo information attached to the signature.\r
-         * The Signature object must be marshalled before this will return anything.\r
-         * The caller MUST NOT mutate the information through the provided pointer.\r
-         * \r
-         * @return the ds:KeyInfo information\r
-         */\r
-        virtual DSIGKeyInfoList* getKeyInfo() const=0; \r
-\r
-        /**\r
          * Sets the canonicalization method for the ds:SignedInfo element\r
          * \r
          * @param c14n  the canonicalization method\r
@@ -87,12 +65,42 @@ namespace xmltooling {
          * @param ctx   the signing context that determines the signature's content\r
          * @throws SignatureException   thrown if the signing operation fails\r
          */\r
-        virtual void sign(const SigningContext* ctx)=0;\r
+        virtual void sign(const SigningContext& ctx)=0;\r
         \r
+        /**\r
+         * Verifies an XML signature based on the supplied context.\r
+         * \r
+         * @param ctx   the verifying context that validates the signature's content\r
+         * @throws SignatureException   thrown if the verifying operation fails\r
+         */\r
+        virtual void verify(const VerifyingContext& ctx) const=0;\r
+\r
     protected:\r
         Signature() {}\r
     };\r
 \r
+#ifdef XMLTOOLING_DEFINE_CONSTANTS\r
+    const XMLCh Signature::LOCAL_NAME[] = {\r
+        chLatin_S, chLatin_i, chLatin_g, chLatin_n, chLatin_a, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chNull\r
+    }; \r
+    const XMLCh Signature::PREFIX[] = {\r
+        chLatin_d, chLatin_s, chNull\r
+    };\r
+#endif\r
+\r
+    /**\r
+     * Builder for Signature objects.\r
+     */\r
+    class XMLTOOL_API SignatureBuilder : public XMLObjectBuilder\r
+    {\r
+    public:\r
+        virtual ~SignatureBuilder() {}\r
+\r
+        /**\r
+         * Default builder.\r
+         */\r
+        virtual Signature* buildObject() const=0;\r
+    };\r
 };\r
 \r
 #endif /* __xmltooling_sig_h__ */\r