Major revamp of credential and trust handling code, PKIX engine still needs work.
[shibboleth/cpp-xmltooling.git] / xmltooling / signature / Signature.h
index db95c20..d26ccb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -122,8 +122,10 @@ namespace xmlsignature {
         /**
          * Compute and append the signature based on the assigned
          * ContentReference, KeyInfo, and signing key.
+         *
+         * @param credential    optional source of signing key and KeyInfo
          */
-        virtual void sign()=0;
+        virtual void sign(const xmltooling::Credential* credential=NULL)=0;
 
         /**
          * Type-safe clone operation.
@@ -187,7 +189,11 @@ namespace xmlsignature {
     class XMLTOOL_API SignatureBuilder : public xmltooling::XMLObjectBuilder
     {
     public:
+#ifdef HAVE_COVARIANT_RETURNS
         virtual Signature* buildObject(
+#else
+        virtual xmltooling::XMLObject* buildObject(
+#endif
             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const xmltooling::QName* schemaType=NULL
             ) const;
             
@@ -196,16 +202,25 @@ namespace xmlsignature {
          * 
          * @return empty Signature object
          */
+#ifdef HAVE_COVARIANT_RETURNS
         virtual Signature* buildObject() const;
-
+#else
+        virtual xmltooling::XMLObject* buildObject() const;
+#endif
+        /** Singleton builder. */
         static Signature* buildSignature() {
             const SignatureBuilder* b = dynamic_cast<const SignatureBuilder*>(
                 xmltooling::XMLObjectBuilder::getBuilder(
                     xmltooling::QName(xmlconstants::XMLSIG_NS,Signature::LOCAL_NAME)
                     )
                 );
-            if (b)
+            if (b) {
+#ifdef HAVE_COVARIANT_RETURNS
                 return b->buildObject();
+#else
+                return dynamic_cast<Signature*>(b->buildObject());
+#endif
+            }
             throw xmltooling::XMLObjectException("Unable to obtain typed builder for Signature.");
         }
     };