Convert usage bits to a mask.
[shibboleth/xmltooling.git] / xmltooling / security / Credential.h
index 3b3362c..02d4999 100644 (file)
@@ -53,12 +53,32 @@ namespace xmltooling {
     public:
         virtual ~Credential() {}
         
+        /**
+         * Bitmask constants for limiting resolution process inside a CredentialResolver. 
+         */
         enum ResolveTypes {
             RESOLVE_KEYS = 1,
             RESOLVE_NAMES = 2
         };
 
         /**
+         * Bitmask of use cases for credentials. 
+         */
+        enum UsageTypes {
+            UNSPECIFIED_CREDENTIAL = 0,
+            SIGNING_CREDENTIAL = 1,
+            TLS_CREDENTIAL = 2,
+            ENCRYPTION_CREDENTIAL = 4
+        };
+        
+        /**
+         * Get credential usage types.
+         * 
+         * @return the usage bitmask
+         */
+        virtual unsigned int getUsage() const=0;
+
+        /**
          * Returns an algorithm identifier for the Credential.
          *
          * @return  the Credential algorithm, or NULL if indeterminate
@@ -101,9 +121,9 @@ namespace xmltooling {
          * communicating with other entities.
          * 
          * @param compact   true iff the communication medium is such that only compact forms should be included
-         * @return reference to a KeyInfo object
+         * @return a KeyInfo object, which must be freed by the caller
          */
-        virtual const xmlsignature::KeyInfo* getKeyInfo(bool compact=false) const=0;
+        virtual xmlsignature::KeyInfo* getKeyInfo(bool compact=false) const=0;
 
         /**
          * Get the credential context information, which provides additional information
@@ -114,14 +134,6 @@ namespace xmltooling {
         virtual const CredentialContext* getCredentalContext() const {
             return NULL;
         }
-
-        /**
-         * Determines whether the supplied CredentialCriteria matches this Credential.
-         *
-         * @param criteria  the CredentialCriteria to evaluate
-         * @return true iff this Credential is consistent with the criteria
-         */
-        virtual bool matches(const CredentialCriteria& criteria) const;
     };
 };